clean
Some checks are pending
Build Android / Game (Android, Release ARM64) (push) Waiting to run
Build iOS / Game (iOS, Release ARM64) (push) Waiting to run
Build Linux / Editor (Linux, Development x64) (push) Waiting to run
Build Linux / Game (Linux, Release x64) (push) Waiting to run
Build macOS / Editor (Mac, Development ARM64) (push) Waiting to run
Build macOS / Game (Mac, Release ARM64) (push) Waiting to run
Build Windows / Editor (Windows, Development x64) (push) Waiting to run
Build Windows / Game (Windows, Release x64) (push) Waiting to run
Cooker / Cook (Mac) (push) Waiting to run
Tests / Tests (Linux) (push) Waiting to run
Tests / Tests (Windows) (push) Waiting to run

This commit is contained in:
2025-01-20 20:12:06 +02:00
parent 692183e1dd
commit e676c75459

View File

@@ -218,18 +218,6 @@ void SDLPlatform::Tick()
SDLWindow* window = SDLWindow::GetWindowFromEvent(*event);
if (event->type == SDL_EVENT_WINDOW_EXPOSED)
{
/*SDL_Event mouseDownEvent{ 0 };
mouseDownEvent.button.type = SDL_EVENT_MOUSE_BUTTON_DOWN;
mouseDownEvent.button.down = true;
mouseDownEvent.button.timestamp = SDL_GetTicksNS();
mouseDownEvent.button.windowID = SDL_GetWindowID(window->GetSDLWindow());
mouseDownEvent.button.button = SDL_BUTTON_LEFT;
mouseDownEvent.button.clicks = 1;
mouseDownEvent.button.x = 0;//static_cast<float>(static_cast<LONG>(WINDOWS_GET_X_LPARAM(msg->lParam)));
mouseDownEvent.button.y = 0;//static_cast<float>(static_cast<LONG>(WINDOWS_GET_Y_LPARAM(msg->lParam)));
if (window)
window->HandleEvent(*event);*/
Engine::OnUpdate();//Scripting::Update(); // For docking updates
Engine::OnDraw();
return false;
@@ -248,17 +236,12 @@ void SDLPlatform::Tick()
return false;
}
/*else if (event->type == SDL_EVENT_MOUSE_BUTTON_UP)
{
LOG(Info, "ate SDL_EVENT_MOUSE_BUTTON_UP");
return false;
}*/
else if (event->type == SDL_EVENT_WINDOW_MOVED)
{
Float2 start = draggedWindowStartPosition;
Float2 newPos = Float2(static_cast<float>(event->window.data1), static_cast<float>(event->window.data2));
Float2 offset = newPos - start;
Float2 mousePos = draggedWindowMousePosition/* + offset*/;
Float2 mousePos = draggedWindowMousePosition;
SDL_Event mouseMovedEvent { 0 };
mouseMovedEvent.motion.type = SDL_EVENT_MOUSE_MOTION;
@@ -277,59 +260,10 @@ void SDLPlatform::Tick()
if (window)
window->HandleEvent(*event);
/*bool* dragging = (bool*)userdata;
if (event->type == SDL_EVENT_WINDOW_EXPOSED)
{
// This event is usually sent when the window is focused and requires redrawing,
// but we are more interested in these events when the window is being dragged,
// blocking the main thread during the drag operation. Assume the window is being
// dragged when we have received the event more than once per cycle.
bool result = true;
if (*dragging)
{
// Send a simulated mouse button down event, we can't tell when
// the real button down event arrives...
SDLWindow* window = SDLWindow::GetWindowFromEvent(*event);
SDL_Event mouseDownEvent{ 0 };
mouseDownEvent.button.type = SDL_EVENT_MOUSE_BUTTON_DOWN;
mouseDownEvent.button.down = true;
mouseDownEvent.button.timestamp = SDL_GetTicksNS();
mouseDownEvent.button.windowID = SDL_GetWindowID(window->GetSDLWindow());
mouseDownEvent.button.button = SDL_BUTTON_LEFT;
mouseDownEvent.button.clicks = 1;
mouseDownEvent.button.x = 0;//static_cast<float>(static_cast<LONG>(WINDOWS_GET_X_LPARAM(msg->lParam)));
mouseDownEvent.button.y = 0;//static_cast<float>(static_cast<LONG>(WINDOWS_GET_Y_LPARAM(msg->lParam)));
if (window)
window->HandleEvent(*event);
Engine::OnUpdate();//Scripting::Update(); // For docking updates
Engine::OnDraw();
return false;
}
else
*dragging = true;
return true;
}*/
/*else if (event->type == SDL_EVENT_MOUSE_BUTTON_DOWN && *dragging)
{
SDLWindow* window = SDLWindow::GetWindowFromEvent(*event);
if (window)
window->HandleEvent(*event);
return false;
}*/
/*if (dragging)
{
LOG(Info, "events during dragging: {}", event->type); // usually SDL_EVENT_WINDOW_MOVED
}*/
return true;
};
bool suc = SDL_AddEventWatch(watch, &draggedWindow);
if (!suc)
suc = suc;
SDL_AddEventWatch(watch, &draggedWindow);
SDL_PumpEvents();
SDL_Event events[32];