Skip to content
Snippets Groups Projects
Commit d604eceb authored by Joakim Hunskaar's avatar Joakim Hunskaar
Browse files

colour is now color, getters for dimensions are now const and renamed

parent 00971d1c
No related branches found
No related tags found
1 merge request!2added mousewheel support and marked functions as const
......@@ -41,7 +41,7 @@ class AnimationWindow {
private:
void show_frame();
void update_gui();
TDT4102::Point getWindowDimensions();
TDT4102::Point getWindowDimensions() const;
void startNuklearDraw(TDT4102::Point location, std::string uniqueWindowName, unsigned int width = 0, unsigned int height = 0);
void endNuklearDraw();
void destroy();
......@@ -54,7 +54,7 @@ class AnimationWindow {
std::vector<std::reference_wrapper<TDT4102::Widget>> widgets;
TDT4102::Color backgroundColour = TDT4102::Color::white;
TDT4102::Color backgroundColor = TDT4102::Color::white;
// SDL related context
SDL_Window* windowHandle = nullptr;
......@@ -120,8 +120,8 @@ class AnimationWindow {
void show_error_dialog(const std::string& message) const;
// Getters for the window dimensions
int windowWidth() const;
int windowHeight() const;
int get_width() const;
int get_height() const;
void setBackgroundColor(TDT4102::Color newBackgroundColor);
......
......@@ -41,7 +41,7 @@ TDT4102::AnimationWindow::AnimationWindow(int x, int y, int width, int height, c
}
// Default window background colour
SDL_SetRenderDrawColor(rendererHandle, backgroundColour.redChannel, backgroundColour.greenChannel, backgroundColour.blueChannel, backgroundColour.alphaChannel);
SDL_SetRenderDrawColor(rendererHandle, backgroundColor.redChannel, backgroundColor.greenChannel, backgroundColor.blueChannel, backgroundColor.alphaChannel);
SDL_RenderClear(rendererHandle);
SDL_RendererInfo rendererInfo;
......@@ -131,7 +131,7 @@ void TDT4102::AnimationWindow::next_frame() {
// Colour must be reset as a previously drawn element may have changed the current colour
if (!keepPreviousFrame) {
SDL_SetRenderDrawColor(rendererHandle, backgroundColour.redChannel, backgroundColour.greenChannel, backgroundColour.blueChannel, backgroundColour.alphaChannel);
SDL_SetRenderDrawColor(rendererHandle, backgroundColor.redChannel, backgroundColor.greenChannel, backgroundColor.blueChannel, backgroundColor.alphaChannel);
SDL_RenderClear(rendererHandle);
}
......@@ -331,17 +331,17 @@ void TDT4102::AnimationWindow::show_error_dialog(const std::string& message) con
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Error", message.c_str(), windowHandle);
}
TDT4102::Point TDT4102::AnimationWindow::getWindowDimensions() {
TDT4102::Point TDT4102::AnimationWindow::getWindowDimensions() const {
TDT4102::Point dimensions;
SDL_GetRendererOutputSize(rendererHandle, &dimensions.x, &dimensions.y);
return dimensions;
}
int TDT4102::AnimationWindow::windowWidth() const {
int TDT4102::AnimationWindow::get_width() const {
return getWindowDimensions().x;
}
int TDT4102::AnimationWindow::windowHeight() const {
int TDT4102::AnimationWindow::get_height() const {
return getWindowDimensions().y;
}
......@@ -397,5 +397,5 @@ void TDT4102::AnimationWindow::endNuklearDraw() {
}
void TDT4102::AnimationWindow::setBackgroundColor(TDT4102::Color newBackgroundColor) {
backgroundColour = newBackgroundColor;
backgroundColor = newBackgroundColor;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment