-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
mel-mouk
committed
Jun 24, 2021
1 parent
158bf65
commit 3b948fe
Showing
2 changed files
with
21 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,21 @@ | ||
#include "splashscreen-state.h" | ||
|
||
void SplashscreenState::init() { } | ||
void SplashscreenState::init() { | ||
if (!_texture.loadFromFile("../assets/splashscreen.png")) { | ||
std::cout << "Error while loading Splashscreen assets " << std::endl; | ||
return; | ||
} | ||
_sprite.setTexture(_texture); | ||
} | ||
|
||
void SplashscreenState::handleInput(sf::Event *event) { } | ||
void SplashscreenState::handleInput(sf::Event *event) { | ||
if (event->type == sf::Event::KeyPressed || event->type == sf::Event::MouseButtonPressed) { | ||
Pang::setState(Pang::Menu); | ||
} | ||
} | ||
|
||
void SplashscreenState::update(float timeElapsed) { } | ||
|
||
void SplashscreenState::draw(sf::RenderWindow *window) { } | ||
void SplashscreenState::draw(sf::RenderWindow *window) { | ||
window->draw(_sprite); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,20 @@ | ||
#ifndef PANG_SPLASHSCREEN_STATE_H | ||
#define PANG_SPLASHSCREEN_STATE_H | ||
|
||
#include "../pang.h" | ||
#include "game-state.h" | ||
#include <iostream> | ||
|
||
class SplashscreenState : public GameState { | ||
public: | ||
void init() override; | ||
void handleInput(sf::Event *event) override; | ||
void update(float timeElapsed) override; | ||
void draw(sf::RenderWindow *window) override; | ||
|
||
private: | ||
sf::Texture _texture; | ||
sf::Sprite _sprite; | ||
}; | ||
|
||
#endif //PANG_SPLASHSCREEN_STATE_H |