1
2
3
4
5
6
7
8
9
10
|
// main.cpp: initialisation & main loop
#include "cube.h"
OF_APPLICATION_DELEGATE(Cube)
VARF(gamespeed, 10, 100, 1000, if (multiplayer()) gamespeed = 100);
VARP(minmillis, 0, 5, 1000);
@implementation Cube
|
>
>
|
1
2
3
4
5
6
7
8
9
10
11
12
|
// main.cpp: initialisation & main loop
#include "cube.h"
#import "DynamicEntity.h"
OF_APPLICATION_DELEGATE(Cube)
VARF(gamespeed, 10, 100, 1000, if (multiplayer()) gamespeed = 100);
VARP(minmillis, 0, 5, 1000);
@implementation Cube
|
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
[OFFileManager.defaultManager
createDirectoryAtIRI:[_userDataIRI
IRIByAppendingPathComponent:@"savegames"]
createParents:true];
if (SDL_Init(SDL_INIT_TIMER | SDL_INIT_VIDEO | par) < 0)
fatal(@"Unable to initialize SDL");
log(@"net");
if (enet_initialize() < 0)
fatal(@"Unable to initialise network module");
initclient();
// never returns if dedicated
|
>
>
|
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
|
[OFFileManager.defaultManager
createDirectoryAtIRI:[_userDataIRI
IRIByAppendingPathComponent:@"savegames"]
createParents:true];
if (SDL_Init(SDL_INIT_TIMER | SDL_INIT_VIDEO | par) < 0)
fatal(@"Unable to initialize SDL");
initPlayers();
log(@"net");
if (enet_initialize() < 0)
fatal(@"Unable to initialise network module");
initclient();
// never returns if dedicated
|
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
|
if (!demoplayback)
serverslice((int)time(NULL), 0);
static float fps = 30.0f;
fps = (1000.0f / curtime + fps * 50) / 51;
computeraytable(player1->o.x, player1->o.y);
readdepth(_width, _height);
SDL_GL_SwapWindow(_window);
extern void updatevol();
updatevol();
// cheap hack to get rid of initial sparklies, even when triple
// buffering etc.
if (_framesInMap++ < 5) {
player1->yaw += 5;
gl_drawframe(_width, _height, fps);
player1->yaw -= 5;
}
gl_drawframe(_width, _height, fps);
SDL_Event event;
int lasttype = 0, lastbut = 0;
while (SDL_PollEvent(&event)) {
|
|
|
|
|
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
|
if (!demoplayback)
serverslice((int)time(NULL), 0);
static float fps = 30.0f;
fps = (1000.0f / curtime + fps * 50) / 51;
computeraytable(player1.o.x, player1.o.y);
readdepth(_width, _height);
SDL_GL_SwapWindow(_window);
extern void updatevol();
updatevol();
// cheap hack to get rid of initial sparklies, even when triple
// buffering etc.
if (_framesInMap++ < 5) {
player1.yaw += 5;
gl_drawframe(_width, _height, fps);
player1.yaw -= 5;
}
gl_drawframe(_width, _height, fps);
SDL_Event event;
int lasttype = 0, lastbut = 0;
while (SDL_PollEvent(&event)) {
|