hardcoding settings for emscripten instead of using config file

This commit is contained in:
Mischa S
2014-06-21 22:57:45 -07:00
parent 222649afbe
commit 48587f131c
7 changed files with 35 additions and 29 deletions

View File

@ -1,3 +1,5 @@
Press "r" to change to a random preset.
Press "h" to bring up a help menu.
The projectM-iTunes directory contains an XCode 5 project that emits an installer bundle. Use that to install it.
Binaries are available at: https://github.com/revmischa/projectm/releases

Binary file not shown.

View File

@ -134,7 +134,7 @@ public:
bool aspectCorrection;
float easterEgg;
bool shuffleEnabled;
bool softCutRatingsEnabled;
bool softCutRatingsEnabled;
};
projectM(std::string config_file, int flags = FLAG_NONE);

View File

@ -1,3 +1,5 @@
cmake_minimum_required(VERSION 2.8.0)
INCLUDE(../cmake/CPack-projectM.cmake)
PROJECT(projectEM)
@ -23,5 +25,5 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/../cmake)
#INCLUDE_DIRECTORIES(${SDL2_INCLUDE_DIRS})
#TARGET_LINK_LIBRARIES(projectEM ${SDL2_LIBRARIES})
SET_TARGET_PROPERTIES(projectEM PROPERTIES LINK_FLAGS "-o build/projectEM.html --emrun")
SET_TARGET_PROPERTIES(projectEM PROPERTIES LINK_FLAGS "-o build/projectEM.html -g --emrun")
#SET_TARGET_PROPERTIES(projectEM PROPERTIES LINK_FLAGS "--emrun")

View File

@ -1,22 +0,0 @@
# config.inp
# Configuration File for projectM
Texture Size = 2048 # Size of internal rendering texture
Mesh X = 2 # Width of PerPixel Equation mesh
Mesh Y = 2 # Height of PerPixel Equation mesh
FPS = 60 # Frames Per Second
Fullscreen = false
Window Width = 512 # startup window width
Window Height = 512 # startup window height
Smooth Transition Duration = 5 # in seconds
Preset Duration = 10 # in seconds
Easter Egg Parameter = 1
Hard Cut Sensitivity = 10 # Lower to make hard cuts more frequent
Aspect Correction = true # Custom Shape Aspect Correction
Preset Path = presets
Title Font = fonts/Vera.ttf
Menu Font = fonts/VeraMono.ttf

View File

@ -27,7 +27,6 @@
/* Begin PBXFileReference section */
C3F90678195670BC00C8DF0F /* emprojectM */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = emprojectM; sourceTree = BUILT_PRODUCTS_DIR; };
C3F90684195670EF00C8DF0F /* emscripten_sdltoprojectM.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = emscripten_sdltoprojectM.h; sourceTree = SOURCE_ROOT; };
C3F90685195670EF00C8DF0F /* projectM_SDL_emscripten.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = projectM_SDL_emscripten.cpp; sourceTree = SOURCE_ROOT; };
C3F90689195676C500C8DF0F /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = System/Library/Frameworks/OpenGL.framework; sourceTree = SDKROOT; };
C3F9068B195676CC00C8DF0F /* GLUT.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GLUT.framework; path = System/Library/Frameworks/GLUT.framework; sourceTree = SDKROOT; };
@ -70,7 +69,6 @@
C3F9067A195670BC00C8DF0F /* emprojectM */ = {
isa = PBXGroup;
children = (
C3F90684195670EF00C8DF0F /* emscripten_sdltoprojectM.h */,
C3F90685195670EF00C8DF0F /* projectM_SDL_emscripten.cpp */,
);
path = emprojectM;

View File

@ -16,7 +16,7 @@
#include <SDL.h>
#endif
const char *PROJECTEM_CONFIG_PATH = "build/config.inp";
const float FPS = 60;
static projectM *globalPM = NULL;
static SDL_Surface *screen;
@ -25,6 +25,9 @@ static SDL_Renderer *rend;
bool done = false;
// settings, yo
projectM::Settings settings;
void renderFrame() {
int i;
short pcm_data[2][512];
@ -118,6 +121,10 @@ int main( int argc, char *argv[] ) {
#elif SDL_MAJOR_VERSION==1
screen = SDL_SetVideoMode(width, height, 32, SDL_OPENGL | SDL_DOUBLEBUF);
printf("SDL init version 1\n");
if (! screen) {
fprintf(stderr, "Failed to create renderer with SDL_SetVideoMode(): %s\n", SDL_GetError());
return PROJECTM_ERROR;
}
#endif
#ifdef PANTS
@ -129,17 +136,36 @@ int main( int argc, char *argv[] ) {
}
#endif
settings.meshX = 2;
settings.meshY = 2;
settings.fps = FPS;
settings.textureSize = 2048; // idk?
settings.windowWidth = width;
settings.windowHeight = height;
settings.presetURL = "./presets";
settings.smoothPresetDuration = 5; // seconds
settings.presetDuration = 15; // seconds
settings.beatSensitivity = 0.8;
settings.aspectCorrection = 1;
settings.easterEgg = 0; // ???
settings.shuffleEnabled = 1;
settings.softCutRatingsEnabled = 1; // ???
// init projectM
globalPM = new projectM(PROJECTEM_CONFIG_PATH);
printf("initting\n");
globalPM = new projectM(settings);
printf("init projectM\n");
globalPM->selectRandom(true);
printf("select random\n");
globalPM->projectM_resetGL(width, height);
printf("resetGL\n");
// mainloop. non-emscripten version here for comparison/testing
#ifdef EMSCRIPTEN
emscripten_set_main_loop(renderFrame, 30, 0);
#else
// standard main loop
const Uint32 frame_delay = 1000/60;
const Uint32 frame_delay = 1000/FPS;
Uint32 last_time = SDL_GetTicks();
while (! done) {
renderFrame();