From 991cfcad821e9eb356a35ee6c072c438f2992c5f Mon Sep 17 00:00:00 2001 From: Noel Berry Date: Sun, 9 May 2021 19:46:08 -0700 Subject: [PATCH] adding more App windowing methods --- include/blah/app.h | 19 +++++++++++++++++++ src/app.cpp | 42 ++++++++++++++++++++++++++++++++++++------ 2 files changed, 55 insertions(+), 6 deletions(-) diff --git a/include/blah/app.h b/include/blah/app.h index 1be0141..7eb1ede 100644 --- a/include/blah/app.h +++ b/include/blah/app.h @@ -1,5 +1,6 @@ #pragma once #include +#include namespace Blah { @@ -112,6 +113,24 @@ namespace Blah // Gets the user path const char* user_path(); + // Gets the Window Title + const char* get_title(); + + // Sets the Window Title + void set_title(const char* title); + + // Gets the Window Position + Point get_position(); + + // Sets the Window Position + void set_position(Point point); + + // Gets the Window Size + Point get_size(); + + // Sets the Window Size + void set_size(Point point); + // Gets the width of the window int width(); diff --git a/src/app.cpp b/src/app.cpp index c0f0013..f28be19 100644 --- a/src/app.cpp +++ b/src/app.cpp @@ -204,18 +204,48 @@ const char* App::user_path() return PlatformBackend::user_path(); } +const char* App::get_title() +{ + return PlatformBackend::get_title(); +} + +void App::set_title(const char* title) +{ + PlatformBackend::set_title(title); +} + +Point App::get_position() +{ + Point result; + PlatformBackend::get_position(&result.x, &result.y); + return result; +} + +void App::set_position(Point point) +{ + PlatformBackend::set_position(point.x, point.y); +} + +Point App::get_size() +{ + Point result; + PlatformBackend::get_size(&result.x, &result.y); + return result; +} + +void App::set_size(Point point) +{ + PlatformBackend::set_size(point.x, point.y); +} + int App::width() { - int w, h; - PlatformBackend::get_size(&w, &h); - return w; + return get_size().x; } int App::height() { - int w, h; - PlatformBackend::get_size(&w, &h); - return h; + return get_size().y; } int App::draw_width()