Show rectangle when selecting entities

This commit is contained in:
Jan Mrna
2025-10-12 16:04:40 +02:00
parent 4b3a4c53e8
commit d3af793092
7 changed files with 44 additions and 7 deletions

View File

@@ -84,13 +84,21 @@ void Window::DrawSprite(const WindowPos &position, Sprite &s, float scale) {
SDL_RenderTexture(m_Renderer.get(), s.GetTexture(), nullptr, &rect);
}
void Window::DrawRect(const WindowPos &position, const WindowSize size, uint8_t R,
void Window::DrawFilledRect(const WindowPos &position, const WindowSize size, uint8_t R,
uint8_t G, uint8_t B, uint8_t A) {
SDL_FRect rect = {position.x(), position.y(), size.x(), size.y()};
SDL_SetRenderDrawColor(m_Renderer.get(), R, G, B, A);
SDL_RenderFillRect(m_Renderer.get(), &rect);
}
void Window::DrawRect(const WindowPos &position, const WindowSize size, uint8_t R,
uint8_t G, uint8_t B, uint8_t fill_alpha) {
SDL_FRect rect = {position.x(), position.y(), size.x(), size.y()};
SDL_SetRenderDrawColor(m_Renderer.get(), R, G, B, 255);
SDL_RenderRect(m_Renderer.get(), &rect);
//SDL_RenderFillRect(m_Renderer.get(), &rect);
}
void Window::ClearWindow() {
SDL_SetRenderDrawColor(m_Renderer.get(), 50, 50, 50, 255);
SDL_RenderClear(m_Renderer.get());