mirror of
https://github.com/IllusionMan1212/O2048.git
synced 2026-10-24 10:12:37 +00:00
zephr/os: fix up linux build
This commit is contained in:
+8
-8
@@ -145,7 +145,7 @@ FT_CharMapRec_ :: struct {
|
|||||||
@private
|
@private
|
||||||
FT_CharMap :: ^FT_CharMapRec_
|
FT_CharMap :: ^FT_CharMapRec_
|
||||||
|
|
||||||
#assert(size_of(FT_Bitmap_Size) == (16 when (size_of(FT_Pos) == 4) else 32))
|
#assert(size_of(FT_Bitmap_Size) == (16 when (ODIN_OS == .Windows) else 32))
|
||||||
|
|
||||||
@private
|
@private
|
||||||
FT_Bitmap_Size :: struct {
|
FT_Bitmap_Size :: struct {
|
||||||
@@ -166,7 +166,7 @@ FT_Generic :: struct {
|
|||||||
finalizer: ^proc(object: rawptr),
|
finalizer: ^proc(object: rawptr),
|
||||||
}
|
}
|
||||||
|
|
||||||
#assert(size_of(FT_BBox) == (16 when (size_of(FT_Pos) == 4) else 32))
|
#assert(size_of(FT_BBox) == (16 when (ODIN_OS == .Windows) else 32))
|
||||||
|
|
||||||
@private
|
@private
|
||||||
FT_BBox :: struct {
|
FT_BBox :: struct {
|
||||||
@@ -174,14 +174,14 @@ FT_BBox :: struct {
|
|||||||
xMax, yMax: FT_Pos,
|
xMax, yMax: FT_Pos,
|
||||||
}
|
}
|
||||||
|
|
||||||
#assert(size_of(FT_Vector) == (8 when (size_of(FT_Pos) == 4) else 16))
|
#assert(size_of(FT_Vector) == (8 when (ODIN_OS == .Windows) else 16))
|
||||||
|
|
||||||
@private
|
@private
|
||||||
FT_Vector :: struct {
|
FT_Vector :: struct {
|
||||||
x, y: FT_Pos,
|
x, y: FT_Pos,
|
||||||
}
|
}
|
||||||
|
|
||||||
#assert(size_of(FT_Glyph_Metrics) == (32 when (size_of(FT_Pos) == 4) else 64))
|
#assert(size_of(FT_Glyph_Metrics) == (32 when (ODIN_OS == .Windows) else 64))
|
||||||
|
|
||||||
@private
|
@private
|
||||||
FT_Glyph_Metrics :: struct {
|
FT_Glyph_Metrics :: struct {
|
||||||
@@ -226,7 +226,7 @@ FT_Glyph_Format :: enum {
|
|||||||
// linux: 304
|
// linux: 304
|
||||||
// windows: 248
|
// windows: 248
|
||||||
// windows: 236 packed
|
// windows: 236 packed
|
||||||
#assert(size_of(FT_GlyphSlotRec_) == (248 when ODIN_OS == .Windows else 304))
|
#assert(size_of(FT_GlyphSlotRec_) == (248 when (ODIN_OS == .Windows) else 304))
|
||||||
|
|
||||||
FT_GlyphSlotRec_ :: struct {
|
FT_GlyphSlotRec_ :: struct {
|
||||||
library: Library,
|
library: Library,
|
||||||
@@ -265,7 +265,7 @@ FT_GlyphSlotRec_ :: struct {
|
|||||||
@private
|
@private
|
||||||
FT_GlyphSlot :: ^FT_GlyphSlotRec_
|
FT_GlyphSlot :: ^FT_GlyphSlotRec_
|
||||||
|
|
||||||
#assert(size_of(FT_Size_Metrics) == (28 when size_of(FT_Pos) == 4 else 56))
|
#assert(size_of(FT_Size_Metrics) == (28 when (ODIN_OS == .Windows) else 56))
|
||||||
|
|
||||||
@private
|
@private
|
||||||
FT_Size_Metrics :: struct {
|
FT_Size_Metrics :: struct {
|
||||||
@@ -284,7 +284,7 @@ FT_Size_Metrics :: struct {
|
|||||||
// linux: 88
|
// linux: 88
|
||||||
// windows: 64 (has 4 bytes padding)
|
// windows: 64 (has 4 bytes padding)
|
||||||
// windows: 60 packed
|
// windows: 60 packed
|
||||||
#assert(size_of(FT_SizeRec) == (64 when ODIN_OS == .Windows else 88))
|
#assert(size_of(FT_SizeRec) == (64 when (ODIN_OS == .Windows) else 88))
|
||||||
|
|
||||||
@private
|
@private
|
||||||
FT_SizeRec :: struct {
|
FT_SizeRec :: struct {
|
||||||
@@ -354,7 +354,7 @@ FT_ListRec :: struct {
|
|||||||
// linux: 248
|
// linux: 248
|
||||||
// windows: 216
|
// windows: 216
|
||||||
// windows packed: 204
|
// windows packed: 204
|
||||||
#assert(size_of(FT_FaceRec_) == 216)
|
#assert(size_of(FT_FaceRec_) == (216 when (ODIN_OS == .Windows) else 248))
|
||||||
|
|
||||||
@private
|
@private
|
||||||
FT_FaceRec_ :: struct {
|
FT_FaceRec_ :: struct {
|
||||||
|
|||||||
@@ -73,7 +73,6 @@ neighbors := [4]zephr.Vec2 {
|
|||||||
{0, 1}, // down
|
{0, 1}, // down
|
||||||
}
|
}
|
||||||
|
|
||||||
// nocheckin
|
|
||||||
gameover_anim_time: time.Duration = 0
|
gameover_anim_time: time.Duration = 0
|
||||||
|
|
||||||
@private
|
@private
|
||||||
|
|||||||
+14
-5
@@ -2,12 +2,19 @@
|
|||||||
// +private
|
// +private
|
||||||
package zephr
|
package zephr
|
||||||
|
|
||||||
|
import "core:log"
|
||||||
|
|
||||||
import x11 "vendor:x11/xlib"
|
import x11 "vendor:x11/xlib"
|
||||||
|
import gl "vendor:OpenGL"
|
||||||
|
import "vendor:stb/image"
|
||||||
|
|
||||||
import "../glx"
|
import "../glx"
|
||||||
import "../xcursor"
|
import "../xcursor"
|
||||||
|
|
||||||
OsEvent :: x11.Cursor
|
// TODO: In the future, I should either push events to the event queue here or
|
||||||
|
// make the queue a windows-only global.
|
||||||
|
OsEvent :: x11.XEvent
|
||||||
|
OsCursor :: x11.Cursor
|
||||||
|
|
||||||
@(private="file")
|
@(private="file")
|
||||||
PropModeReplace :: 0
|
PropModeReplace :: 0
|
||||||
@@ -26,6 +33,8 @@ x11_window : x11.Window
|
|||||||
x11_colormap : x11.Colormap
|
x11_colormap : x11.Colormap
|
||||||
@(private="file")
|
@(private="file")
|
||||||
glx_context : glx.Context
|
glx_context : glx.Context
|
||||||
|
@(private="file")
|
||||||
|
window_delete_atom : x11.Atom
|
||||||
|
|
||||||
@(private="file")
|
@(private="file")
|
||||||
x11_go_fullscreen :: proc() {
|
x11_go_fullscreen :: proc() {
|
||||||
@@ -178,7 +187,7 @@ x11_create_window :: proc(window_title: cstring, window_size: Vec2, icon_path: c
|
|||||||
|
|
||||||
wm_delete_window := x11.XInternAtom(x11_display, "WM_DELETE_WINDOW", false)
|
wm_delete_window := x11.XInternAtom(x11_display, "WM_DELETE_WINDOW", false)
|
||||||
x11.XSetWMProtocols(x11_display, x11_window, &wm_delete_window, 1)
|
x11.XSetWMProtocols(x11_display, x11_window, &wm_delete_window, 1)
|
||||||
zephr_ctx.window_delete_atom = wm_delete_window
|
window_delete_atom = wm_delete_window
|
||||||
|
|
||||||
// set window name
|
// set window name
|
||||||
{
|
{
|
||||||
@@ -334,7 +343,7 @@ backend_get_os_events :: proc(e_out: ^Event) -> bool {
|
|||||||
return true
|
return true
|
||||||
} else if xev.type == .ClientMessage {
|
} else if xev.type == .ClientMessage {
|
||||||
// window close event
|
// window close event
|
||||||
if (cast(x11.Atom)xev.xclient.data.l[0] == zephr_ctx.window_delete_atom) {
|
if (cast(x11.Atom)xev.xclient.data.l[0] == window_delete_atom) {
|
||||||
e_out.type = .WINDOW_CLOSED
|
e_out.type = .WINDOW_CLOSED
|
||||||
|
|
||||||
return true
|
return true
|
||||||
@@ -457,6 +466,6 @@ backend_init_cursors :: proc() {
|
|||||||
zephr_ctx.cursors[.HRESIZE] = x11.XCreateFontCursor(x11_display, .XC_sb_h_double_arrow)
|
zephr_ctx.cursors[.HRESIZE] = x11.XCreateFontCursor(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.XCreateFontCursor(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
-4
@@ -5,9 +5,7 @@ import "core:log"
|
|||||||
import "core:os"
|
import "core:os"
|
||||||
import "core:container/queue"
|
import "core:container/queue"
|
||||||
|
|
||||||
import x11 "vendor:x11/xlib"
|
|
||||||
import gl "vendor:OpenGL"
|
import gl "vendor:OpenGL"
|
||||||
import "vendor:stb/image"
|
|
||||||
|
|
||||||
Cursor :: enum {
|
Cursor :: enum {
|
||||||
ARROW,
|
ARROW,
|
||||||
@@ -347,7 +345,6 @@ Keyboard :: struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Context :: struct {
|
Context :: struct {
|
||||||
//window_delete_atom: x11.Atom,
|
|
||||||
should_quit: bool,
|
should_quit: bool,
|
||||||
screen_size: Vec2,
|
screen_size: Vec2,
|
||||||
window: Window,
|
window: Window,
|
||||||
@@ -867,4 +864,4 @@ set_zephr_mods :: proc(scancode: Scancode, is_press: bool) -> KeyMod {
|
|||||||
zephr_ctx.keyboard.mods = mods
|
zephr_ctx.keyboard.mods = mods
|
||||||
|
|
||||||
return mods
|
return mods
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user