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. 14 * 15 */ 16 17 #ifndef CONFIG_H 18 #define CONFIG_H 19 20 #include <sstream> 21 #include "Common.h" 22 #include "Os.h" 23 24 #define WORLD_WIDTH 800 25 #define WORLD_HEIGHT 480 26 #define PIXELS_PER_METREf 10.0f 27 #define CLOSED_SHAPE_THREHOLDf 0.4f 28 #define SIMPLIFY_THRESHOLDf 1.0f //PIXELs //(1.0/PIXELS_PER_METREf) 29 #define MULTI_VERTEX_LIMIT 64 30 31 #ifdef USE_HILDON //maemo 32 # define ITERATION_RATE 60 //fps 33 # define RENDER_RATE 60 //fps 34 # define SOLVER_ITERATIONS 10 35 # define JOINT_TOLERANCE 4.0f //PIXELs 36 # define SELECT_TOLERANCE 8.0f //PIXELS_PER_METREf) 37 # define CLICK_TOLERANCE 16 //PIXELs 38 #else 39 # define ITERATION_RATE 60 //fps 40 # define RENDER_RATE 60 //fps 41 # define SOLVER_ITERATIONS 10 42 # define JOINT_TOLERANCE 4.0f //PIXELs 43 # define SELECT_TOLERANCE 5.0f //PIXELS_PER_METREf) 44 # define CLICK_TOLERANCE 4 //PIXELs 45 #endif 46 47 #define ITERATION_TIMESTEPf (1.0f / (float)ITERATION_RATE) 48 #define RENDER_INTERVAL (1000/RENDER_RATE) 49 50 #define HIDE_STEPS (RENDER_RATE*4) 51 52 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 70 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" 74 75 #define ICON_SCALE_FACTOR 4 76 77 78 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 88 89 class Config 90 { 91 public: userDataDir()92 static const std::string& userDataDir() 93 { 94 static const std::string d = std::string(getenv("HOME")) + Os::pathSep + USER_BASE_PATH; 95 return d; 96 } planetRoot()97 static const std::string& planetRoot() 98 { 99 static const std::string d("http://xxx/planet.cgi"); 100 return d; 101 } 102 }; 103 104 #endif //CONFIG_H 105