Various Edits

This commit is contained in:
2025-04-01 18:57:01 -04:00
parent b10d1e30dc
commit f82157d240
25 changed files with 294 additions and 79 deletions

View File

@@ -21,27 +21,33 @@
},
{
"mnemonic-id": "copper-bar",
"display-name": "Copper Bar"
"display-name": "Copper Bar",
"sprite:" : "ingot"
},
{
"mnemonic-id": "iron-bar",
"display-name": "Iron Bar"
"display-name": "Iron Bar",
"sprite:" : "ingot"
},
{
"mnemonic-id": "silver-bar",
"display-name": "Silver Bar"
"display-name": "Silver Bar",
"sprite:" : "ingot"
},
{
"mnemonic-id": "tungsten-bar",
"display-name": "Tungsten Bar"
"display-name": "Tungsten Bar",
"sprite:" : "ingot"
},
{
"mnemonic-id": "platinum-bar",
"display-name": "Platinum Bar"
"display-name": "Platinum Bar",
"sprite:" : "ingot.png"
},
{
"mnemonic-id": "gold-bar",
"display-name": "Gold Bar"
"display-name": "Gold Bar",
"sprite:" : "ingot.png"
},
{
"mnemonic-id": "lead-bar",
@@ -84,5 +90,11 @@
"stack": 1,
"tags": ["dagger", "blade", "melee", "metal", "iron", "rusty"]
},
{
"mnemonic-id": "smoke-n-dip"
},
{
"mnemonic-id": "blick-axe"
}
]

View File

@@ -0,0 +1,13 @@
{
"textures": [
["ingot", "assets/textures/ingot.png"],
["player", "assets/textures/player.png"],
["bg", "assets/textures/bg.png"],
["explosion", "assets/textures/explosion.png"],
["redacted", "assets/textures/redacted.png"],
["title_1", "assets/textures/title_1.png"]
],
"music": [
]
}

View File

@@ -133,7 +133,7 @@
"forced-ticc-func": "sand-grav",
"solid": true,
"color": [102, 118, 124],
"pallet": [[92, 102, 128], [89, 116, 123], [121, 95, 108]]
"pallet": [[92, 102, 128], [82, 82, 82], [102, 102, 102], [132, 132, 132], [89, 116, 123], [121, 95, 108]]
},
{
"mnemonic-id" : "white-sand",

View File

@@ -65,7 +65,8 @@ namespace CaveGame::ClientApp {
/// This function performs rendering routines, once per refresh.
void Draw();
bool ReadyToClose() const { return wanna_die; }
/// @return True when a flag is set that indicates the game is "preparing" to close. Certain procedures may still be taking place, such as saving and serialization.
bool ReadyToClose() const;
/// Returns the game's console GUI, which accepts commands and displays log messages.
Client::Console* Console();
@@ -85,14 +86,23 @@ namespace CaveGame::ClientApp {
public:
#pragma region Input Callbacks
/// Called by the window on each frame.
void OnRefresh(float elapsed) override;
/// Called by the window upon the user pressing a mouse button.
void OnMouseButtonDown(const ReWindow::MouseButtonDownEvent &ev) override;
/// Called by the window upon the user releasing a mouse button.
void OnMouseButtonUp(const ReWindow::MouseButtonUpEvent &ev) override;
/// Called by the window upon the user scrolling a mouse wheel.
void OnMouseWheel(const ReWindow::MouseWheelEvent &ev) override;
/// Called by the window upon the user releasing a keyboard key.
void OnKeyUp(const ReWindow::KeyUpEvent &ev) override;
/// Called by the window upon the user pressing a keyboard key.
void OnKeyDown(const ReWindow::KeyDownEvent& ev) override;
/// Called by the window upon the user moving their pointer device, currently just mice.
void OnMouseMove(const ReWindow::MouseMoveEvent &ev) override;
/// Called by the window when it receives a request from the operating-system to resize.
bool OnResizeRequest(const ReWindow::WindowResizeRequestEvent &ev) override;
/// Called by the window **before** it closes.
void OnClosing() override;
#pragma endregion
public:
@@ -107,7 +117,7 @@ namespace CaveGame::ClientApp {
/// Runs exactly one iteration of the game loop. Currently, this is one call to Update(), and then to Draw().
/// @see Refresh().
void Step();
/// Creates the in-game console menu.
void create_console_window();
void create_stats_window();
void create_settings_window();
@@ -118,9 +128,16 @@ namespace CaveGame::ClientApp {
/// Constructs the Splash screen, Main Menu screen, and In-game session.
void CreateContexts();
// TODO: Refactor this into irrelevance.
void InGameControls(float elapsed);
void OnConsoleCommandInput(const std::string &command);
/// Toggles tile simulation if we are in-game.
bool ToggleTileSim(const CommandArgs& args);
/// Opens a singleplayer session.
/// @param info A structure containing information for joining a singleplayer world.
void OpenWorld(Client::SingleplayerSessionInfo info);
/// Logs help information to the console. Called when the user runs the 'help' command.
bool HelpCommand(const CommandArgs& args);
@@ -128,8 +145,11 @@ namespace CaveGame::ClientApp {
bool ListCommand(const CommandArgs& args);
bool TileListCmd(const CommandArgs& args);
bool ItemListCmd(const CommandArgs& args);
/// Toggles tile simulation if we are
bool ToggleTileSim(const CommandArgs& args);
bool NoclipCmd(const CommandArgs &args);
bool FpsLimitCmd(const CommandArgs &args);
/// This table defines the supported console commands, their aliases, and the callback lambda.
#pragma region Commands
@@ -252,10 +272,6 @@ namespace CaveGame::ClientApp {
float our_avg = 0.f;
float max_fps = 60.f;
void OpenWorld(Client::SingleplayerSessionInfo info);
bool NoclipCmd(const CommandArgs &args);
bool FpsLimitCmd(const CommandArgs &args);
};
}

View File

@@ -23,6 +23,8 @@ namespace CaveGame::ClientApp {
{
Logs::Info("Parsing Tile Data.");
CaveGame::Core::LoadTileMetadata();
Logs::Info("Parsing Item Data.");
CaveGame::Core::LoadItemMetadata();
Logs::Info("Creating game window.");
CreateContexts();
@@ -116,17 +118,21 @@ namespace CaveGame::ClientApp {
this->SetResizable(true);
this->SetVsyncEnabled(false);
this->assets.PreloadCertainAssets();
this->assets.ParseManifest();
// TODO: Replace w/ constructor?
this->assets.TempLoadSimple();
this->assets.EnqueueDefaultAssetsFolder();
//for (int i = 0; i < 10; i++)
//{
assets.EnqueueTexture("assets/textures/redacted.png");
assets.EnqueueTexture("assets/textures/bg.png");
assets.EnqueueTexture("assets/textures/player.png");
assets.EnqueueTexture("assets/textures/explosion.png");
assets.EnqueueTexture("assets/textures/title_1.png");
assets.EnqueueTexture("assets/textures/ash_wip_potions.png");
//assets.EnqueueTexture("assets/textures/redacted.png");
//assets.EnqueueTexture("assets/textures/bg.png");
//assets.EnqueueTexture("assets/textures/player.png");
//assets.EnqueueTexture("assets/textures/explosion.png");
//assets.EnqueueTexture("assets/textures/title_1.png");
//assets.EnqueueTexture("assets/textures/ash_wip_potions.png");
//}
@@ -356,9 +362,15 @@ namespace CaveGame::ClientApp {
}
if (ev.key == Keys::Escape) {
GameSession()->SaveAndExit();
// TODO: "Pause menu"
if (Console()->IsOpen())
Console()->SetOpen(false);
//GameSession()->SaveAndExit();
// TODO: GameContext needs mechanism to **inform** the higher-level object that we are done.
ChangeScene(menu_ctx);
//ChangeScene(menu_ctx);
}
}
@@ -626,6 +638,8 @@ namespace CaveGame::ClientApp {
return true;
}
bool CaveGameWindow::ReadyToClose() const { return wanna_die; }
}