Fix (lots of) memory leaks in Game.cpp
[numtypysics.git] / Config.h
blob8f50e88509385ef294961211761f59fea95858de
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 #ifndef CONFIG_H
18 #define CONFIG_H
20 #include <sstream>
21 #include "Common.h"
22 #include "Os.h"
24 #define WORLD_WIDTH 800
25 #define WORLD_HEIGHT 480
26 #define PIXELS_PER_METREf 10.0f
27 #define GRAVITY_FUDGEf 5.0f
28 #define CLOSED_SHAPE_THREHOLDf 0.4f
29 #define SIMPLIFY_THRESHOLDf 1.0f //PIXELs //(1.0/PIXELS_PER_METREf)
30 #define MULTI_VERTEX_LIMIT 64
32 #define ITERATION_RATE 60 //fps
33 #define SOLVER_ITERATIONS 10
34 #define MIN_RENDER_RATE 10 //fps
35 #define MAX_RENDER_RATE ITERATION_RATE //fps
36 #define AVG_RENDER_RATE ((MIN_RENDER_RATE+MAX_RENDER_RATE)/2)
38 #ifdef USE_HILDON //maemo
39 # define JOINT_TOLERANCE 4.0f //PIXELs
40 # define SELECT_TOLERANCE 8.0f //PIXELS_PER_METREf)
41 # define CLICK_TOLERANCE 16 //PIXELs
42 #else
43 # define JOINT_TOLERANCE 4.0f //PIXELs
44 # define SELECT_TOLERANCE 29.0f //PIXELS_PER_METREf)
45 # define CLICK_TOLERANCE 4 //PIXELs
46 #endif
48 #define ITERATION_TIMESTEPf (1.0f / (float)ITERATION_RATE)
50 #define HIDE_STEPS (AVG_RENDER_RATE*4)
53 #ifndef INSTALL_BASE_PATH
54 # define INSTALL_BASE_PATH "/usr/share/numptyphysics"
55 #endif
56 #define DEFAULT_LEVEL_PATH INSTALL_BASE_PATH
57 #define DEFAULT_RESOURCE_PATH DEFAULT_LEVEL_PATH
58 #ifndef USER_BASE_PATH
59 # ifdef USE_HILDON //maemo
60 # define USER_BASE_PATH "MyDocs/.games/NumptyPhysics"
61 # else
62 # ifdef WIN32
63 # define USER_BASE_PATH ".\\data"
64 # else
65 # define USER_BASE_PATH ".numptyphysics"
66 # endif
67 # endif
68 #endif
69 #define USER_LEVEL_PATH USER_BASE_PATH
71 #define DEMO_TEMP_FILE "/tmp/demo.nph"
72 #define HTTP_TEMP_FILE "/tmp/http.nph"
73 #define SEND_TEMP_FILE "/tmp/mailto:numptyphysics@gmail.com.nph"
75 #define ICON_SCALE_FACTOR 4
79 extern Rect FULLSCREEN_RECT;
80 extern const Rect BOUNDS_RECT;
81 extern int SCREEN_WIDTH;
82 extern int SCREEN_HEIGHT;
83 extern const int brushColours[];
84 extern const int NUM_BRUSHES;
85 #define RED_BRUSH 0
86 #define YELLOW_BRUSH 1
87 #define DEFAULT_BRUSH 2
89 class Font;
91 class Config
93 public:
94 static const std::string& userDataDir()
96 static const std::string d = std::string(getenv("HOME")) + Os::pathSep + USER_BASE_PATH;
97 return d;
99 static const std::string& planetRoot()
101 static const std::string d("http://xyz/planet.cgi");
102 return d;
104 static std::string findFile( const std::string& name );
105 static Font* font();
108 #endif //CONFIG_H