-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgfx_system.cpp
75 lines (59 loc) · 1.81 KB
/
gfx_system.cpp
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
/************************************************************************************
* gfx_system.cpp
*
* descp : prototypes for system level graphics functionality ( timing as well )
*
* auth : javery
*
* path : C:\Program Files\Microsoft Visual Studio\MyProjects\PrimaryCubes3D\gfx_system.h
*
* iDate : 09/18/06
* version:
************************************************************************************/
#include <allegro.h>
#include "common.h"
#include "gfx_system.h"
volatile int globalTickCount = 0; // controls overall game speed
BITMAP* pageOne,*pageTwo,*pageThree;
/*
================================================================
GFX_SYSTEM_SetVideoMode
Sets the specified video mode. Returns 'c_false' upon error.
================================================================
*/
c_boolean GFX_SYS_SetVideoMode( pGame_t pGame , int xRes , int yRes , int depth , c_boolean fullScreen )
{
allegro_init();
set_color_depth( depth );
pGame->gfxConfig.xDimen = xRes;
pGame->gfxConfig.yDimen = yRes;
pGame->gfxConfig.bitDepth = depth;
if( fullScreen )
{
if( set_gfx_mode( GFX_AUTODETECT , xRes , yRes , 0 , 0 ) < 0 )
{
allegro_message( "Unable to set specified video mode : %s\n" , allegro_error );
}
}
else
{
if( set_gfx_mode( GFX_AUTODETECT_WINDOWED , xRes , yRes , 0 , 0 ) < 0 )
{
allegro_message( "Unable to set specified video mode : %s\n" , allegro_error );
return c_false;
}
}
return c_true;
}
/*
================================================================
GFX_SYS_TimerFunction
Timer function required by Allegro. Controls/normalizes overall
game speed.
================================================================
*/
void GFX_SYS_TimerFunction( void )
{
globalTickCount++;
}
END_OF_FUNCTION( GFX_SYS_TimerFunction );