-
Notifications
You must be signed in to change notification settings - Fork 0
input_system::triple_axis
Paweł Waligóra edited this page May 22, 2024
·
2 revisions
Meant for tracking values controlled by 6 keys. Eg. forward/backward/left/right/up/down movement.
To Use construct triple_axis object in game::your_script
scope. To get axis value call triple_axis::raw()
or triple_axis.normalized()
.
triple_axis::normalized()
will make sure vector made from 3 axis' states is normalized. triple_axis::raw()
will treat 3 axis independently.
following example shows how to use input_system::double_axis in a script.
#include"axis.h"
#include"time_system.h"
#include<glm/glm.hpp>
namespace game {
class my_script {
private:
input_system::triple_axis a = input_system::axis(GLFW_KEY_UP, GLFW_KEY_DOWN, GLFW_KEY_LEFT, GLFW_KEY_RIGHT, GLFW_KEY_W, GLFW_KEY_S); // constuct axis object
glm::vec3 r = glm::vec3(0.0f);
glm::vec3 n = glm::vec3(0.0f);
// ...
public:
virtual void update();
// ...
};
}
// ...
void game::my_script::update(){
r += a.raw() * (float)time::delta_time; // get axis raw value using triple_axis::raw();
n += a.normalized() * (float)time::delta_time; // get axis normalized value using triple_axis::normalized();
// ...
}
- engine
- scripts_system
- scene_loader
- time_system
-
input_system
- input_system::key_held
- input_system::key_events
- input_system::subscribe() (deprecated)
- input_system::axis_state()
- input_system::key_bind
- input_system::axis
- input_system::double_axis
- input_system::triple_axis
- input_system::axis2
- input_system::double_axis2
- input_system::triple_axis2
- input_system::axis-choice
- renderer
- physics
- ui_system
- game