added velocity to delta helper function
This commit is contained in:
parent
4bf9b6cf9d
commit
6e958debf0
2
lib/sb
2
lib/sb
|
@ -1 +1 @@
|
|||
Subproject commit ee119ecc7e4287838cec5aac127820d4738de17f
|
||||
Subproject commit 3444afc2c1291814d97efb94ca8aecb6e6698c40
|
|
@ -115,18 +115,19 @@ void Pepy::respond(SDL_Event& event)
|
|||
{
|
||||
/* Will check if reset should be triggered */
|
||||
bool reset = false;
|
||||
/* Check for any direction when waiting to reset */
|
||||
/* Check for any direction key when waiting to reset */
|
||||
if (stopped && delegate.compare(event, {"up", "down", "left", "right"}))
|
||||
{
|
||||
reset = true;
|
||||
}
|
||||
/* Check mouse buttons for grabbing */
|
||||
if (event.type == SDL_MOUSEBUTTONDOWN)
|
||||
{
|
||||
if (shaking)
|
||||
{
|
||||
grabbed = true;
|
||||
}
|
||||
/* Mouse button will trigger reset when stopped */
|
||||
/* Mouse button will trigger reset when game is waiting to reset */
|
||||
else if (stopped)
|
||||
{
|
||||
reset = true;
|
||||
|
@ -136,7 +137,7 @@ void Pepy::respond(SDL_Event& event)
|
|||
{
|
||||
grabbed = false;
|
||||
}
|
||||
/* Reset to countdown */
|
||||
/* Reset to cuckoo time */
|
||||
if (reset)
|
||||
{
|
||||
float size = configuration()["sim"]["ball-scale"];
|
||||
|
@ -251,7 +252,7 @@ void Pepy::update()
|
|||
ball.second.x = angle + glm::half_pi<float>();
|
||||
}
|
||||
}
|
||||
glm::vec2 step {glm::sin(ball.second.x) * ball.second.y, -glm::cos(ball.second.x) * ball.second.y};
|
||||
glm::vec2 step = sb::velocity_to_delta(ball.second);
|
||||
ball.first.transformation(glm::translate(glm::vec3{step.x, step.y, 0.0f}) * ball.first.transformation());
|
||||
if (ball.second.y > 0)
|
||||
{
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#ifndef PEPY_H_
|
||||
#define PEPY_H_
|
||||
|
||||
/* Enable swizzling in GLM */
|
||||
/* GLM */
|
||||
#define GLM_ENABLE_EXPERIMENTAL
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtx/compatibility.hpp>
|
||||
|
@ -11,6 +11,7 @@
|
|||
/* [SPACE BOX] headers */
|
||||
#include "Game.hpp"
|
||||
#include "VBO.hpp"
|
||||
#include "math.hpp"
|
||||
|
||||
/* Project headers */
|
||||
#include "Model.hpp"
|
||||
|
|
Loading…
Reference in New Issue