-
Notifications
You must be signed in to change notification settings - Fork 0
/
events.h
71 lines (59 loc) · 1.29 KB
/
events.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
// events.h
#ifndef EVENTS_H
#define EVENTS_H
#include <vector>
#include <irrlicht.h>
namespace ic = irr::core;
namespace is = irr::scene;
namespace iv = irr::video;
class MyAnimationEndCallback : public is::IAnimationEndCallBack
{
public:
void OnAnimationEnd(is::IAnimatedMeshSceneNode *node)
{
if (crouch)
{
node->setLoopMode(false);
node->setCurrentFrame(54);
}
else if (is_dead)
{
node->setLoopMode(false);
node->setCurrentFrame(108);
}
else
{
node->setLoopMode(true);
node->setFrameLoop(0, 12); // Idle
}
enable_action = true;
enable_movement = true;
return;
}
bool enable_action;
bool enable_movement;
bool crouch;
bool is_dead;
};
class EventReceiver : public irr::IEventReceiver
{
bool button_pressed;
int old_x, old_y;
bool keyboard(const irr::SEvent &event);
bool mouse(const irr::SEvent &event);
public:
EventReceiver();
is::IAnimatedMeshSceneNode *player1;
is::IAnimatedMeshSceneNode *player2;
irr::scene::ICameraSceneNode* cam;
bool OnEvent(const irr::SEvent &event);
bool is_mouse_pressed(int &x, int &y);
bool keys[irr::KEY_KEY_CODES_COUNT];
char new_animationP1;
char old_animationP1;
char new_animationP2;
char old_animationP2;
bool actionP1 = false;
bool actionP2 = false;
};
#endif