Repository navigation
create_window
Daniel edited this page May 5, 2021
·
7 revisions
The create_window function creates and returns the window as type FUI_Window*
create_window takes 4 arguments
create_window(const std::string& identifier, const std::string& title, olc::vi2d position, olc::vi2d size)
olc::FrostUI ui; // create the UI handler
// this will create the window but not store the window pointer
ui.create_window("window1", "TITLE HERE", { 10, 10 }, { 300, 200 });
// this will create the window and at the same time store the window pointer
auto window = ui.create_window("window1", "TITLE HERE", { 10, 10 }, { 300, 200 });If you don't want to store the window pointer when creating the window you can always use find_window(std::string& identifier) whenever you're in need of accessing the member functions of the FUI_Window class
auto window = ui.find_window("window1");
window->set_top_border_thickness(20); // changes the thickness of the window headerFollowing member functions are available for the FUI_Window class
olc::vi2d get_position() const; // gets the position of the window
olc::vi2d get_size() const; // gets the size of the window
olc::vi2d get_window_space() const; // gets the space within the window borders
std::string get_id() const; // gets the window identifier
int get_top_border_thickness() const; // gets the thickness of the window header (top border)
int get_border_thickness() const; // gets the thickness of the surrounding window border (all borders except for the top border)
void set_top_border_thickness(int thickness); // set the thickness of the window header (top border)
void set_border_thickness(int thickness); // set the thickness of the surrounding window border
void close_window(bool close); // close the window
bool get_closed_state() const; // get the closed state of the window
void change_position(olc::vi2d pos); // change the window position
void change_size(olc::vi2d s); // change the window size
void set_focused(bool state); // set the current window to the focused window (will be drawn ontop of other existing windows)
bool is_focused() const; // get the focused state of the current window