PGR Copakond OpenGL Engine - Bowling
Loading...
Searching...
No Matches
inputController.h
Go to the documentation of this file.
1#ifndef PGR_SEM_COPAKOND_INPUTCONTROLLER_H
2#define PGR_SEM_COPAKOND_INPUTCONTROLLER_H
3
4#include "controller.h"
9#include "levelEditor.h"
10
11namespace copakond {
13 class InputController : public Controller {
14 private:
15 bool _canMove = true;
16 bool _isFullScreen = false;
17
18 LevelEditor* _levelEditor = nullptr;
19 Camera* camera;
20 Input* input;
21 Spline* _spline = nullptr;
22 RigidBody* player = nullptr;
23
24 void toggleFullScreen();
25 void switchCamera(int mode);
26
27 public:
28 float baseSpeed = 1.5f;
29 float shiftMultiplier = 1.75f;
30 float mouseDragCoeff = 0.05f;
31
32 InputController(Camera* cam, Input* input) : camera(cam), input(input) {};
33 void setPlayer(RigidBody* p) { player = p; }
34 void setLevelEditor(LevelEditor* lev) { _levelEditor = lev; }
35 LevelEditor* getLevelEditor() { return _levelEditor; }
36
37 void update(float deltaTime) override;
38
45 int raycast(int x, int y);
46
48 void setCameraSpline(Spline *spline) { _spline = spline; }
49
50 void onKeyboardEvent(unsigned char key, int x, int y, bool isDown) override;
51 void onMouseButtonEvent(int button, int state, int x, int y) override;
52 void onMenuEvent(int option) override;
53 };
54}
55
56#endif //PGR_SEM_COPAKOND_INPUTCONTROLLER_H
Camera for generating view and projection matrices.
Definition camera.h:20
int raycast(int x, int y)
Performs stencil buffer reading at cursor position to find object ID.
Definition inputController.cpp:94
void setPlayer(RigidBody *p)
Definition inputController.h:33
void onMouseButtonEvent(int button, int state, int x, int y) override
Definition inputController.cpp:88
void onMenuEvent(int option) override
Definition inputController.cpp:105
LevelEditor * getLevelEditor()
Definition inputController.h:35
float baseSpeed
Definition inputController.h:28
InputController(Camera *cam, Input *input)
Definition inputController.h:32
void update(float deltaTime) override
Definition inputController.cpp:6
float shiftMultiplier
Definition inputController.h:29
void setLevelEditor(LevelEditor *lev)
Definition inputController.h:34
float mouseDragCoeff
Definition inputController.h:30
void setCameraSpline(Spline *spline)
Attaches the active camera to a spline for cinematic movement.
Definition inputController.h:48
void onKeyboardEvent(unsigned char key, int x, int y, bool isDown) override
Definition inputController.cpp:164
Global input manager tracking keyboard states and mouse deltas.
Definition input.h:20
Runtime editor utility allowing the user to pick, move, and save mesh transformations.
Definition levelEditor.h:19
Kinematic object affected by gravity, friction, and collision resolution.
Definition rigidBody.h:7
Base class for parameterized spline animations.
Definition spline.h:9
PGR Semestral work with sample scenes and bowling. doxygen was generated with a help of LLM.
Definition bezier.cpp:3