Fixed selection rectangle glitch
This commit is contained in:
parent
d3af793092
commit
1ce793c6e8
@ -57,7 +57,7 @@ void GameLoop::Draw() {
|
||||
if (m_Game->IsSelectionBoxActive())
|
||||
{
|
||||
const auto& [corner_pos, size] = m_Game->GetSelectionBoxPosSize();
|
||||
m_Window->DrawRect(corner_pos, size, 200, 20, 20, 100);
|
||||
m_Window->DrawRect(corner_pos, size, 200, 20, 20);
|
||||
}
|
||||
|
||||
|
||||
|
@ -207,6 +207,7 @@ void PathFindingDemo::HandleActions(const std::vector<UserAction> &actions)
|
||||
{
|
||||
m_SelectionBox.active = true;
|
||||
m_SelectionBox.start = action.Argument.position;
|
||||
m_SelectionBox.end = action.Argument.position;
|
||||
}
|
||||
else if (action.type == UserAction::Type::SELECTION_END)
|
||||
{
|
||||
|
@ -91,12 +91,10 @@ void Window::DrawFilledRect(const WindowPos &position, const WindowSize size, ui
|
||||
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) {
|
||||
void Window::DrawRect(const WindowPos &position, const WindowSize size, uint8_t R, uint8_t G, uint8_t B) {
|
||||
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() {
|
||||
|
@ -25,8 +25,7 @@ public:
|
||||
void DrawSprite(const WindowPos &position, Sprite &s, float scale = 1.0f);
|
||||
void DrawFilledRect(const WindowPos &position, const WindowSize size, uint8_t R,
|
||||
uint8_t G, uint8_t B, uint8_t A);
|
||||
void DrawRect(const WindowPos &position, const WindowSize size, uint8_t R,
|
||||
uint8_t G, uint8_t B, uint8_t fill_alpha);
|
||||
void DrawRect(const WindowPos &position, const WindowSize size, uint8_t R, uint8_t G, uint8_t B);
|
||||
void ClearWindow();
|
||||
void Flush();
|
||||
void DrawCircle(const WindowPos &position, float radius);
|
||||
|
Loading…
x
Reference in New Issue
Block a user