mirror of
https://github.com/projectM-visualizer/projectm.git
synced 2026-03-01 04:55:03 +00:00
read FPS from config file for SDL version
This commit is contained in:
@ -195,8 +195,8 @@
|
||||
166853F02105E2850042793A /* SDL2.framework */,
|
||||
1612CA10207A8D2400862A3A /* shaders */,
|
||||
1612C98C207A807000862A3A /* libprojectM.xcodeproj */,
|
||||
169501FE1F7009E9008FAF86 /* pmSDL.cpp */,
|
||||
169501FF1F7009E9008FAF86 /* pmSDL.hpp */,
|
||||
169501FE1F7009E9008FAF86 /* pmSDL.cpp */,
|
||||
C345214E1BF022A5001707D2 /* projectM_SDL_main.cpp */,
|
||||
C307DFD31D565B57002F6B9E /* presets */,
|
||||
16A42128207802AF006F30CE /* Dependencies */,
|
||||
|
||||
@ -181,8 +181,6 @@ void projectMSDL::addFakePCM() {
|
||||
void projectMSDL::resize(unsigned int width_, unsigned int height_) {
|
||||
width = width_;
|
||||
height = height_;
|
||||
settings.windowWidth = width;
|
||||
settings.windowHeight = height;
|
||||
projectM_resetGL(width, height);
|
||||
}
|
||||
|
||||
|
||||
@ -27,8 +27,6 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
const float FPS = 60;
|
||||
|
||||
class projectMSDL : public projectM {
|
||||
public:
|
||||
bool done;
|
||||
@ -51,7 +49,6 @@ private:
|
||||
SDL_Window *win;
|
||||
SDL_GLContext *glCtx;
|
||||
bool isFullScreen;
|
||||
projectM::Settings settings;
|
||||
SDL_AudioDeviceID audioInputDevice;
|
||||
unsigned int width, height;
|
||||
bool renderToTexture;
|
||||
|
||||
@ -118,15 +118,16 @@ int main(int argc, char *argv[]) {
|
||||
if (! configFilePath.empty()) {
|
||||
// found config file, use it
|
||||
app = new projectMSDL(configFilePath, 0);
|
||||
SDL_Log("Using config from %s", configFilePath.c_str());
|
||||
} else {
|
||||
SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "Config file not found, using development settings\n");
|
||||
SDL_Log("Config file not found, using development settings");
|
||||
float heightWidthRatio = (float)height / (float)width;
|
||||
projectM::Settings settings;
|
||||
settings.windowWidth = width;
|
||||
settings.windowHeight = height;
|
||||
settings.meshX = 300;
|
||||
settings.meshY = settings.meshX * heightWidthRatio;
|
||||
settings.fps = FPS;
|
||||
settings.fps = 60;
|
||||
settings.smoothPresetDuration = 3; // seconds
|
||||
settings.presetDuration = 7; // seconds
|
||||
settings.beatSensitivity = 0.8;
|
||||
@ -165,7 +166,11 @@ int main(int argc, char *argv[]) {
|
||||
#endif
|
||||
|
||||
// standard main loop
|
||||
const Uint32 frame_delay = 1000/FPS;
|
||||
int fps = app->settings().fps;
|
||||
printf("fps: %d\n", fps);
|
||||
if (fps <= 0)
|
||||
fps = 60;
|
||||
const Uint32 frame_delay = 1000/fps;
|
||||
Uint32 last_time = SDL_GetTicks();
|
||||
while (! app->done) {
|
||||
app->renderFrame();
|
||||
|
||||
Reference in New Issue
Block a user