mirror of
https://github.com/IllusionMan1212/O2048.git
synced 2026-10-24 10:12:37 +00:00
update for latest odin
This commit is contained in:
@@ -571,8 +571,8 @@ game_loop :: proc() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
update_emitters :: proc(delta_t: time.Duration) {
|
update_emitters :: proc(delta_t: time.Duration) {
|
||||||
for row in &game.board {
|
for &row in game.board {
|
||||||
for tile in &row {
|
for &tile in row {
|
||||||
update_emitter(delta_t, &tile.emitter)
|
update_emitter(delta_t, &tile.emitter)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
// +build linux
|
#+build linux
|
||||||
package glx
|
package glx
|
||||||
|
|
||||||
import x11 "vendor:x11/xlib"
|
import x11 "vendor:x11/xlib"
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
// +build linux
|
#+build linux
|
||||||
package glx
|
package glx
|
||||||
|
|
||||||
import x11 "vendor:x11/xlib"
|
import x11 "vendor:x11/xlib"
|
||||||
|
|||||||
+1
-1
@@ -33,7 +33,7 @@ particle_time: time.Duration = 0
|
|||||||
update_particles :: proc(delta_t: time.Duration, particles: ^[MAX_PARTICLES]Particle, start_pos: zephr.Vec2) {
|
update_particles :: proc(delta_t: time.Duration, particles: ^[MAX_PARTICLES]Particle, start_pos: zephr.Vec2) {
|
||||||
delta_t_f := cast(f32)time.duration_seconds(delta_t)
|
delta_t_f := cast(f32)time.duration_seconds(delta_t)
|
||||||
|
|
||||||
for p in particles {
|
for &p in particles {
|
||||||
p.life -= delta_t
|
p.life -= delta_t
|
||||||
if p.life <= 0 {
|
if p.life <= 0 {
|
||||||
continue
|
continue
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// +build linux
|
#+build linux
|
||||||
package xcursor
|
package xcursor
|
||||||
|
|
||||||
import x11 "vendor:x11/xlib"
|
import x11 "vendor:x11/xlib"
|
||||||
|
|||||||
+62
-62
@@ -1,5 +1,5 @@
|
|||||||
// +build linux
|
#+build linux
|
||||||
// +private
|
#+private
|
||||||
package zephr
|
package zephr
|
||||||
|
|
||||||
import "core:log"
|
import "core:log"
|
||||||
@@ -41,20 +41,20 @@ x11_go_fullscreen :: proc() {
|
|||||||
// remove the resizing constraint before going fullscreen so WMs such as gnome
|
// remove the resizing constraint before going fullscreen so WMs such as gnome
|
||||||
// can add the _NET_WM_ACTION_FULLSCREEN action to the _NET_WM_ALLOWED_ACTIONS atom
|
// can add the _NET_WM_ACTION_FULLSCREEN action to the _NET_WM_ALLOWED_ACTIONS atom
|
||||||
// and properly fullscreen the window
|
// and properly fullscreen the window
|
||||||
size_hints := x11.XAllocSizeHints()
|
size_hints := x11.AllocSizeHints()
|
||||||
|
|
||||||
zephr_ctx.window.pre_fullscreen_size = zephr_ctx.window.size
|
zephr_ctx.window.pre_fullscreen_size = zephr_ctx.window.size
|
||||||
if (size_hints != nil) {
|
if (size_hints != nil) {
|
||||||
size_hints.flags = {.PPosition, .PSize}
|
size_hints.flags = {.PPosition, .PSize}
|
||||||
size_hints.width = cast(i32)zephr_ctx.window.size.x
|
size_hints.width = cast(i32)zephr_ctx.window.size.x
|
||||||
size_hints.height = cast(i32)zephr_ctx.window.size.y
|
size_hints.height = cast(i32)zephr_ctx.window.size.y
|
||||||
x11.XSetWMNormalHints(x11_display, x11_window, size_hints)
|
x11.SetWMNormalHints(x11_display, x11_window, size_hints)
|
||||||
x11.XFree(size_hints)
|
x11.Free(size_hints)
|
||||||
}
|
}
|
||||||
|
|
||||||
xev: x11.XEvent
|
xev: x11.XEvent
|
||||||
wm_state := x11.XInternAtom(x11_display, "_NET_WM_STATE", false)
|
wm_state := x11.InternAtom(x11_display, "_NET_WM_STATE", false)
|
||||||
fullscreen := x11.XInternAtom(x11_display, "_NET_WM_STATE_FULLSCREEN", false)
|
fullscreen := x11.InternAtom(x11_display, "_NET_WM_STATE_FULLSCREEN", false)
|
||||||
xev.type = .ClientMessage
|
xev.type = .ClientMessage
|
||||||
xev.xclient.window = x11_window
|
xev.xclient.window = x11_window
|
||||||
xev.xclient.message_type = wm_state
|
xev.xclient.message_type = wm_state
|
||||||
@@ -62,15 +62,15 @@ x11_go_fullscreen :: proc() {
|
|||||||
xev.xclient.data.l[0] = 1 // _NET_WM_STATE_ADD
|
xev.xclient.data.l[0] = 1 // _NET_WM_STATE_ADD
|
||||||
xev.xclient.data.l[1] = cast(int)fullscreen
|
xev.xclient.data.l[1] = cast(int)fullscreen
|
||||||
xev.xclient.data.l[2] = 0
|
xev.xclient.data.l[2] = 0
|
||||||
x11.XSendEvent(x11_display, x11.XDefaultRootWindow(x11_display), false,
|
x11.SendEvent(x11_display, x11.DefaultRootWindow(x11_display), false,
|
||||||
{.SubstructureNotify, .SubstructureRedirect}, &xev)
|
{.SubstructureNotify, .SubstructureRedirect}, &xev)
|
||||||
}
|
}
|
||||||
|
|
||||||
@(private="file")
|
@(private="file")
|
||||||
x11_return_fullscreen :: proc() {
|
x11_return_fullscreen :: proc() {
|
||||||
xev: x11.XEvent
|
xev: x11.XEvent
|
||||||
wm_state := x11.XInternAtom(x11_display, "_NET_WM_STATE", false)
|
wm_state := x11.InternAtom(x11_display, "_NET_WM_STATE", false)
|
||||||
fullscreen := x11.XInternAtom(x11_display, "_NET_WM_STATE_FULLSCREEN", false)
|
fullscreen := x11.InternAtom(x11_display, "_NET_WM_STATE_FULLSCREEN", false)
|
||||||
xev.type = .ClientMessage
|
xev.type = .ClientMessage
|
||||||
xev.xclient.window = x11_window
|
xev.xclient.window = x11_window
|
||||||
xev.xclient.message_type = wm_state
|
xev.xclient.message_type = wm_state
|
||||||
@@ -78,12 +78,12 @@ x11_return_fullscreen :: proc() {
|
|||||||
xev.xclient.data.l[0] = 0 // _NET_WM_STATE_REMOVE
|
xev.xclient.data.l[0] = 0 // _NET_WM_STATE_REMOVE
|
||||||
xev.xclient.data.l[1] = cast(int)fullscreen
|
xev.xclient.data.l[1] = cast(int)fullscreen
|
||||||
xev.xclient.data.l[2] = 0
|
xev.xclient.data.l[2] = 0
|
||||||
x11.XSendEvent(x11_display, x11.XDefaultRootWindow(x11_display), false,
|
x11.SendEvent(x11_display, x11.DefaultRootWindow(x11_display), false,
|
||||||
{.SubstructureNotify, .SubstructureRedirect}, &xev)
|
{.SubstructureNotify, .SubstructureRedirect}, &xev)
|
||||||
|
|
||||||
// restore the resizing constraint as well as the pre-fullscreen window size
|
// restore the resizing constraint as well as the pre-fullscreen window size
|
||||||
// when returning from fullscreen
|
// when returning from fullscreen
|
||||||
size_hints := x11.XAllocSizeHints()
|
size_hints := x11.AllocSizeHints()
|
||||||
|
|
||||||
if (size_hints != nil) {
|
if (size_hints != nil) {
|
||||||
size_hints.flags = {.PPosition, .PSize}
|
size_hints.flags = {.PPosition, .PSize}
|
||||||
@@ -96,8 +96,8 @@ x11_return_fullscreen :: proc() {
|
|||||||
size_hints.max_width = cast(i32)zephr_ctx.window.pre_fullscreen_size.x
|
size_hints.max_width = cast(i32)zephr_ctx.window.pre_fullscreen_size.x
|
||||||
size_hints.max_height = cast(i32)zephr_ctx.window.pre_fullscreen_size.y
|
size_hints.max_height = cast(i32)zephr_ctx.window.pre_fullscreen_size.y
|
||||||
}
|
}
|
||||||
x11.XSetWMNormalHints(x11_display, x11_window, size_hints)
|
x11.SetWMNormalHints(x11_display, x11_window, size_hints)
|
||||||
x11.XFree(size_hints)
|
x11.Free(size_hints)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -129,12 +129,12 @@ x11_assign_window_icon :: proc(icon_path: cstring, window_title: cstring) {
|
|||||||
data[i + 2] = (cast(u64)icon_data[i * 4] << 16) | (cast(u64)icon_data[i * 4 + 1] << 8) | (cast(u64)icon_data[i * 4 + 2] << 0) | (cast(u64)icon_data[i * 4 + 3] << 24)
|
data[i + 2] = (cast(u64)icon_data[i * 4] << 16) | (cast(u64)icon_data[i * 4 + 1] << 8) | (cast(u64)icon_data[i * 4 + 2] << 0) | (cast(u64)icon_data[i * 4 + 3] << 24)
|
||||||
}
|
}
|
||||||
|
|
||||||
net_wm_icon := x11.XInternAtom(x11_display, "_NET_WM_ICON", false)
|
net_wm_icon := x11.InternAtom(x11_display, "_NET_WM_ICON", false)
|
||||||
x11.XChangeProperty(x11_display, x11_window, net_wm_icon, XA_CARDINAL, 32, PropModeReplace, raw_data(data), target_size)
|
x11.ChangeProperty(x11_display, x11_window, net_wm_icon, XA_CARDINAL, 32, PropModeReplace, raw_data(data), target_size)
|
||||||
}
|
}
|
||||||
|
|
||||||
backend_get_screen_size :: proc() -> Vec2 {
|
backend_get_screen_size :: proc() -> Vec2 {
|
||||||
screen := x11.XDefaultScreenOfDisplay(x11_display)
|
screen := x11.DefaultScreenOfDisplay(x11_display)
|
||||||
|
|
||||||
return Vec2{cast(f32)screen.width, cast(f32)screen.height}
|
return Vec2{cast(f32)screen.width, cast(f32)screen.height}
|
||||||
}
|
}
|
||||||
@@ -142,38 +142,38 @@ backend_get_screen_size :: proc() -> Vec2 {
|
|||||||
@(private="file")
|
@(private="file")
|
||||||
x11_resize_window :: proc() {
|
x11_resize_window :: proc() {
|
||||||
win_attrs : x11.XWindowAttributes
|
win_attrs : x11.XWindowAttributes
|
||||||
x11.XGetWindowAttributes(x11_display, x11_window, &win_attrs)
|
x11.GetWindowAttributes(x11_display, x11_window, &win_attrs)
|
||||||
gl.Viewport(0, 0, win_attrs.width, win_attrs.height)
|
gl.Viewport(0, 0, win_attrs.width, win_attrs.height)
|
||||||
}
|
}
|
||||||
|
|
||||||
@(private="file")
|
@(private="file")
|
||||||
x11_create_window :: proc(window_title: cstring, window_size: Vec2, icon_path: cstring, window_non_resizable: bool) {
|
x11_create_window :: proc(window_title: cstring, window_size: Vec2, icon_path: cstring, window_non_resizable: bool) {
|
||||||
context.logger = logger
|
context.logger = logger
|
||||||
x11_display = x11.XOpenDisplay(nil)
|
x11_display = x11.OpenDisplay(nil)
|
||||||
|
|
||||||
if x11_display == nil {
|
if x11_display == nil {
|
||||||
log.error("Failed to open X11 display")
|
log.error("Failed to open X11 display")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
screen_num := x11.XDefaultScreen(x11_display)
|
screen_num := x11.DefaultScreen(x11_display)
|
||||||
root := x11.XRootWindow(x11_display, screen_num)
|
root := x11.RootWindow(x11_display, screen_num)
|
||||||
visual := x11.XDefaultVisual(x11_display, screen_num)
|
visual := x11.DefaultVisual(x11_display, screen_num)
|
||||||
|
|
||||||
x11_colormap = x11.XCreateColormap(x11_display, root, visual, x11.ColormapAlloc.AllocNone)
|
x11_colormap = x11.CreateColormap(x11_display, root, visual, x11.ColormapAlloc.AllocNone)
|
||||||
|
|
||||||
attributes: x11.XSetWindowAttributes
|
attributes: x11.XSetWindowAttributes
|
||||||
attributes.event_mask = {.Exposure, .KeyPress, .KeyRelease,
|
attributes.event_mask = {.Exposure, .KeyPress, .KeyRelease,
|
||||||
.StructureNotify, .ButtonPress, .ButtonRelease, .PointerMotion}
|
.StructureNotify, .ButtonPress, .ButtonRelease, .PointerMotion}
|
||||||
attributes.colormap = x11_colormap
|
attributes.colormap = x11_colormap
|
||||||
|
|
||||||
screen := x11.XDefaultScreenOfDisplay(x11_display)
|
screen := x11.DefaultScreenOfDisplay(x11_display)
|
||||||
|
|
||||||
window_start_x := screen.width / 2 - cast(i32)window_size.x / 2
|
window_start_x := screen.width / 2 - cast(i32)window_size.x / 2
|
||||||
window_start_y := screen.height / 2 - cast(i32)window_size.y / 2
|
window_start_y := screen.height / 2 - cast(i32)window_size.y / 2
|
||||||
|
|
||||||
x11_window = x11.XCreateWindow(x11_display, root, window_start_x, window_start_y, cast(u32)window_size.x, cast(u32)window_size.y, 0,
|
x11_window = x11.CreateWindow(x11_display, root, window_start_x, window_start_y, cast(u32)window_size.x, cast(u32)window_size.y, 0,
|
||||||
x11.XDefaultDepth(x11_display), .InputOutput, visual,
|
x11.DefaultDepth(x11_display, x11.DefaultScreen(x11_display)), .InputOutput, visual,
|
||||||
{.CWColormap, .CWEventMask}, &attributes)
|
{.CWColormap, .CWEventMask}, &attributes)
|
||||||
|
|
||||||
if (icon_path != "") {
|
if (icon_path != "") {
|
||||||
@@ -182,47 +182,47 @@ x11_create_window :: proc(window_title: cstring, window_size: Vec2, icon_path: c
|
|||||||
|
|
||||||
// Hints to the WM that the window is a normal window
|
// Hints to the WM that the window is a normal window
|
||||||
// Of course this is only a hint and the WM can ignore it
|
// Of course this is only a hint and the WM can ignore it
|
||||||
net_wm_window_type := x11.XInternAtom(x11_display, "_NET_WM_WINDOW_TYPE", false)
|
net_wm_window_type := x11.InternAtom(x11_display, "_NET_WM_WINDOW_TYPE", false)
|
||||||
net_wm_window_type_normal := x11.XInternAtom(x11_display, "_NET_WM_WINDOW_TYPE_NORMAL", false)
|
net_wm_window_type_normal := x11.InternAtom(x11_display, "_NET_WM_WINDOW_TYPE_NORMAL", false)
|
||||||
x11.XChangeProperty(x11_display, x11_window, net_wm_window_type, XA_ATOM, 32, PropModeReplace, &net_wm_window_type_normal, 1)
|
x11.ChangeProperty(x11_display, x11_window, net_wm_window_type, XA_ATOM, 32, PropModeReplace, &net_wm_window_type_normal, 1)
|
||||||
|
|
||||||
wm_delete_window := x11.XInternAtom(x11_display, "WM_DELETE_WINDOW", false)
|
wm_delete_window := x11.InternAtom(x11_display, "WM_DELETE_WINDOW", false)
|
||||||
x11.XSetWMProtocols(x11_display, x11_window, &wm_delete_window, 1)
|
x11.SetWMProtocols(x11_display, x11_window, &wm_delete_window, 1)
|
||||||
window_delete_atom = wm_delete_window
|
window_delete_atom = wm_delete_window
|
||||||
|
|
||||||
// set window name
|
// set window name
|
||||||
{
|
{
|
||||||
UTF8_STRING := x11.XInternAtom(x11_display, "UTF8_STRING", false)
|
UTF8_STRING := x11.InternAtom(x11_display, "UTF8_STRING", false)
|
||||||
x11.XStoreName(x11_display, x11_window, window_title)
|
x11.StoreName(x11_display, x11_window, window_title)
|
||||||
text_property: x11.XTextProperty
|
text_property: x11.XTextProperty
|
||||||
text_property.value = raw_data(string(window_title))
|
text_property.value = raw_data(string(window_title))
|
||||||
text_property.format = 8
|
text_property.format = 8
|
||||||
text_property.encoding = UTF8_STRING
|
text_property.encoding = UTF8_STRING
|
||||||
text_property.nitems = len(window_title)
|
text_property.nitems = len(window_title)
|
||||||
x11.XSetWMName(x11_display, x11_window, &text_property)
|
x11.SetWMName(x11_display, x11_window, &text_property)
|
||||||
net_wm_name := x11.XInternAtom(x11_display, "_NET_WM_NAME", false)
|
net_wm_name := x11.InternAtom(x11_display, "_NET_WM_NAME", false)
|
||||||
wm_class := x11.XInternAtom(x11_display, "WM_CLASS", false)
|
wm_class := x11.InternAtom(x11_display, "WM_CLASS", false)
|
||||||
x11.XChangeProperty(x11_display, x11_window, net_wm_name, UTF8_STRING, 8, PropModeReplace, raw_data(string(window_title)), cast(i32)len(window_title))
|
x11.ChangeProperty(x11_display, x11_window, net_wm_name, UTF8_STRING, 8, PropModeReplace, raw_data(string(window_title)), cast(i32)len(window_title))
|
||||||
x11.XChangeProperty(x11_display, x11_window, wm_class, XA_STRING, 8, PropModeReplace, raw_data(string(window_title)), cast(i32)len(window_title))
|
x11.ChangeProperty(x11_display, x11_window, wm_class, XA_STRING, 8, PropModeReplace, raw_data(string(window_title)), cast(i32)len(window_title))
|
||||||
|
|
||||||
// name to be displayed when the window is reduced to an icon
|
// name to be displayed when the window is reduced to an icon
|
||||||
net_wm_icon_name := x11.XInternAtom(x11_display, "_NET_WM_ICON_NAME", false)
|
net_wm_icon_name := x11.InternAtom(x11_display, "_NET_WM_ICON_NAME", false)
|
||||||
x11.XChangeProperty(x11_display, x11_window, net_wm_icon_name, UTF8_STRING, 8, PropModeReplace, raw_data(string(window_title)), cast(i32)len(window_title))
|
x11.ChangeProperty(x11_display, x11_window, net_wm_icon_name, UTF8_STRING, 8, PropModeReplace, raw_data(string(window_title)), cast(i32)len(window_title))
|
||||||
|
|
||||||
text_property.encoding = XA_STRING
|
text_property.encoding = XA_STRING
|
||||||
x11.XSetWMIconName(x11_display, x11_window, &text_property)
|
x11.SetWMIconName(x11_display, x11_window, &text_property)
|
||||||
|
|
||||||
class_hint := x11.XAllocClassHint()
|
class_hint := x11.AllocClassHint()
|
||||||
|
|
||||||
if (class_hint != nil) {
|
if (class_hint != nil) {
|
||||||
class_hint.res_name = window_title
|
class_hint.res_name = window_title
|
||||||
class_hint.res_class = window_title
|
class_hint.res_class = window_title
|
||||||
x11.XSetClassHint(x11_display, x11_window, class_hint)
|
x11.SetClassHint(x11_display, x11_window, class_hint)
|
||||||
x11.XFree(class_hint)
|
x11.Free(class_hint)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
size_hints := x11.XAllocSizeHints()
|
size_hints := x11.AllocSizeHints()
|
||||||
|
|
||||||
if (size_hints != nil) {
|
if (size_hints != nil) {
|
||||||
size_hints.flags = {.PPosition, .PSize}
|
size_hints.flags = {.PPosition, .PSize}
|
||||||
@@ -238,11 +238,11 @@ x11_create_window :: proc(window_title: cstring, window_size: Vec2, icon_path: c
|
|||||||
size_hints.max_width = cast(i32)window_size.x
|
size_hints.max_width = cast(i32)window_size.x
|
||||||
size_hints.max_height = cast(i32)window_size.y
|
size_hints.max_height = cast(i32)window_size.y
|
||||||
}
|
}
|
||||||
x11.XSetWMNormalHints(x11_display, x11_window, size_hints)
|
x11.SetWMNormalHints(x11_display, x11_window, size_hints)
|
||||||
x11.XFree(size_hints)
|
x11.Free(size_hints)
|
||||||
}
|
}
|
||||||
|
|
||||||
x11.XMapWindow(x11_display, x11_window)
|
x11.MapWindow(x11_display, x11_window)
|
||||||
|
|
||||||
gl.load_up_to(3, 3, proc(p: rawptr, name: cstring) { (cast(^rawptr)p)^ = glx.GetProcAddressARB(raw_data(string(name))) })
|
gl.load_up_to(3, 3, proc(p: rawptr, name: cstring) { (cast(^rawptr)p)^ = glx.GetProcAddressARB(raw_data(string(name))) })
|
||||||
|
|
||||||
@@ -294,7 +294,7 @@ x11_create_window :: proc(window_title: cstring, window_size: Vec2, icon_path: c
|
|||||||
gl.BlendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA)
|
gl.BlendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA)
|
||||||
x11_resize_window()
|
x11_resize_window()
|
||||||
|
|
||||||
x11.XFree(fbc)
|
x11.Free(fbc)
|
||||||
}
|
}
|
||||||
|
|
||||||
backend_init :: proc(window_title: cstring, window_size: Vec2, icon_path: cstring, window_non_resizable: bool) {
|
backend_init :: proc(window_title: cstring, window_size: Vec2, icon_path: cstring, window_non_resizable: bool) {
|
||||||
@@ -305,9 +305,9 @@ backend_shutdown :: proc() {
|
|||||||
glx.MakeCurrent(x11_display, 0, nil)
|
glx.MakeCurrent(x11_display, 0, nil)
|
||||||
glx.DestroyContext(x11_display, glx_context)
|
glx.DestroyContext(x11_display, glx_context)
|
||||||
|
|
||||||
x11.XDestroyWindow(x11_display, x11_window)
|
x11.DestroyWindow(x11_display, x11_window)
|
||||||
x11.XFreeColormap(x11_display, x11_colormap)
|
x11.FreeColormap(x11_display, x11_colormap)
|
||||||
x11.XCloseDisplay(x11_display)
|
x11.CloseDisplay(x11_display)
|
||||||
}
|
}
|
||||||
|
|
||||||
backend_swapbuffers :: proc() {
|
backend_swapbuffers :: proc() {
|
||||||
@@ -320,8 +320,8 @@ backend_get_os_events :: proc(e_out: ^Event) -> bool {
|
|||||||
context.logger = logger
|
context.logger = logger
|
||||||
xev: x11.XEvent
|
xev: x11.XEvent
|
||||||
|
|
||||||
for (cast(bool)x11.XPending(x11_display)) {
|
for (cast(bool)x11.Pending(x11_display)) {
|
||||||
x11.XNextEvent(x11_display, &xev)
|
x11.NextEvent(x11_display, &xev)
|
||||||
|
|
||||||
if xev.type == .ConfigureNotify {
|
if xev.type == .ConfigureNotify {
|
||||||
xce := xev.xconfigure
|
xce := xev.xconfigure
|
||||||
@@ -440,7 +440,7 @@ backend_get_os_events :: proc(e_out: ^Event) -> bool {
|
|||||||
if (xev.xmapping.request != .MappingKeyboard) {
|
if (xev.xmapping.request != .MappingKeyboard) {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
x11.XRefreshKeyboardMapping(&xev.xmapping)
|
x11.RefreshKeyboardMapping(&xev.xmapping)
|
||||||
/* x11_keyboard_map_update(); */
|
/* x11_keyboard_map_update(); */
|
||||||
break
|
break
|
||||||
} else if xev.type == .MotionNotify {
|
} else if xev.type == .MotionNotify {
|
||||||
@@ -456,16 +456,16 @@ backend_get_os_events :: proc(e_out: ^Event) -> bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
backend_set_cursor :: proc() {
|
backend_set_cursor :: proc() {
|
||||||
x11.XDefineCursor(x11_display, x11_window, zephr_ctx.cursors[zephr_ctx.cursor])
|
x11.DefineCursor(x11_display, x11_window, zephr_ctx.cursors[zephr_ctx.cursor])
|
||||||
}
|
}
|
||||||
|
|
||||||
backend_init_cursors :: proc() {
|
backend_init_cursors :: proc() {
|
||||||
zephr_ctx.cursors[.ARROW] = x11.XCreateFontCursor(x11_display, .XC_left_ptr)
|
zephr_ctx.cursors[.ARROW] = x11.CreateFontCursor(x11_display, .XC_left_ptr)
|
||||||
zephr_ctx.cursors[.IBEAM] = x11.XCreateFontCursor(x11_display, .XC_xterm)
|
zephr_ctx.cursors[.IBEAM] = x11.CreateFontCursor(x11_display, .XC_xterm)
|
||||||
zephr_ctx.cursors[.CROSSHAIR] = x11.XCreateFontCursor(x11_display, .XC_crosshair)
|
zephr_ctx.cursors[.CROSSHAIR] = x11.CreateFontCursor(x11_display, .XC_crosshair)
|
||||||
zephr_ctx.cursors[.HAND] = x11.XCreateFontCursor(x11_display, .XC_hand1)
|
zephr_ctx.cursors[.HAND] = x11.CreateFontCursor(x11_display, .XC_hand1)
|
||||||
zephr_ctx.cursors[.HRESIZE] = x11.XCreateFontCursor(x11_display, .XC_sb_h_double_arrow)
|
zephr_ctx.cursors[.HRESIZE] = x11.CreateFontCursor(x11_display, .XC_sb_h_double_arrow)
|
||||||
zephr_ctx.cursors[.VRESIZE] = x11.XCreateFontCursor(x11_display, .XC_sb_v_double_arrow)
|
zephr_ctx.cursors[.VRESIZE] = x11.CreateFontCursor(x11_display, .XC_sb_v_double_arrow)
|
||||||
|
|
||||||
// non-standard cursors
|
// non-standard cursors
|
||||||
zephr_ctx.cursors[.DISABLED] = xcursor.LibraryLoadCursor(x11_display, "crossed_circle")
|
zephr_ctx.cursors[.DISABLED] = xcursor.LibraryLoadCursor(x11_display, "crossed_circle")
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package zephr
|
package zephr
|
||||||
|
|
||||||
|
import "base:intrinsics"
|
||||||
import "core:math"
|
import "core:math"
|
||||||
import "core:intrinsics"
|
|
||||||
|
|
||||||
Vec2 :: [2]f32
|
Vec2 :: [2]f32
|
||||||
Vec3 :: [3]f32
|
Vec3 :: [3]f32
|
||||||
|
|||||||
Reference in New Issue
Block a user