// Copyright (c) 2023 Dominic Masters // // This software is released under the MIT License. // https://opensource.org/licenses/MIT #include "UIMenu.hpp" using namespace Dawn; void UIMenu::setPosition(int32_t x, int32_t y) { assertTrue(x >= 0, "X position must be greater than or equal to 0."); assertTrue(y >= 0, "Y position must be greater than or equal to 0."); assertTrue(x < columns, "X must be less than the number of columns."); assertTrue(y < rows, "Y must be less than the number of rows."); if(this->x == x && this->y == y) return; this->x = x; this->y = y; eventPositionChanged.emit(x, y); } void UIMenu::setSize(int32_t columns, int32_t rows) { assertTrue(columns > 0, "Columns must be greater than 0."); assertTrue(rows > 0, "Rows must be greater than 0."); assertTrue(columns > x, "Columns must be greater than current x position."); assertTrue(rows > y, "Rows must be greater than current y position."); if(this->columns == columns && this->rows == rows) return; this->columns = columns; this->rows = rows; } int32_t UIMenu::getX() { return x; } int32_t UIMenu::getY() { return y; } int32_t UIMenu::getColumns() { return columns; } int32_t UIMenu::getRows() { return rows; }