Basic UI positioning and layout prior to designing the UI and setting a place for the combat system.

master
Zed A. Shaw 4 weeks ago
parent 90351ce0fe
commit 21e087ded5
  1. 4
      constants.hpp
  2. 9
      gui.cpp

@ -4,8 +4,8 @@
constexpr const int TEXTURE_WIDTH=256;
constexpr const int TEXTURE_HEIGHT=256;
constexpr const int RAY_VIEW_WIDTH=960;
constexpr const int RAY_VIEW_HEIGHT=720;
constexpr const int RAY_VIEW_WIDTH=900;
constexpr const int RAY_VIEW_HEIGHT=600;
constexpr const int SCREEN_WIDTH=1280;
constexpr const int RAY_VIEW_X=(SCREEN_WIDTH - RAY_VIEW_WIDTH);
constexpr const int RAY_VIEW_Y=0;

@ -212,6 +212,7 @@ namespace gui {
}
void FSM::draw_weapon() {
return;
auto weapon = $rayview.$textures.sword.sprite;
weapon->setPosition({SCREEN_WIDTH/2, SCREEN_HEIGHT/2});
weapon->setRotation(sf::degrees($rotation));
@ -224,6 +225,11 @@ namespace gui {
rect.setFillColor({50, 50, 50});
$window.draw(rect);
sf::RectangleShape lower({RAY_VIEW_WIDTH, SCREEN_HEIGHT - RAY_VIEW_HEIGHT});
lower.setPosition({RAY_VIEW_X,RAY_VIEW_HEIGHT});
lower.setFillColor({40, 40, 40});
$window.draw(lower);
auto player = $level.world->get_the<Player>();
auto player_combat = $level.world->get<Combat>(player.entity);
@ -249,6 +255,8 @@ namespace gui {
}
void FSM::render() {
draw_gui();
if(in_state(State::MAPPING)) {
$window.clear();
$map_view.render();
@ -263,7 +271,6 @@ namespace gui {
draw_weapon();
}
draw_gui();
$window.display();
}

Loading…
Cancel
Save