Skip to content

Commit

Permalink
feat(): add logo to menu
Browse files Browse the repository at this point in the history
  • Loading branch information
DiaboloAB committed Jun 23, 2024
1 parent af28203 commit c16f0ab
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 11 deletions.
Binary file added assets/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 0 additions & 2 deletions src/gui/src/render/core/Core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,7 @@ void Core::update() {

void Core::run() {
while (_window.isOpen()) {
std::cout << "update data" << std::endl;
_parser.updateData(_data, _server);
std::cout << "update data done" << std::endl;
auto players = _data.getPlayers();
for (auto &player : players)
player.second->getNextEvent();
Expand Down
14 changes: 6 additions & 8 deletions src/gui/src/render/scenes/Home.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,14 @@
#include "../core/Core.hpp"

Home::Home(Core *core, int port, std::string ip) : _core(core) {
_title.setFont(_core->getFont());
_title.setString("Zappy");
_title.setPosition(100, 100);
_title.setCharacterSize(43);

_quitButton = std::make_shared<Button>(sf::Vector2f(100, 500), sf::Vector2f(100, 100), "Quit", _core->getFont());
_startButton = std::make_shared<Button>(sf::Vector2f(100, 300), sf::Vector2f(100, 100), "Start", _core->getFont());
_portButton = std::make_shared<Input>(sf::Vector2f(100, 250), sf::Vector2f(100, 100), "Port", _core->getFont(),
_startButton = std::make_shared<Button>(sf::Vector2f(100, 400), sf::Vector2f(100, 100), "Start", _core->getFont());
_portButton = std::make_shared<Input>(sf::Vector2f(100, 350), sf::Vector2f(100, 100), "Port", _core->getFont(),
"1234567890");
if (port != 0)
_portButton->setInput(std::to_string(port));
_ipButton = std::make_shared<Input>(sf::Vector2f(100, 200), sf::Vector2f(100, 100), "Ip", _core->getFont(),
_ipButton = std::make_shared<Input>(sf::Vector2f(100, 300), sf::Vector2f(100, 100), "Ip", _core->getFont(),
"1234567890.");
if (ip != "")
_ipButton->setInput(ip);
Expand All @@ -37,7 +33,7 @@ void Home::draw(sf::RenderWindow &window) {
_ipButton->draw(window, _core->getDeltaTime());
_portButton->draw(window, _core->getDeltaTime());
_chat->draw(window);
window.draw(_title);
_sprites["logo"]->draw(window);
}

void Home::update(float fElapsedTime) {
Expand Down Expand Up @@ -75,6 +71,8 @@ void Home::initSprites() {
_sprites["background"]->resetOrigin();
_sprites["movingEarth"] = std::make_shared<Sprite>("assets/earthPlanetMenu75.png", 100, 0.3f);
_sprites["movingEarth"]->setScale(10);
_sprites["logo"] = std::make_shared<Sprite>("assets/logo.png");
_sprites["logo"]->setPosition(sf::Vector2f(200, 150));
_sprites["movingEarth"]->setPosition(sf::Vector2f(1080, 720));
_sprites["starling"] = std::make_shared<Sprite>("assets/trantorian.png");
_sprites["starling"]->setScale(2);
Expand Down
1 change: 0 additions & 1 deletion src/gui/src/render/scenes/Home.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ class Home : public IScene {
protected:
private:

sf::Text _title;
std::shared_ptr<Button> _quitButton;
std::shared_ptr<Button> _startButton;

Expand Down

0 comments on commit c16f0ab

Please sign in to comment.