File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 88* .xccheckout
99* .stackdump
1010.vs
11- Chapter15 /Assets /Saved.gplevel
12- Chapter15 /Assets /* .bin
11+ Chapter14 /Assets /Saved.gplevel
12+ Chapter14 /Assets /* .bin
1313External /FMOD
Original file line number Diff line number Diff line change @@ -292,7 +292,6 @@ void Game::GenerateOutput()
292292
293293void Game::LoadData ()
294294{
295- LoadFont (" Assets/Carlito-Regular.ttf" );
296295 // Load English text
297296 LoadText (" Assets/English.gptext" );
298297
@@ -349,7 +348,6 @@ void Game::LoadData()
349348 // UI elements
350349 mHUD = new HUD (this );
351350
352-
353351 // Start music
354352 mMusicEvent = mAudioSystem ->PlayEvent (" event:/Music" );
355353
@@ -455,20 +453,6 @@ void Game::PushUI(UIScreen* screen)
455453 mUIStack .emplace_back (screen);
456454}
457455
458- void Game::LoadFont (const std::string& fileName)
459- {
460- Font* font = new Font (this );
461- if (font->Load (fileName))
462- {
463- mFonts .emplace (fileName, font);
464- }
465- else
466- {
467- font->Unload ();
468- delete font;
469- }
470- }
471-
472456Font* Game::GetFont (const std::string& fileName)
473457{
474458 auto iter = mFonts .find (fileName);
@@ -478,7 +462,18 @@ Font* Game::GetFont(const std::string& fileName)
478462 }
479463 else
480464 {
481- return nullptr ;
465+ Font* font = new Font (this );
466+ if (font->Load (fileName))
467+ {
468+ mFonts .emplace (fileName, font);
469+ }
470+ else
471+ {
472+ font->Unload ();
473+ delete font;
474+ font = nullptr ;
475+ }
476+ return font;
482477 }
483478}
484479
Original file line number Diff line number Diff line change @@ -46,7 +46,6 @@ class Game
4646 GameState GetState () const { return mGameState ; }
4747 void SetState (GameState state) { mGameState = state; }
4848
49- void LoadFont (const std::string& fileName);
5049 class Font * GetFont (const std::string& fileName);
5150
5251 void LoadText (const std::string& fileName);
Original file line number Diff line number Diff line change @@ -292,7 +292,6 @@ void Game::GenerateOutput()
292292
293293void Game::LoadData ()
294294{
295- LoadFont (" Assets/Carlito-Regular.ttf" );
296295 // Load English text
297296 LoadText (" Assets/English.gptext" );
298297
@@ -474,20 +473,6 @@ void Game::PushUI(UIScreen* screen)
474473 mUIStack .emplace_back (screen);
475474}
476475
477- void Game::LoadFont (const std::string& fileName)
478- {
479- Font* font = new Font (this );
480- if (font->Load (fileName))
481- {
482- mFonts .emplace (fileName, font);
483- }
484- else
485- {
486- font->Unload ();
487- delete font;
488- }
489- }
490-
491476Font* Game::GetFont (const std::string& fileName)
492477{
493478 auto iter = mFonts .find (fileName);
@@ -497,10 +482,22 @@ Font* Game::GetFont(const std::string& fileName)
497482 }
498483 else
499484 {
500- return nullptr ;
485+ Font* font = new Font (this );
486+ if (font->Load (fileName))
487+ {
488+ mFonts .emplace (fileName, font);
489+ }
490+ else
491+ {
492+ font->Unload ();
493+ delete font;
494+ font = nullptr ;
495+ }
496+ return font;
501497 }
502498}
503499
500+
504501void Game::LoadText (const std::string& fileName)
505502{
506503 // Clear the existing map, if already loaded
Original file line number Diff line number Diff line change @@ -46,7 +46,6 @@ class Game
4646 GameState GetState () const { return mGameState ; }
4747 void SetState (GameState state) { mGameState = state; }
4848
49- void LoadFont (const std::string& fileName);
5049 class Font * GetFont (const std::string& fileName);
5150
5251 void LoadText (const std::string& fileName);
Original file line number Diff line number Diff line change 11// ----------------------------------------------------------------
22// From Game Programming in C++ by Sanjay Madhav
33// Copyright (C) 2017 Sanjay Madhav. All rights reserved.
4- //
4+ //
55// Released under the BSD License
6- // See LICENSE.txt for full details.
6+ // See LICENSE in root directory for full details.
77// ----------------------------------------------------------------
88
99// Request GLSL 3.3
Original file line number Diff line number Diff line change @@ -293,7 +293,6 @@ void Game::GenerateOutput()
293293
294294void Game::LoadData ()
295295{
296- LoadFont (" Assets/Carlito-Regular.ttf" );
297296 // Load English text
298297 LoadText (" Assets/English.gptext" );
299298
@@ -503,20 +502,6 @@ void Game::PushUI(UIScreen* screen)
503502 mUIStack .emplace_back (screen);
504503}
505504
506- void Game::LoadFont (const std::string& fileName)
507- {
508- Font* font = new Font (this );
509- if (font->Load (fileName))
510- {
511- mFonts .emplace (fileName, font);
512- }
513- else
514- {
515- font->Unload ();
516- delete font;
517- }
518- }
519-
520505Font* Game::GetFont (const std::string& fileName)
521506{
522507 auto iter = mFonts .find (fileName);
@@ -526,7 +511,18 @@ Font* Game::GetFont(const std::string& fileName)
526511 }
527512 else
528513 {
529- return nullptr ;
514+ Font* font = new Font (this );
515+ if (font->Load (fileName))
516+ {
517+ mFonts .emplace (fileName, font);
518+ }
519+ else
520+ {
521+ font->Unload ();
522+ delete font;
523+ font = nullptr ;
524+ }
525+ return font;
530526 }
531527}
532528
Original file line number Diff line number Diff line change @@ -46,7 +46,6 @@ class Game
4646 GameState GetState () const { return mGameState ; }
4747 void SetState (GameState state) { mGameState = state; }
4848
49- void LoadFont (const std::string& fileName);
5049 class Font * GetFont (const std::string& fileName);
5150
5251 void LoadText (const std::string& fileName);
Original file line number Diff line number Diff line change 11// ----------------------------------------------------------------
22// From Game Programming in C++ by Sanjay Madhav
33// Copyright (C) 2017 Sanjay Madhav. All rights reserved.
4- //
4+ //
55// Released under the BSD License
6- // See LICENSE.txt for full details.
6+ // See LICENSE in root directory for full details.
77// ----------------------------------------------------------------
88
99// Request GLSL 3.3
You can’t perform that action at this time.
0 commit comments