GUI/src/Statusbar.cpp

25 lines
794 B
C++

#include "GUI_Window.hpp"
#include "Statusbar.hpp"
/** The constructor of Statusbar has to get additional parameters.
* @param x: The mouse-position on the x-axis.
* @param y: The mouse-position on the y-axis:
* @param w: The width of a single pixel,
* @param h: The height of a single pixel.
*/
Statusbar::Statusbar(int x, int y, int w, int h, char *text) : Fl_Box(x, y, w, h, text) {
}
char *get_resolution(int window_width, int window_height) {
char *resolution = new char[25];
std::string str_temp;
strcpy(resolution, "Resolution:");
str_temp = std::to_string(window_width);
strcat(resolution, str_temp.c_str());
strcat(resolution, " x ");
str_temp = std::to_string(window_height);
strcat(resolution, str_temp.c_str());
return resolution;
}