Add pointlog2svg utility for the thesis
[numtypysics.git] / Config.cpp
blob630ba94026e404fe2e735c35789f5924e4009f3e
1 /*
2 * This file is part of NumptyPhysics
3 * Copyright (C) 2008 Tim Edmonds
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation; either version 3 of the
8 * License, or (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
17 #include "Config.h"
18 #include "Font.h"
21 Rect FULLSCREEN_RECT( 0, 0, WORLD_WIDTH-1, WORLD_HEIGHT-1 );
23 const Rect BOUNDS_RECT( -WORLD_WIDTH/4, -WORLD_HEIGHT,
24 WORLD_WIDTH*5/4, WORLD_HEIGHT );
25 int SCREEN_WIDTH = WORLD_WIDTH;
26 int SCREEN_HEIGHT = WORLD_HEIGHT;
28 const int brushColours[] = {
29 0xb80000, //red
30 0xeec900, //yellow
31 0x000077, //blue
32 0x108710, //green
33 0x101010, //black
34 0x8b4513, //brown
35 0x87cefa, //lightblue
36 0xee6aa7, //pink
37 0xb23aee, //purple
38 0x00fa9a, //lightgreen
39 0xff7f00, //orange
40 0x6c7b8b, //grey
43 const int NUM_BRUSHES = (sizeof(brushColours)/sizeof(brushColours[0]));
45 std::string Config::findFile( const std::string& name )
47 std::string p( "data/" );
48 FILE *fd = fopen( (p+name).c_str(), "rb" );
49 if ( !fd ) {
50 p = std::string( DEFAULT_RESOURCE_PATH "/" );
51 fd = fopen( (p+name).c_str(), "rb" );
53 if ( fd ) {
54 fclose(fd);
55 return p+name;
57 return name;
60 Font* Config::font()
62 static Font f("font.npf");
63 return &f;