Skip to content

Commit

Permalink
Temp disable text rendering for webgl, and optimize for size when lin…
Browse files Browse the repository at this point in the history
…king
  • Loading branch information
SgtCoDFish committed Mar 18, 2018
1 parent 026587a commit 8e76536
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ if ( NOT EXCLUDE_SDL_TEST)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${SDLRENDERTEST_FLAGS}")

if ( EMSCRIPTEN )
set (CMAKE_EXE_LINKER_FLAGS "${BASE_LINKER_FLAGS} --embed-file assets/world1.tmx --embed-file assets/sample_indoor.tmx --embed-file assets/world1tileset.png --embed-file assets/npctileset.png --embed-file assets/roguelike_sheet.png")
set (CMAKE_EXE_LINKER_FLAGS "${BASE_LINKER_FLAGS} --embed-file assets/world1.tmx --embed-file assets/sample_indoor.tmx --embed-file assets/world1tileset.png --embed-file assets/npctileset.png --embed-file assets/roguelike_sheet.png -O2")
endif ()

add_executable(SDLRenderTest ${SDLRENDERTEST_SOURCES} ${EXTRA_SOURCES})
Expand All @@ -265,7 +265,7 @@ if ( NOT EXCLUDE_GL_TEST )
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GLRENDERTEST_FLAGS}")

if ( EMSCRIPTEN )
set (CMAKE_EXE_LINKER_FLAGS "${BASE_LINKER_FLAGS} --embed-file assets/world1.tmx --embed-file assets/sample_indoor.tmx --embed-file assets/world1tileset.png --embed-file assets/npctileset.png --embed-file assets/roguelike_sheet.png --embed-file assets/pass_vertex-es3.glslv --embed-file assets/red_frag-es3.glslf --embed-file assets/player.png --embed-file assets/player16.png --embed-file assets/test_font.ttf -s USE_WEBGL2=1")
set (CMAKE_EXE_LINKER_FLAGS "${BASE_LINKER_FLAGS} --embed-file assets/world1.tmx --embed-file assets/sample_indoor.tmx --embed-file assets/world1tileset.png --embed-file assets/npctileset.png --embed-file assets/roguelike_sheet.png --embed-file assets/pass_vertex-es3.glslv --embed-file assets/red_frag-es3.glslf --embed-file assets/player.png --embed-file assets/player16.png --embed-file assets/test_font.ttf -s USE_WEBGL2=1 -O2")
endif ()

add_executable(GLRenderTest ${GLRENDERTEST_SOURCES} ${EXTRA_SOURCES})
Expand Down
4 changes: 2 additions & 2 deletions test/APGGLRenderTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ bool APG::APGGLRenderTest::init() {

logger->info("Estimated font size: (w, h) = (%v, %v).", renderedFontSize.x, renderedFontSize.y);

fontSprite = fontManager->renderText(font, "Hello, world!", true, FontRenderMethod::NICE);
//fontSprite = fontManager->renderText(font, "Hello, world!", true, FontRenderMethod::NICE);

auto glError = glGetError();
if (glError != GL_NO_ERROR) {
Expand Down Expand Up @@ -177,7 +177,7 @@ void APG::APGGLRenderTest::render(float deltaTime) {
spriteBatch->draw(currentPlayer->getTexture(), playerX, playerY, currentPlayer->getWidth() * 2,
currentPlayer->getHeight() * 2, 0.0f, 0.0f, currentPlayer->getWidth() * 0.5f,
currentPlayer->getHeight() * 0.5f);
spriteBatch->draw(fontSprite, textPos.x, textPos.y);
//spriteBatch->draw(fontSprite, textPos.x, textPos.y);
spriteBatch->end();

SDL_GL_SwapWindow(window.get());
Expand Down

0 comments on commit 8e76536

Please sign in to comment.