diff -ruN a/tilePlacementGames/game1/gameSource/game.cpp b/tilePlacementGames/game1/gameSource/game.cpp --- a/tilePlacementGames/game1/gameSource/game.cpp 2026-11-09 16:33:51.023188726 -0300 +++ b/tilePlacementGames/game1/gameSource/game.cpp 2026-11-09 16:33:51.575056148 -0300 @@ -14,6 +14,10 @@ #include "ScoreBundle.h" +// (these came with the network panels, which are gone) +#include "minorGems/util/stringUtils.h" +#include "minorGems/system/FinishedSignalThread.h" + #include "secureSalt.h" @@ -703,9 +707,6 @@ scoreWasSent = 1; } - if( gameOver && !scoreWasSent ) { - doneButton->setVisible( true ); - } state = SettingsManager::getStringSetting( "gridSaved" ); @@ -1431,8 +1432,6 @@ if( gameToPlayback == NULL ) { // don't save final state yet // need to update nextPiece first. - - doneButton->setVisible( true ); } else { // done with playback @@ -1765,17 +1764,6 @@ else if( allButtons[i] == menuButton ) { menuPanel->setVisible( true ); } - else if( allButtons[i] == doneButton ) { - char *moveString = moveHistory.getElementString(); - - ScoreBundle *b = new ScoreBundle( playerName, score, gameSeed, - moveString ); - delete [] moveString; - - //printf( "posting score\n" ); - - ( (MenuPanel*)menuPanel )->postScore( b ); - } else if( allButtons[i] == playStopButton ) { if( autoPlay ) { playStopButton->setString( "run" ); diff -ruN a/tilePlacementGames/game1/gameSource/gameSDL.cpp b/tilePlacementGames/game1/gameSource/gameSDL.cpp --- a/tilePlacementGames/game1/gameSource/gameSDL.cpp 2026-11-09 16:33:50.932779915 -0300 +++ b/tilePlacementGames/game1/gameSource/gameSDL.cpp 2026-11-09 16:33:51.492419652 -0300 @@ -14,6 +14,7 @@ #include +#include @@ -90,110 +91,20 @@ -int mainFunction( int inNumArgs, char **inArgs ) { - - if( SDL_Init( SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE ) < 0 ) { - printf( "Couldn't initialize SDL: %s\n", SDL_GetError() ); - return 0; - } - - SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 ); - - int flags = SDL_OPENGL; - - - //flags = flags | SDL_FULLSCREEN; - - // current color depth - SDL_Surface *screen = SDL_SetVideoMode( w, h, 0, flags); +// state of the frame loop, which the browser calls (the original looped in mainFunction) +static Uint32 lastFrameDoneTime; +static Uint32 frameBatchStartTime; +static int frameBatchSize = 100; +static int frameBatchCount = 0; - if ( screen == NULL ) { - printf( "Couldn't set %dx%d GL video mode: %s\n", - w, - h, - SDL_GetError() ); - return 0; +// one iteration of the main loop +void oneFrame() { + if( SDL_GetTicks() < lastFrameDoneTime ) { + // too early: the original waited here (SDL_Delay) + return; } - - - SDL_WM_SetCaption( "Primrose", NULL ); - - - // turn off repeat - SDL_EnableKeyRepeat( 0, 0 ); - - - - - #ifdef __mac__ - // make sure working directory is the same as the directory - // that the app resides in - // this is especially important on the mac platform, which - // doesn't set a proper working directory for double-clicked - // app bundles - - // arg 0 is the path to the app executable - char *appDirectoryPath = stringDuplicate( inArgs[0] ); - - char *appNamePointer = strstr( appDirectoryPath, - "tileGame1.app" ); - if( appNamePointer != NULL ) { - // terminate full app path to get parent directory - appNamePointer[0] = '\0'; - - chdir( appDirectoryPath ); - } - - delete [] appDirectoryPath; - #endif - - - - - - - - SDL_AudioSpec audioFormat; - - /* Set 16-bit stereo audio at 22Khz */ - audioFormat.freq = gameSoundSampleRate; - audioFormat.format = AUDIO_S16; - audioFormat.channels = 2; - audioFormat.samples = 512; /* A good value for games */ - //audioFormat.samples = 1024; - //audioFormat.samples = 2048; - audioFormat.callback = audioCallback; - audioFormat.userdata = NULL; - - /* Open the audio device and start playing sound! */ - if( SDL_OpenAudio( &audioFormat, NULL ) < 0 ) { - printf( "Unable to open audio: %s\n", SDL_GetError() ); - } - - // set pause to 0 to start audio - //SDL_PauseAudio(0); - - - initFrameDrawer( w, h ); - - // to free frame drawer, stop audio, etc - atexit( cleanUpAtExit ); - - - Uint32 lastFrameDoneTime = SDL_GetTicks(); - - Uint32 frameBatchStartTime = SDL_GetTicks(); - - int frameBatchSize = 100; - int frameBatchCount = 0; - - - - - // main loop - while( true ) { callbackDisplay(); @@ -284,12 +195,9 @@ int extraMS = frameMS - ( thisFrameDoneTime - lastFrameDoneTime ); - if( extraMS > 0 ) { - SDL_Delay( extraMS ); - } + // (the original slept for extraMS here; we wait for the next browser frame, see the top) - // set to ideal frame done time (even though SDL_Delay might - // be slightly longer or shorter + // set to ideal frame done time // this way, we don't fall gradually out of time lastFrameDoneTime = thisFrameDoneTime + extraMS; @@ -313,9 +221,106 @@ frameBatchStartTime = doneTime; frameBatchCount = 0; } + } + + + +int mainFunction( int inNumArgs, char **inArgs ) { + + if( SDL_Init( SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE ) < 0 ) { + printf( "Couldn't initialize SDL: %s\n", SDL_GetError() ); + return 0; + } + + SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 ); + + int flags = SDL_OPENGL; + + + //flags = flags | SDL_FULLSCREEN; + + // current color depth + SDL_Surface *screen = SDL_SetVideoMode( w, h, 0, flags); + + + if ( screen == NULL ) { + printf( "Couldn't set %dx%d GL video mode: %s\n", + w, + h, + SDL_GetError() ); + return 0; + } + + + SDL_WM_SetCaption( "Primrose", NULL ); + + + // turn off repeat + SDL_EnableKeyRepeat( 0, 0 ); + + + + + #ifdef __mac__ + // make sure working directory is the same as the directory + // that the app resides in + // this is especially important on the mac platform, which + // doesn't set a proper working directory for double-clicked + // app bundles + + // arg 0 is the path to the app executable + char *appDirectoryPath = stringDuplicate( inArgs[0] ); + + char *appNamePointer = strstr( appDirectoryPath, + "tileGame1.app" ); + + if( appNamePointer != NULL ) { + // terminate full app path to get parent directory + appNamePointer[0] = '\0'; + + chdir( appDirectoryPath ); + } + delete [] appDirectoryPath; + #endif + + + + + + + + SDL_AudioSpec audioFormat; + + /* Set 16-bit stereo audio at 22Khz */ + audioFormat.freq = gameSoundSampleRate; + audioFormat.format = AUDIO_S16; + audioFormat.channels = 2; + audioFormat.samples = 512; /* A good value for games */ + //audioFormat.samples = 1024; + //audioFormat.samples = 2048; + audioFormat.callback = audioCallback; + audioFormat.userdata = NULL; + + /* Open the audio device and start playing sound! */ + if( SDL_OpenAudio( &audioFormat, NULL ) < 0 ) { + printf( "Unable to open audio: %s\n", SDL_GetError() ); } + // set pause to 0 to start audio + //SDL_PauseAudio(0); + + + initFrameDrawer( w, h ); + + // to free frame drawer, stop audio, etc + atexit( cleanUpAtExit ); + + + lastFrameDoneTime = SDL_GetTicks(); + frameBatchStartTime = lastFrameDoneTime; + + emscripten_set_main_loop( oneFrame, 0, 1 ); return 0; } @@ -377,9 +382,7 @@ void callbackKeyboard( unsigned char inKey, int inX, int inY ) { // q or escape - if( inKey == 'q' || inKey == 'Q' || inKey == 27 ) { - exit( 0 ); - } + // (quitting is not possible in the browser) if( enableSlowdownKeys ) { diff -ruN a/tilePlacementGames/game1/gameSource/MenuPanel.cpp b/tilePlacementGames/game1/gameSource/MenuPanel.cpp --- a/tilePlacementGames/game1/gameSource/MenuPanel.cpp 2026-11-09 16:33:50.756806885 -0300 +++ b/tilePlacementGames/game1/gameSource/MenuPanel.cpp 2026-11-09 16:33:51.473614126 -0300 @@ -13,20 +13,13 @@ : Panel( inW, inH ), mNewButton( inW - 21 - 19, 100, "+" ), mTutorialButton( inW - 21 - 19, 165, "+" ), - mHighScoreButton( inW - 21 - 19, 230, "+" ), - mEditNameButton( inW - 21 - 19, 295, "+" ), - mColorblindButton( inW - 21 - 19, 360, "off" ), - mSoundButton( inW - 21 - 19, 425, " on " ), - mHighScoreLoadingPanel( inW, inH ), - mEditNamePanel( inW, inH ), + mColorblindButton( inW - 21 - 19, 230, "off" ), + mSoundButton( inW - 21 - 19, 295, " on " ), mTutorialPanel( inW, inH ) { mNewButton.setVisible( false ); mTutorialButton.setVisible( false ); - mHighScoreButton.setVisible( false ); - mEditNameButton.setVisible( false ); - mEditNameButton.setVisible( false ); mColorblindButton.setVisible( false ); mSoundButton.setVisible( false ); @@ -41,27 +34,10 @@ addButton( &mNewButton ); addButton( &mTutorialButton ); - addButton( &mHighScoreButton ); - addButton( &mEditNameButton ); addButton( &mColorblindButton ); addButton( &mSoundButton ); - mHighScoreLoadingPanel.setVisible( false ); - mEditNamePanel.setVisible( false ); - - - addSubPanel( &mEditNamePanel ); - // high score loading panel may need pop up on top of name editing panel - addSubPanel( &mHighScoreLoadingPanel ); - addSubPanel( &mTutorialPanel ); - - // display panel created by loading panel, but sits under us - mDisplayPanel = mHighScoreLoadingPanel.getDisplayPanel(); - - mDisplayPanel->setMenuPanel( this ); - - addSubPanel( mDisplayPanel ); } @@ -72,23 +48,7 @@ -void MenuPanel::postScore( ScoreBundle *inScore ) { - if( getNameSet() ) { - mHighScoreLoadingPanel.setScoreToPost( inScore ); - mHighScoreLoadingPanel.setVisible( true ); - } - else { - mEditNamePanel.setScoreToPost( inScore, this ); - mEditNamePanel.setVisible( true ); - } - } - - - void MenuPanel::forceFadeOutScoreDisplay() { - mDisplayPanel->forceVisible(); - - mDisplayPanel->setVisible( false ); } @@ -110,25 +70,12 @@ setVisible( false ); return true; } - if( mEditNameButton.isInside( inX, inY ) ) { - - mEditNamePanel.setVisible( true ); - - return true; - } if( mTutorialButton.isInside( inX, inY ) ) { mTutorialPanel.setVisible( true ); return true; } - if( mHighScoreButton.isInside( inX, inY ) ) { - - mHighScoreLoadingPanel.setLoadingMessage(); - mHighScoreLoadingPanel.setVisible( true ); - - return true; - } if( mColorblindButton.isInside( inX, inY ) ) { // flip char oldMode = getColorblindMode(); @@ -191,16 +138,6 @@ mTutorialButton.mY, &menuItemColor, mFadeProgress ); - drawStringBig( "high scores", right, - mHighScoreButton.mX - 21 - 19, - mHighScoreButton.mY, - &menuItemColor, mFadeProgress ); - - drawStringBig( "edit name", right, - mEditNameButton.mX - 21 - 19, - mEditNameButton.mY, - &menuItemColor, mFadeProgress ); - drawStringBig( "colorblind", right, mColorblindButton.mX - 21 - 19, mColorblindButton.mY, @@ -228,25 +165,6 @@ Panel::step(); - // check if we should force ourself visible - // (to pass button presses through to loading and display panel, and be - // there to catch it when either of their BACK buttons are pressed) - if( !mVisible && - ( mHighScoreLoadingPanel.isFullyVisible() - || - mDisplayPanel->isFullyVisible() - || - mEditNamePanel.isFullyVisible() ) ) { - - forceVisible(); - } - if( mHighScoreLoadingPanel.isFullyVisible() - && - mEditNamePanel.isVisible() ) { - - // loading panel has popped up fully over edit panel - mEditNamePanel.forceInvisible(); - } } diff -ruN a/tilePlacementGames/game1/gameSource/MenuPanel.h b/tilePlacementGames/game1/gameSource/MenuPanel.h --- a/tilePlacementGames/game1/gameSource/MenuPanel.h 2026-11-09 16:33:51.021915785 -0300 +++ b/tilePlacementGames/game1/gameSource/MenuPanel.h 2026-11-09 16:33:51.573765916 -0300 @@ -1,10 +1,7 @@ #include "Panel.h" -#include "EditNamePanel.h" #include "TutorialPanel.h" -#include "HighScoreLoadingPanel.h" -#include "HighScorePanel.h" #include "ScoreBundle.h" @@ -20,8 +17,6 @@ ~MenuPanel(); - void postScore( ScoreBundle *inScore ); - // used after restart void forceFadeOutScoreDisplay(); @@ -44,20 +39,12 @@ private: Button mNewButton; Button mTutorialButton; - Button mHighScoreButton; - Button mEditNameButton; Button mColorblindButton; Button mSoundButton; - HighScoreLoadingPanel mHighScoreLoadingPanel; - EditNamePanel mEditNamePanel; TutorialPanel mTutorialPanel; - - // pointer to display, which is maintained by HighScoreLoadingPanel - HighScorePanel *mDisplayPanel; - };