Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
9cc9bfc
gui-refactoring
psyinf Jan 2, 2025
df204e9
renamed guiElements
psyinf Jan 4, 2025
daee5f8
move sandbox apps
messers2 Jan 8, 2025
62a90df
moved foundation tests to pgf repo
psyinf Jan 9, 2025
ea12513
moving towards URI based dataProvider
psyinf Jan 10, 2025
7fff37d
add virtual file system based DataProvider
psyinf Jan 12, 2025
0f67fbb
Add SpriteFactory with data from buffer
psyinf Jan 12, 2025
55411cf
use VFS for game resource mananger
psyinf Jan 12, 2025
4a1755e
Improved error message for failed resource load in pre-loader
psyinf Jan 12, 2025
1e4cd35
vfs minimal test
psyinf Jan 12, 2025
e414669
warnings as errors in galaxy
psyinf Jan 12, 2025
dfc2121
renamed PercentCompleted to PercentCompletedMap
psyinf Jan 12, 2025
9da50a4
warnings as errors in pgGame
psyinf Jan 12, 2025
0c75559
adapted VFSDataProvider to new interface
psyinf Jan 12, 2025
7fbd126
makeTexture from buffer
psyinf Jan 12, 2025
a948e2a
corrected paths
psyinf Jan 12, 2025
4b064bd
moved ResourcePreLoader out of LoadResourcesScene impl
psyinf Jan 12, 2025
72b4c3e
back to warnings not errors due to btcpp
psyinf Jan 13, 2025
976d546
adapted to new soundengine signature
psyinf Jan 13, 2025
74d3887
Scene with retrievable id
psyinf Jan 13, 2025
cba36ae
VFSDataProvider error handling
psyinf Jan 13, 2025
08f9bd8
MainMenu with pre-loading
psyinf Jan 13, 2025
b6fcca2
Game DataProvider getter
psyinf Jan 13, 2025
973b263
SoundSystem with pre-registering all sounds
psyinf Jan 13, 2025
d60870d
refactored out MemStream
psyinf Jan 14, 2025
378f7fd
TextResource and loadResouce specialization
psyinf Jan 14, 2025
aae9a6b
error guard in Scene::frame
psyinf Jan 14, 2025
09a73b3
correct linkage of Spinner GUI components
psyinf Jan 15, 2025
7b7c730
Loading Bar widget
psyinf Jan 15, 2025
a6b4d56
Game config
psyinf Jan 15, 2025
923fff3
corrected resource paths
psyinf Jan 15, 2025
9f30e20
some config refactoring
psyinf Jan 18, 2025
ca4ef63
galaxy config saving if not existent
psyinf Jan 18, 2025
4dfc73e
options menu with key-binding
psyinf Jan 18, 2025
a6f4c30
some debug-output mod in ResourcePreLoader
psyinf Jan 18, 2025
427d210
Swizzle for alpha and ColorRGB
psyinf Jan 18, 2025
777b715
Overhauled ScopeBeginEndWrapper to allow for default arguments to be …
psyinf Jan 19, 2025
5f943c0
added Window wrapper for ImGui::Begin
psyinf Jan 19, 2025
7f0a446
Fix wrong ScopedBeginEnd instance use
psyinf Jan 19, 2025
536b542
Options menu with separate window displayed conditionally
psyinf Jan 19, 2025
9c8c553
fixed discard behavior in MainMenu Options
psyinf Jan 19, 2025
0dd3726
rework options menu
psyinf Jan 20, 2025
935745f
some documentation on ScopeBeginEndWrapper
psyinf Jan 20, 2025
86e27ad
clean up
psyinf Jan 27, 2025
381943f
move back to fixed vfspp
psyinf Jan 27, 2025
2b7009d
move to updated btcpp (waiting for PR)
psyinf Jan 27, 2025
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
8 changes: 1 addition & 7 deletions apps/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
add_subdirectory(_template)
add_subdirectory(minimal_demo)
add_subdirectory(sandbox)
add_subdirectory(btcpp)
add_subdirectory(asteroids)
add_subdirectory(textdemo)
add_subdirectory(stellarfield)
add_subdirectory(galaxy)
add_subdirectory(productionSandbox)
add_subdirectory(markov_gen)
add_subdirectory(sandboxes)
2 changes: 1 addition & 1 deletion apps/asteroids/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
int main([[maybe_unused]] int argc, [[maybe_unused]] char** argv)
try
{
pg::game::Game game;
pg::game::Game game({});

pg::game::SystemsFactory::registerSystem<asteroids::Lasers>("lasers");
pg::game::SystemsFactory::registerSystem<asteroids::Player>("player");
Expand Down
2 changes: 2 additions & 0 deletions apps/asteroids/systems/Background.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
#include <pgGame/components/WindowDetails.hpp>
#include "components/Entities.h"
#include <pgGame/components/Drawable.hpp>
#include <pgEngine/factories/Factories.hpp>
#include <pgEngine/primitives/BackgoundSprite.hpp>

void asteroids::Background::handle(const pg::FrameStamp&)
{
Expand Down
14 changes: 8 additions & 6 deletions apps/galaxy/Galaxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
#include <systems/BehaviorSystem.hpp>
#include <systems/StatsSystem.hpp>

galaxy::GalacticCore::GalacticCore()
: game(std::make_unique<pg::game::Game>())
galaxy::GalacticCore::GalacticCore(pg::game::GameConfig&& config)
: game(std::make_unique<pg::game::Game>(std::move(config)))
{
}

Expand All @@ -30,8 +30,8 @@ void galaxy::GalacticCore::setup()
// TODO: from file

static const auto event_sound_cfg = std::unordered_map<std::string, EventSound>{
{"PickEvent", {"../data/sound/asteroids/laser_short.wav"}},
{"MenuButtonPressed", {"../data/sounds/ui/spacebar-click-keyboard-199448.mp3"}}};
{"PickEvent", {"data/sound/asteroids/laser_short.wav"}},
{"MenuButtonPressed", {"data/sounds/ui/spacebar-click-keyboard-199448.mp3"}}};

// TODO: structure of files/resources to be loaded
// the structure must be annotated to allow for dispatching to specific loader
Expand All @@ -41,13 +41,15 @@ void galaxy::GalacticCore::setup()
game->getConfig().addPerSceneConfig<galaxy::SceneSoundScape>(
"mainMenu",
"soundScape",
{.background_music{.music_list{{"../data/music/dead-space-style-ambient-music-184793.mp3"}}},
{.background_music{.music_list{{"data/music/dead-space-style-ambient-music-184793.mp3"}}},
.event_sounds = {event_sound_cfg}});

game->getConfig().addPerSceneConfig<galaxy::SceneSoundScape>(
"galaxy",
"soundScape",
{.background_music{.music_list{{"../data/music/a-meditation-through-time-amp-space-11947.mp3"}}},
// {.background_music{.music_list{{"data/music/a-meditation-through-time-amp-space-11947.mp3"}}},
{.background_music{
.music_list{{"music/soundtracks/cylinders/Chris Zabriskie - Cylinders - 08 Cylinder Eight.mp3"}}},
.event_sounds = {event_sound_cfg}

});
Expand Down
2 changes: 1 addition & 1 deletion apps/galaxy/Galaxy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class GalacticCore

{
public:
GalacticCore();
GalacticCore(pg::game::GameConfig&&);

void setup();

Expand Down
140 changes: 0 additions & 140 deletions apps/galaxy/gui/DashBoardWidget.hpp

This file was deleted.

64 changes: 0 additions & 64 deletions apps/galaxy/gui/DemoToolBox.hpp

This file was deleted.

33 changes: 7 additions & 26 deletions apps/galaxy/gui/InSceneOptionsWidget.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#pragma once
#include <gui/GameGuiWidget.hpp>
#include <pgGame/events/GameEvents.hpp>
#include <pgEngine/gui/ImGuiScopedWrappers.hpp>
#include "menus/OptionsMenu.hpp"

namespace galaxy::gui {

Expand All @@ -11,34 +13,13 @@ class InSceneOptionsWidget : public galaxy::gui::GameGuiWidget

void draw([[maybe_unused]] pg::Gui& gui) override
{
ImGui::Begin("In Scene Options", nullptr, ImGuiWindowFlags_AlwaysAutoResize);
// HACK:
if (getGame().getCurrentSceneId() == "galaxy")
if (getGame().getCurrentSceneId() != "galaxy") { return; }
auto& menu_active = getGame().getCurrentScene().getSingleton<bool&>("galaxy.options_menu.active");
if (!menu_active) { return; }
{
// background opacity
auto opacity = getGame().getCurrentScene().callGetter<float>("galaxy.background.opacity");
if (ImGui::SliderFloat("Opacity", &opacity, 0.f, 1.f))
{
getGame().getCurrentScene().callSetter<float>("galaxy.background.opacity", opacity);
}
// grid visible
if (getGame().getCurrentScene().hasAccessor<float>("galaxy.grid.opacity"))
{
float gridVisible = getGame().getCurrentScene().callGetter<float>("galaxy.grid.opacity");
if (ImGui::SliderFloat("Grid Visibility", &gridVisible, 0.f, 1.f))
{
getGame().getCurrentScene().callSetter<float>("galaxy.grid.opacity", gridVisible);
}
}
auto window = pgf::gui::Window("Options", &menu_active);
inGameOptions(getGame());
}

auto volume = getGame().getCurrentScene().callGetter<float>("scene.sound.volume");
if (ImGui::SliderFloat("Global Volume", &volume, 0.f, 1.f))
{
getGame().getCurrentScene().callSetter<float>("scene.sound.volume", volume);
}

ImGui::End();
}
};

Expand Down
55 changes: 55 additions & 0 deletions apps/galaxy/gui/LoadingBarWidget.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#pragma once
#include <gui/GameGuiWidget.hpp>
#include <imgui.h>
#include <components/Stats.hpp>
#include <ranges>
#include <pgFoundation/imgui/Spinner.hpp>

#include <pgGame/events/SceneManagementEvents.hpp>
#include <pgEngine/gui/ImGuiScopedWrappers.hpp>

namespace galaxy::gui {

class LoadingBarWidget : public galaxy::gui::GameGuiWidget
{
uint32_t numFramesFinished = 0;

public:
using galaxy::gui::GameGuiWidget::GameGuiWidget;
static constexpr auto num_frames_to_fade = 200u;

void draw([[maybe_unused]] pg::Gui& gui) override
{
float totalProgress = getGame().getCurrentScene().getSingleton<float&>("resourceLoader.totalProgress");
if (totalProgress >= 1.0f) { numFramesFinished++; }
if (numFramesFinished > num_frames_to_fade) { return; }

ImGui::Begin("Loading Resources",
nullptr,
ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoCollapse |
ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_AlwaysAutoResize);

ImGui::SetWindowPos(ImVec2(0, ImGui::GetIO().DisplaySize.y - ImGui::GetWindowHeight()));
ImGui::SetWindowSize(ImVec2(ImGui::GetIO().DisplaySize.x, 20));

ImGui::SetCursorPosX(10);

{
pgf::gui::StyleStack styleStack;
styleStack.pushStyleColor(ImGuiCol_Text, ImVec4{1.0f, 1.0f, 1.0f, 1.0f});
// if number of frames finished is > 0 slowly fade out
if (numFramesFinished > 0)
{
float alpha = 1.0f - numFramesFinished / static_cast<float>(num_frames_to_fade);
// use blending to fade out
styleStack.pushStyle(ImGuiStyleVar_Alpha, alpha);
}

ImGui::ProgressBar(totalProgress, ImVec2{ImGui::GetIO().DisplaySize.x - 20, 40}, "");
}

ImGui::End();
}
};

} // namespace galaxy::gui
Loading
Loading