Skip to content

Commit 5ea4dc4

Browse files
committed
read FPS from config file for SDL version
1 parent 92f3fb4 commit 5ea4dc4

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

src/projectM-sdl/SDLprojectM.xcodeproj/project.pbxproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,8 @@
195195
166853F02105E2850042793A /* SDL2.framework */,
196196
1612CA10207A8D2400862A3A /* shaders */,
197197
1612C98C207A807000862A3A /* libprojectM.xcodeproj */,
198-
169501FE1F7009E9008FAF86 /* pmSDL.cpp */,
199198
169501FF1F7009E9008FAF86 /* pmSDL.hpp */,
199+
169501FE1F7009E9008FAF86 /* pmSDL.cpp */,
200200
C345214E1BF022A5001707D2 /* projectM_SDL_main.cpp */,
201201
C307DFD31D565B57002F6B9E /* presets */,
202202
16A42128207802AF006F30CE /* Dependencies */,

src/projectM-sdl/pmSDL.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,6 @@ void projectMSDL::addFakePCM() {
181181
void projectMSDL::resize(unsigned int width_, unsigned int height_) {
182182
width = width_;
183183
height = height_;
184-
settings.windowWidth = width;
185-
settings.windowHeight = height;
186184
projectM_resetGL(width, height);
187185
}
188186

src/projectM-sdl/pmSDL.hpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@
2727
#endif
2828
#endif
2929

30-
const float FPS = 60;
31-
3230
class projectMSDL : public projectM {
3331
public:
3432
bool done;
@@ -51,7 +49,6 @@ class projectMSDL : public projectM {
5149
SDL_Window *win;
5250
SDL_GLContext *glCtx;
5351
bool isFullScreen;
54-
projectM::Settings settings;
5552
SDL_AudioDeviceID audioInputDevice;
5653
unsigned int width, height;
5754
bool renderToTexture;

src/projectM-sdl/projectM_SDL_main.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,15 +118,16 @@ int main(int argc, char *argv[]) {
118118
if (! configFilePath.empty()) {
119119
// found config file, use it
120120
app = new projectMSDL(configFilePath, 0);
121+
SDL_Log("Using config from %s", configFilePath.c_str());
121122
} else {
122-
SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "Config file not found, using development settings\n");
123+
SDL_Log("Config file not found, using development settings");
123124
float heightWidthRatio = (float)height / (float)width;
124125
projectM::Settings settings;
125126
settings.windowWidth = width;
126127
settings.windowHeight = height;
127128
settings.meshX = 300;
128129
settings.meshY = settings.meshX * heightWidthRatio;
129-
settings.fps = FPS;
130+
settings.fps = 60;
130131
settings.smoothPresetDuration = 3; // seconds
131132
settings.presetDuration = 7; // seconds
132133
settings.beatSensitivity = 0.8;
@@ -165,7 +166,11 @@ int main(int argc, char *argv[]) {
165166
#endif
166167

167168
// standard main loop
168-
const Uint32 frame_delay = 1000/FPS;
169+
int fps = app->settings().fps;
170+
printf("fps: %d\n", fps);
171+
if (fps <= 0)
172+
fps = 60;
173+
const Uint32 frame_delay = 1000/fps;
169174
Uint32 last_time = SDL_GetTicks();
170175
while (! app->done) {
171176
app->renderFrame();

0 commit comments

Comments
 (0)