Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ imgui.ini
bave*.log
/spaced
/notes.txt
/local_store
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ include(FetchContent)
FetchContent_Declare(
bgf
GIT_REPOSITORY https://github.com/karnkaul/bgf
GIT_TAG v0.1.0
GIT_TAG v0.1.3
SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ext/bgf"
)

Expand Down
Binary file added assets/images/background.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/player_ship.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 7 additions & 7 deletions assets/particles/exhaust.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
},
"lerp": {
"tint": {
"lo": "#231d2aff",
"hi": "#231d2aff"
"lo": "#f48018ff",
"hi": "#ffffff00"
},
"scale": {
"lo": [
Expand All @@ -48,14 +48,14 @@
}
},
"ttl": {
"lo": 2.000000,
"hi": 3.000000
"lo": 0.300000,
"hi": 1.000000
},
"quad_size": [
80.000000,
80.000000
20.000000,
20.000000
],
"count": 80,
"count": 200,
"respawn": true
}
}
2 changes: 1 addition & 1 deletion assets/styles.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"sliders": {
"default": {
"progress_bar": "default",
"knob_diameter": 30,
"knob_diameter": 50,
"knob_tint": "#9f2b68ff"
}
},
Expand Down
1 change: 1 addition & 0 deletions attribution.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
SpaceShooterRedux: https://opengameart.org/content/space-shooter-redux, https://www.kenney.nl
73 changes: 0 additions & 73 deletions src/spaced/spaced/assets/asset_list.cpp

This file was deleted.

50 changes: 0 additions & 50 deletions src/spaced/spaced/assets/asset_list.hpp

This file was deleted.

76 changes: 0 additions & 76 deletions src/spaced/spaced/assets/asset_loader.cpp

This file was deleted.

28 changes: 0 additions & 28 deletions src/spaced/spaced/assets/asset_loader.hpp

This file was deleted.

13 changes: 0 additions & 13 deletions src/spaced/spaced/assets/asset_manifest.hpp

This file was deleted.

5 changes: 3 additions & 2 deletions src/spaced/spaced/game/controllers/player_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,9 @@ void PlayerController::stop_firing() {
}

auto PlayerController::is_in_move_area(glm::vec2 const position) const -> bool {
auto const n_pos = position.x / m_display->get_world_space().x;
return n_pos <= -n_move_area;
auto const width = m_display->get_world_space().x;
auto const n_pos = (position.x + 0.5f * width) / width;
return n_pos <= n_move_area;
}

void PlayerController::tick_gamepad(Seconds const dt) {
Expand Down
2 changes: 1 addition & 1 deletion src/spaced/spaced/game/controllers/player_controller.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class PlayerController : public FollowController {

float max_y{};
float min_y{};
float n_move_area{0.25f}; // from left
float n_move_area{0.3f}; // from left

float gamepad_sensitivity{2000.0f};

Expand Down
2 changes: 0 additions & 2 deletions src/spaced/spaced/game/enemy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ using bave::Services;
using bave::Shader;
using bave::Styles;

namespace ui = bave::ui;

Enemy::Enemy(Services const& services, std::string_view const type) : m_layout(&services.get<Layout>()), m_health_bar(services), m_type(type) {
static constexpr auto init_size_v = glm::vec2{100.0f};
auto const play_area = m_layout->play_area;
Expand Down
21 changes: 13 additions & 8 deletions src/spaced/spaced/game/hud.cpp
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
#include <fmt/format.h>
#include <bave/services/styles.hpp>
#include <bave/ui/button.hpp>
#include <spaced/game/hud.hpp>
#include <spaced/services/layout.hpp>

namespace spaced {
using bave::IDisplay;
using bave::Seconds;
using bave::Services;
using bave::Styles;
using bave::TextHeight;

namespace ui = bave::ui;

Hud::Hud(Services const& services) : ui::View(services), m_styles(&services.get<Styles>()), m_area(services.get<Layout>().hud_area) {
Hud::Hud(Services const& services)
: ui::View(services), m_display(&services.get<IDisplay>()), m_layout(&services.get<Layout>()), m_styles(&services.get<Styles>()) {
create_background();
create_score(services);

block_input_events = false;
render_view = m_display->get_world_view();
}

void Hud::set_score(std::int64_t const score) { m_score->text.set_string(fmt::format("{}", score)); }
Expand All @@ -25,8 +30,8 @@ void Hud::create_background() {
auto background = std::make_unique<ui::OutlineQuad>();
m_background = background.get();
background->set_outline_width(0.0f);
background->set_size(m_area.size());
background->set_position(m_area.centre());
background->set_size(m_layout->hud_area.size());
background->set_position(m_layout->hud_area.centre());
background->set_tint(m_styles->rgbas["milk"]);
push(std::move(background));
}
Expand All @@ -37,24 +42,24 @@ void Hud::create_score(Services const& services) {
auto make_text = [&] {
auto text = std::make_unique<ui::Text>(services);
text->text.set_height(TextHeight{60});
text->text.transform.position = m_area.centre();
text->text.transform.position = m_layout->hud_area.centre();
text->text.tint = rgbas["grey"];
return text;
};

auto text = make_text();
m_score = text.get();
text->text.set_string("9999999999");
auto const text_bounds_size = text->text.get_bounds().size();
text->text.transform.position.y -= 0.5f * text_bounds_size.y;
m_text_bounds_size = text->text.get_bounds().size();
text->text.transform.position.y -= 0.5f * m_text_bounds_size.y;
set_score(0);

push(std::move(text));

text = make_text();
m_hi_score = text.get();
text->text.transform.position.x = m_area.rb.x - 50.0f;
text->text.transform.position.y -= 0.5f * text_bounds_size.y;
text->text.transform.position.x = m_layout->hud_area.rb.x - 50.0f;
text->text.transform.position.y -= 0.5f * m_text_bounds_size.y;
text->text.set_align(bave::Text::Align::eLeft);
set_hi_score(0);

Expand Down
Loading