ci-platforms / darwin amd64 smoke (push) Skipped
GitHub / linux amd64 native GitHub-hosted native CI: success
ci-platforms / windows amd64 smoke (push) Skipped
GitHub / windows amd64 native GitHub-hosted native CI: success
GitHub / darwin arm64 native GitHub-hosted native CI: success
GitHub / darwin amd64 native GitHub-hosted native CI: success
ci / checks (push) Failing after 1h21m34s
ci / native-authoring (push) Skipped
ci-platforms / darwin arm64 smoke (push) Skipped
github-native / gitea-pending (push) Skipped
github-native / darwin amd64 native (push) Skipped
github-native / linux amd64 native (push) Skipped
github-native / windows amd64 native (push) Skipped
github-native / darwin arm64 native (push) Skipped
github-native / gitea-result (push) Skipped
ci / build (amd64, linux, ubuntu-24.04) (push) Successful in 12m4s
ci / release (push) Skipped
Add dockable Art tools, animation and previews, guarded asset workflows, and the Web Asset Studio built on the shared Art Core. Expand English and Russian documentation, interactive Try scenes, examples and editor icons. Add audio waveform navigation, source analysis, guarded previews and a browser Worker mixer. Preserve source changes and recovery with bounded checks, and strengthen native, browser and interoperability CI. Prepare version 0.12.5 and manually built native artifact candidates. Fix the production site image demo build dependency. Reuse immutable scene indices when capturing keyframes. Wait for real Persist save/load completion in component tests. Stabilize browser Game View captures outside pointer hover. Aseprite interchange and persistent Audio EDL recovery remain limited; the artifact workflow does not publish releases or change stable.
121 lines
3.2 KiB
Go
121 lines
3.2 KiB
Go
//go:build aego_gltest && linux && cgo && !aego_nonative
|
|
|
|
package sdl
|
|
|
|
/*
|
|
#include <SDL3/SDL.h>
|
|
#include <stdlib.h>
|
|
|
|
// SDL_Event is a union. Clear the whole object, including fields of the
|
|
// selected event variant, before pushing a synthetic event.
|
|
static float test_pointer_x, test_pointer_y;
|
|
static bool push_pointer(float x,float y,int kind,int button) {
|
|
SDL_Event e;
|
|
SDL_zero(e);
|
|
if (kind == 0) {
|
|
e.type = SDL_EVENT_MOUSE_MOTION;
|
|
e.motion.x = x;
|
|
e.motion.y = y;
|
|
e.motion.xrel = x - test_pointer_x;
|
|
e.motion.yrel = y - test_pointer_y;
|
|
} else {
|
|
e.type = kind == 1 ? SDL_EVENT_MOUSE_BUTTON_DOWN : SDL_EVENT_MOUSE_BUTTON_UP;
|
|
e.button.x = x;
|
|
e.button.y = y;
|
|
e.button.button = button;
|
|
e.button.down = kind == 1;
|
|
e.button.clicks = 1;
|
|
}
|
|
bool pushed = SDL_PushEvent(&e);
|
|
if (pushed) {
|
|
test_pointer_x = x;
|
|
test_pointer_y = y;
|
|
}
|
|
return pushed;
|
|
}
|
|
static bool push_edit_key(int scan, bool down, bool ctrl, bool shift) {
|
|
SDL_Event e;
|
|
SDL_zero(e);
|
|
e.type = down ? SDL_EVENT_KEY_DOWN : SDL_EVENT_KEY_UP;
|
|
e.key.scancode = (SDL_Scancode)scan;
|
|
e.key.down = down;
|
|
e.key.mod = (ctrl ? SDL_KMOD_CTRL : 0) | (shift ? SDL_KMOD_SHIFT : 0);
|
|
return SDL_PushEvent(&e);
|
|
}
|
|
|
|
static bool push_wheel(float x, float y, float steps) {
|
|
SDL_Event e;
|
|
SDL_zero(e);
|
|
e.type = SDL_EVENT_MOUSE_WHEEL;
|
|
e.wheel.mouse_x = x;
|
|
e.wheel.mouse_y = y;
|
|
e.wheel.y = steps;
|
|
return SDL_PushEvent(&e);
|
|
}
|
|
// SDL3's text event holds a pointer. Keep storage alive until the test drives
|
|
// the next event loop step; tests push one text event at a time.
|
|
static char test_text[256];
|
|
static bool push_text(const char *text) {
|
|
SDL_Event e;
|
|
SDL_zero(e);
|
|
if (SDL_strlen(text) >= sizeof(test_text)) return false;
|
|
SDL_strlcpy(test_text, text, sizeof(test_text));
|
|
e.type = SDL_EVENT_TEXT_INPUT;
|
|
e.text.text = test_text;
|
|
return SDL_PushEvent(&e);
|
|
}
|
|
// Keep the dropped path alive until SDL has delivered the queued events.
|
|
static char test_drop[4096];
|
|
static bool push_drop_file(const char *path, float x, float y) {
|
|
SDL_Event e;
|
|
if (SDL_strlen(path) >= sizeof(test_drop)) return false;
|
|
SDL_strlcpy(test_drop, path, sizeof(test_drop));
|
|
SDL_zero(e);
|
|
e.type = SDL_EVENT_DROP_FILE;
|
|
e.drop.x = x;
|
|
e.drop.y = y;
|
|
e.drop.data = test_drop;
|
|
if (!SDL_PushEvent(&e)) return false;
|
|
SDL_zero(e);
|
|
e.type = SDL_EVENT_DROP_COMPLETE;
|
|
e.drop.x = x;
|
|
e.drop.y = y;
|
|
return SDL_PushEvent(&e);
|
|
}
|
|
*/
|
|
import "C"
|
|
|
|
import (
|
|
"unsafe"
|
|
|
|
"aego/platform/input"
|
|
)
|
|
|
|
func TestPointerEvent(x, y float32, kind int) bool {
|
|
return bool(C.push_pointer(C.float(x), C.float(y), C.int(kind), C.SDL_BUTTON_LEFT))
|
|
}
|
|
|
|
func TestRightPointerEvent(x, y float32, kind int) bool {
|
|
return bool(C.push_pointer(C.float(x), C.float(y), C.int(kind), C.SDL_BUTTON_RIGHT))
|
|
}
|
|
|
|
func TestEditKey(k input.Scancode, down, ctrl, shift bool) bool {
|
|
return bool(C.push_edit_key(C.int(k), C.bool(down), C.bool(ctrl), C.bool(shift)))
|
|
}
|
|
|
|
func TestWheelEvent(x, y, steps float32) bool {
|
|
return bool(C.push_wheel(C.float(x), C.float(y), C.float(steps)))
|
|
}
|
|
|
|
func TestTextInput(text string) bool {
|
|
c := C.CString(text)
|
|
defer C.free(unsafe.Pointer(c))
|
|
return bool(C.push_text(c))
|
|
}
|
|
|
|
func TestDropFile(path string, x, y float32) bool {
|
|
c := C.CString(path)
|
|
defer C.free(unsafe.Pointer(c))
|
|
return bool(C.push_drop_file(c, C.float(x), C.float(y)))
|
|
}
|