-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathConfig.cpp
58 lines (50 loc) · 1.46 KB
/
Config.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
/*
* This file is part of NumptyPhysics
* Copyright (C) 2008 Tim Edmonds
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
*/
#include "Config.h"
Rect FULLSCREEN_RECT( 0, 0, WORLD_WIDTH-1, WORLD_HEIGHT-1 );
const Rect BOUNDS_RECT( -WORLD_WIDTH/4, -WORLD_HEIGHT,
WORLD_WIDTH*5/4, WORLD_HEIGHT );
int SCREEN_WIDTH = WORLD_WIDTH;
int SCREEN_HEIGHT = WORLD_HEIGHT;
const int brushColours[] = {
0xb80000, //red
0xeec900, //yellow
0x000077, //blue
0x108710, //green
0x101010, //black
0x8b4513, //brown
0x87cefa, //lightblue
0xee6aa7, //pink
0xb23aee, //purple
0x00fa9a, //lightgreen
0xff7f00, //orange
0x6c7b8b, //grey
};
const int NUM_BRUSHES = (sizeof(brushColours)/sizeof(brushColours[0]));
std::string Config::findFile( const std::string& name )
{
std::string p( "data/" );
FILE *fd = fopen( (p+name).c_str(), "rb" );
if ( !fd ) {
p = std::string( DEFAULT_RESOURCE_PATH "/" );
fd = fopen( (p+name).c_str(), "rb" );
}
if ( fd ) {
fclose(fd);
return p+name;
}
return name;
}