-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcScene.h
65 lines (54 loc) · 1.36 KB
/
cScene.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
// Copyright 2015 Kelvin Chandra, Software Laboratory Center, Binus University. All Rights Reserved.
#pragma once
#include "Globals.h"
class cScene
{
protected:
public:
cScene();
~cScene();
/**
method that will be called first and only once when
*/
virtual void Init() = 0;
/**
method that will be called each frame, use this to update the scene/game logic
*/
virtual void Update(float tpf = 0.0333) = 0;
/**
method that will be called each frame after update been
*/
virtual void Render() = 0;
/**
Read normal keyboard input such as [a...z], this method been called from cGame
*/
virtual void ReadKeyboard(unsigned char key, int x, int y, bool press) = 0;
/**
Read special keyboard input such as ctrl, this method been called from cGame
*/
virtual void ReadSpecialKeyboard(unsigned char key, int x, int y, bool press) = 0;
/**
Read mouse input, this method been called from cGame
*/
virtual void ReadMouse(int button, int state, int x, int y) = 0;
/**
Render String Example
*/
void renderBitmapString(
float x,
float y,
float z,
void *font,
const char *string,
float r,
float g,
float b) {
glColor3f(r, g, b);
const char *c;
glRasterPos3f(x, y, z);
for (c = string; *c != '\0'; c++) {
glutBitmapCharacter(font, *c);
}
glColor3f(1.0f, 1.0f, 1.0f);
}
};