Bunch of edits.

This commit is contained in:
2025-06-09 20:50:23 -05:00
parent 54eb43044d
commit 791f6bf4c3
22 changed files with 97 additions and 78 deletions

View File

@@ -26,6 +26,7 @@
int main(int argc, char** argv) {
mcolor::windowsSaneify();
// Hide logs from engine components so we can focus on CaveGame.
JGL::Logger::Warning.EnableConsole(false);
JGL::Logger::Debug.EnableConsole(false);

View File

@@ -1,7 +1,7 @@
#include <Client/CreditsWindow.hpp>
#include "ClientApp/CaveGameWindow.hpp"
#include <Client/SettingsMenu.hpp>
#include <bits/random.h>
#include <Core/Explosion.hpp>
#include <Core/Loggers.hpp>
#include <Core/Player.hpp>
@@ -11,6 +11,7 @@
#include <Core/ItemRegistry.hpp>
#include <Core/TileRegistry.hpp>
#include <JJX/JSON.hpp>
#include <JUI/Widgets/FpsGraph.hpp>
namespace CaveGame::ClientApp {
@@ -50,11 +51,11 @@ namespace CaveGame::ClientApp {
// TODO: Parse Info to construct gameworld files.
ChangeScene(game_ctx);
game_ctx->RequestToggleSettings += [&, this] mutable {
game_ctx->RequestToggleSettings += [&, this] {
settings_window->Toggle();
};
game_ctx->OnSessionExit += [&, this] mutable {
game_ctx->OnSessionExit += [&, this] {
ChangeScene(menu_ctx);
};
}
@@ -92,7 +93,9 @@ namespace CaveGame::ClientApp {
if (this->max_fps > 0) {
float min_delta = 1.f / max_fps;
float delta_diff = min_delta - dt;
std::this_thread::sleep_for(std::chrono::microseconds((int)(delta_diff*1000*1000)));
// TODO: only guaranteed to sleep *at least* as long as we request!
// Fake bias to sleep for less time than we want, so it averages out?
//std::this_thread::sleep_for(std::chrono::microseconds((long long)(delta_diff*1000*500)));
}
auto sure_end = GetTimestamp();
@@ -109,7 +112,7 @@ namespace CaveGame::ClientApp {
void CaveGameWindow::Run()
{
int js = jstick::Connect();
int js = 0;//jstick::Connect();
//this->SetRenderer(RenderingAPI::OPENGL);
bool success = this->Open();
@@ -170,6 +173,17 @@ namespace CaveGame::ClientApp {
credits_window = Client::CreateCreditsWindowWidget(wm);
create_stats_window();
create_settings_window();
// TODO: Swap out with FpsGraphWindow on next JUI release.
auto* graph_window = new JUI::Window(wm);
graph_window->Name("FPS Graph");
graph_window->Title("FPS Graph");
graph_window->Size({500_px, 50_px});
auto* graph = new JUI::FpsGraph(graph_window->Content());
graph->Name("Graph");
graph->Size({500_px, 50_px});
}
void CaveGameWindow::Init()
@@ -215,7 +229,7 @@ namespace CaveGame::ClientApp {
{
text_size = JGL::Fonts::Jupiteroid.MeasureString(token, font_size);
JGL::J2D::FillRect(bg_color, pos, text_size);
JGL::J2D::DrawString(text_color, token, pos.x, pos.y, 1.f, font_size);
JGL::J2D::DrawString(text_color, token, pos.x, pos.y, font_size);
pos.y += text_size.y;
}
JGL::J2D::End();