Added DEBUG logging to main.cpp. Implemented getWidth and getSize for RWindow.
This commit is contained in:
@@ -214,6 +214,8 @@ namespace ReWindow
|
||||
void setVsyncEnabled(bool);
|
||||
void setTitle(const std::string& title);
|
||||
std::string getTitle() const;
|
||||
int getWidth() const; // Honestly no idea if we'll keep these or still go with getSize.
|
||||
int getHeight() const; // getSize wasn't working for me for logging. -maxine
|
||||
void fullscreen();
|
||||
void restoreFromFullscreen();
|
||||
bool getFlag(RWindowFlags flag) const;
|
||||
@@ -226,7 +228,7 @@ namespace ReWindow
|
||||
void setSize(const Vector2& size);
|
||||
/// Returns the position of the window's top-left corner relative to the display
|
||||
Vector2 getPos() const;
|
||||
Vector2 getSize() const;
|
||||
Vector2 getSize() const; // I want to know why this is made platform specific. Is that even necessary? -maxine
|
||||
void setPos(int x, int y);
|
||||
void setPos(const Vector2& pos);
|
||||
Vector2 getCursorPos() const;
|
||||
|
12
main.cpp
12
main.cpp
@@ -32,15 +32,27 @@ class MyWindow : public ReWindow::RWindow {
|
||||
|
||||
int main() {
|
||||
auto* window = new MyWindow("Test Window", 600, 480);
|
||||
DEBUG(std::format("New window {} created. Width: {} Height: {}", window->getTitle(), window->getWidth(), window->getHeight()));
|
||||
|
||||
window->setRenderer(RenderingAPI::OPENGL);
|
||||
DEBUG(std::format("Rendering API OPENGL set for window {}", window->getTitle()));
|
||||
|
||||
window->Open();
|
||||
DEBUG(std::format("Opened window {}", window->getTitle()));
|
||||
|
||||
// TODO: Cannot set flags until after window is open
|
||||
// Make this work somehow
|
||||
DEBUG("TODO: Cannot set flags until after window is open")
|
||||
window->setFullscreen(false);
|
||||
window->setVsyncEnabled(false);
|
||||
window->setResizable(false);
|
||||
DEBUG(std::format("Window {} flags: IN_FOCUS={} FULLSCREEN={} RESIZEABLE={} VSYNC={} QUIT={}",
|
||||
window->getTitle(),
|
||||
window->getFlag(RWindowFlags::IN_FOCUS),
|
||||
window->getFlag(RWindowFlags::FULLSCREEN),
|
||||
window->getFlag(RWindowFlags::RESIZABLE),
|
||||
window->getFlag(RWindowFlags::VSYNC),
|
||||
window->getFlag(RWindowFlags::QUIT)));
|
||||
|
||||
window->OnKeyDownEvent += [&] (ReWindow::KeyDownEvent e) {
|
||||
DEBUG(e.key.CharCode);
|
||||
|
@@ -41,6 +41,24 @@ std::string RWindow::getTitle() const {
|
||||
return this->title;
|
||||
}
|
||||
|
||||
/*
|
||||
Vector2 RWindow::getSize() const
|
||||
{
|
||||
return {this->width, this->height};
|
||||
}
|
||||
*/
|
||||
|
||||
int RWindow::getWidth() const
|
||||
{
|
||||
return this->width;
|
||||
}
|
||||
|
||||
int RWindow::getHeight() const
|
||||
{
|
||||
return this->height;
|
||||
}
|
||||
|
||||
|
||||
void RWindow::setRenderer(RenderingAPI api) {
|
||||
renderer = api;
|
||||
}
|
||||
|
Reference in New Issue
Block a user