Splash screen fits to the new logo on startup, before reverting
This commit is contained in:
@@ -51,7 +51,10 @@ void ClientApplication::Init(int argc, char* argv[]) {
|
|||||||
//get the config values
|
//get the config values
|
||||||
int w = config.Int("client.screen.w");
|
int w = config.Int("client.screen.w");
|
||||||
int h = config.Int("client.screen.h");
|
int h = config.Int("client.screen.h");
|
||||||
int f = config.Int("client.screen.f") ? SDL_WINDOW_FULLSCREEN : 0;
|
int f = config.Boolean("client.screen.f") ? SDL_WINDOW_FULLSCREEN : 0;
|
||||||
|
|
||||||
|
//BUG: fullscreen is disabled
|
||||||
|
f = 0;
|
||||||
|
|
||||||
//default sizes
|
//default sizes
|
||||||
w = w ? w : 800;
|
w = w ? w : 800;
|
||||||
@@ -322,7 +325,7 @@ void ClientApplication::ProcessSceneSignal(SceneSignal signal) {
|
|||||||
//add scene creation calls here
|
//add scene creation calls here
|
||||||
case SceneSignal::FIRST:
|
case SceneSignal::FIRST:
|
||||||
case SceneSignal::SPLASHSCREEN:
|
case SceneSignal::SPLASHSCREEN:
|
||||||
activeScene = new SplashScreen();
|
activeScene = new SplashScreen(window);
|
||||||
break;
|
break;
|
||||||
case SceneSignal::MAINMENU:
|
case SceneSignal::MAINMENU:
|
||||||
activeScene = new MainMenu();
|
activeScene = new MainMenu();
|
||||||
|
|||||||
@@ -27,14 +27,23 @@
|
|||||||
//Public access members
|
//Public access members
|
||||||
//-------------------------
|
//-------------------------
|
||||||
|
|
||||||
SplashScreen::SplashScreen() {
|
SplashScreen::SplashScreen(SDL_Window* w) {
|
||||||
//TODO: I need a logo that isn't partially invisible
|
//fit the screen to the logo
|
||||||
|
//TODO: refactor the code for this window trick
|
||||||
|
window = w;
|
||||||
|
SDL_GetWindowSize(window, &windowWidth, &windowHeight);
|
||||||
|
|
||||||
logo.Load(GetRenderer(), ConfigUtility::GetSingleton()["dir.logos"] + "krstudios.png");
|
logo.Load(GetRenderer(), ConfigUtility::GetSingleton()["dir.logos"] + "krstudios.png");
|
||||||
|
|
||||||
|
SDL_SetWindowSize(window, logo.GetClipW(), logo.GetClipH());
|
||||||
|
SDL_RenderSetLogicalSize(GetRenderer(), logo.GetClipW(), logo.GetClipH());
|
||||||
|
|
||||||
startTick = std::chrono::steady_clock::now();
|
startTick = std::chrono::steady_clock::now();
|
||||||
}
|
}
|
||||||
|
|
||||||
SplashScreen::~SplashScreen() {
|
SplashScreen::~SplashScreen() {
|
||||||
//
|
SDL_SetWindowSize(window, windowWidth, windowHeight);
|
||||||
|
SDL_RenderSetLogicalSize(GetRenderer(), windowWidth, windowHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------
|
//-------------------------
|
||||||
@@ -42,7 +51,7 @@ SplashScreen::~SplashScreen() {
|
|||||||
//-------------------------
|
//-------------------------
|
||||||
|
|
||||||
void SplashScreen::FrameStart() {
|
void SplashScreen::FrameStart() {
|
||||||
if (std::chrono::steady_clock::now() - startTick > std::chrono::duration<int>(1)) {
|
if (std::chrono::steady_clock::now() - startTick > std::chrono::duration<int>(3)) {
|
||||||
SetSceneSignal(SceneSignal::MAINMENU);
|
SetSceneSignal(SceneSignal::MAINMENU);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -51,5 +60,5 @@ void SplashScreen::RenderFrame(SDL_Renderer* renderer) {
|
|||||||
int w = 0, h = 0;
|
int w = 0, h = 0;
|
||||||
SDL_RenderGetLogicalSize(renderer, &w, &h);
|
SDL_RenderGetLogicalSize(renderer, &w, &h);
|
||||||
//TODO: fix logo position
|
//TODO: fix logo position
|
||||||
logo.DrawTo(renderer, (w - logo.GetClipW() / 4) / 2, (h - logo.GetClipH() / 4) / 2, .25, .25);
|
logo.DrawTo(renderer, (w - logo.GetClipW()) / 2, (h - logo.GetClipH()) / 2);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
class SplashScreen : public BaseScene {
|
class SplashScreen : public BaseScene {
|
||||||
public:
|
public:
|
||||||
//Public access members
|
//Public access members
|
||||||
SplashScreen();
|
SplashScreen(SDL_Window*);
|
||||||
~SplashScreen();
|
~SplashScreen();
|
||||||
|
|
||||||
void RenderFrame(SDL_Renderer* renderer) override;
|
void RenderFrame(SDL_Renderer* renderer) override;
|
||||||
@@ -41,4 +41,8 @@ private:
|
|||||||
//members
|
//members
|
||||||
std::chrono::steady_clock::time_point startTick;
|
std::chrono::steady_clock::time_point startTick;
|
||||||
Image logo;
|
Image logo;
|
||||||
|
|
||||||
|
//screws with the window
|
||||||
|
SDL_Window* window = nullptr;
|
||||||
|
int windowWidth, windowHeight;
|
||||||
};
|
};
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 167 KiB After Width: | Height: | Size: 40 KiB |
Reference in New Issue
Block a user