File: Config.h

package info (click to toggle)
numptyphysics 0.2+svn157-0.3
  • links: PTS
  • area: main
  • in suites: buster, jessie, jessie-kfreebsd, sid, stretch
  • size: 2,596 kB
  • ctags: 2,896
  • sloc: cpp: 18,280; sh: 810; makefile: 205
file content (140 lines) | stat: -rw-r--r-- 3,629 bytes parent folder | download | duplicates (3)
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
/*
 * 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.
 *
 */

#ifndef CONFIG_H
#define CONFIG_H

#include <sstream>
#include "Common.h"
#include "Os.h"

#define WORLD_WIDTH  800
#define WORLD_HEIGHT 480
#define PIXELS_PER_METREf 10.0f
#define GRAVITY_ACCELf 9.8f // m/s/s
#define GRAVITY_FUDGEf 5.0f
#define CLOSED_SHAPE_THREHOLDf 0.4f
#define SIMPLIFY_THRESHOLDf 1.0f //PIXELs //(1.0/PIXELS_PER_METREf)
#define MULTI_VERTEX_LIMIT 64

#define ITERATION_RATE    60 //fps
#define SOLVER_ITERATIONS 8

#ifdef USE_HILDON //maemo
#  define MIN_RENDER_RATE   10 //fps
#  define MAX_RENDER_RATE   60 //fps
#  define AVG_RENDER_RATE   20 //fps
#  define JOINT_TOLERANCE   4.0f //PIXELs
#  define SELECT_TOLERANCE  8.0f //PIXELS_PER_METREf)
#  define CLICK_TOLERANCE   16 //PIXELs 
#  define MAEMO_VERSION 5   //4
#else
#  define MIN_RENDER_RATE   10 //fps
#  define MAX_RENDER_RATE   ITERATION_RATE //fps
#  define AVG_RENDER_RATE   ((MIN_RENDER_RATE+MAX_RENDER_RATE)/2)
#  define JOINT_TOLERANCE   4.0f //PIXELs
#  define SELECT_TOLERANCE  5.0f //PIXELS_PER_METREf)
#  define CLICK_TOLERANCE   4 //PIXELs 
#endif

#define ITERATION_TIMESTEPf  (1.0f / (float)ITERATION_RATE)

#define HIDE_STEPS (AVG_RENDER_RATE*4)


#ifndef INSTALL_BASE_PATH
# if MAEMO_VERSION >= 5
#  define INSTALL_BASE_PATH "/opt/numptyphysics"
# else
#  define INSTALL_BASE_PATH "/usr/share/numptyphysics"
# endif
#endif
#define DEFAULT_LEVEL_PATH INSTALL_BASE_PATH
#define DEFAULT_RESOURCE_PATH DEFAULT_LEVEL_PATH
#ifndef USER_BASE_PATH
# ifdef USE_HILDON //maemo
#  if MAEMO_VERSION >= 5
#   define USER_BASE_PATH "MyDocs/Games/NumptyPhysics"
#  else
#   define USER_BASE_PATH "MyDocs/.games/NumptyPhysics"
#  endif
# else
#  ifdef WIN32
#   define USER_BASE_PATH ".\\data"
#  else
#   define USER_BASE_PATH ".numptyphysics"
#  endif
# endif
#endif
#define USER_LEVEL_PATH USER_BASE_PATH

#define DEMO_TEMP_FILE "/tmp/demo.nph"
#define HTTP_TEMP_FILE "/tmp/http.nph"
#define SEND_TEMP_FILE "/tmp/mailto:numptyphysics@gmail.com.nph"

#define ICON_SCALE_FACTOR 6

#define VIDEO_FPS 20
#define VIDEO_MAX_LEN 20  //seconds



extern Rect FULLSCREEN_RECT;
extern const Rect BOUNDS_RECT;
extern int SCREEN_WIDTH;
extern int SCREEN_HEIGHT;
extern const int brushColours[];
extern const int NUM_BRUSHES;
#define RED_BRUSH       0
#define YELLOW_BRUSH    1
#define DEFAULT_BRUSH   2


#define DEFAULT_BG 0x303030
#define DEFAULT_FG 0xf8fcf8
#define BUTTON_BG 0x383c38
#define SELECTED_BG 0x704040
#define TL_BORDER 0x909490
#define BR_BORDER 0x182018
#define BUTTON_WIDTH 140
#define BUTTON_HEIGHT 60
#define BUTTON_SPACING 8
#define TAB_WIDTH 160
#define TAB_HEIGHT 40
#define DIALOG_TITLE_HEIGHT 48
#define MENU_COLUMNS 1


class Font;

class Config
{
 public:
  static const std::string& userDataDir()
  {
    static const std::string d = std::string(getenv("HOME")) + Os::pathSep + USER_BASE_PATH;
    return d;
  }
  static const std::string& planetRoot()
  {
    static const std::string d("http://10.10.10.10:8080");
    return d;
  }
  static std::string findFile( const std::string& name );
  static Font* font();
};

#endif //CONFIG_H