-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathblittris.cpp
More file actions
87 lines (64 loc) · 1.82 KB
/
blittris.cpp
File metadata and controls
87 lines (64 loc) · 1.82 KB
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
/*
* blittris.cpp - part of BlitTris, a Tetris-like game for the 32blit
*
* This program is released under the MIT License. See LICENSE for more details.
*
* This file contians the main entry functions to the 32blit framework;
* one-time initialisation, and render/update functions called every frame.
*/
/* System headers. */
/* Local headers. */
#include "32blit.hpp"
#include "blittris.hpp"
#include "assets.hpp"
#include "game.hpp"
/* Functions. */
using namespace blit;
Game *g_game = NULL;
/*
* void init( void ) - called once when the game is launched.
*/
void init( void )
{
/* Make sure we're in hi-res, 320x240 mode. */
set_screen_mode( ScreenMode::hires );
/* Load up the sprite sheet. */
screen.sprites = SpriteSheet::load( g_asset_sprites );
/* And initialise our font handling - the API doesn't support colour, */
/* so this all has to be done via a spritesheet and our own code. */
/* For now, dive straight into the game. */
g_game = new Game();
/* All done. */
return;
}
/*
* void update( uint32_t ) - called every frame to update the world.
*
* uint32_t - the time in milliseconds since the epoch
*/
void update( uint32_t p_timestamp )
{
/* For now, dive straight into the game. */
if ( NULL != g_game )
{
g_game->update( p_timestamp );
}
/* All done. */
return;
}
/*
* void render( uint32_t ) - called every frame to draw the world to the screen.
*
* uint32_t - the time in milliseconds since the epoch
*/
void render( uint32_t p_timestamp )
{
/* For now, dive straight into the game. */
if ( NULL != g_game )
{
g_game->render( p_timestamp );
}
/* All done. */
return;
}
/* End of file blittris.cpp */