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
|
||||
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
|
||||
FT_Bitmap_Size :: struct {
|
||||
@@ -166,7 +166,7 @@ FT_Generic :: struct {
|
||||
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
|
||||
FT_BBox :: struct {
|
||||
@@ -174,14 +174,14 @@ FT_BBox :: struct {
|
||||
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
|
||||
FT_Vector :: struct {
|
||||
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
|
||||
FT_Glyph_Metrics :: struct {
|
||||
@@ -226,7 +226,7 @@ FT_Glyph_Format :: enum {
|
||||
// linux: 304
|
||||
// windows: 248
|
||||
// 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 {
|
||||
library: Library,
|
||||
@@ -265,7 +265,7 @@ FT_GlyphSlotRec_ :: struct {
|
||||
@private
|
||||
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
|
||||
FT_Size_Metrics :: struct {
|
||||
@@ -284,7 +284,7 @@ FT_Size_Metrics :: struct {
|
||||
// linux: 88
|
||||
// windows: 64 (has 4 bytes padding)
|
||||
// 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
|
||||
FT_SizeRec :: struct {
|
||||
@@ -354,7 +354,7 @@ FT_ListRec :: struct {
|
||||
// linux: 248
|
||||
// windows: 216
|
||||
// windows packed: 204
|
||||
#assert(size_of(FT_FaceRec_) == 216)
|
||||
#assert(size_of(FT_FaceRec_) == (216 when (ODIN_OS == .Windows) else 248))
|
||||
|
||||
@private
|
||||
FT_FaceRec_ :: struct {
|
||||
|
||||
@@ -73,7 +73,6 @@ neighbors := [4]zephr.Vec2 {
|
||||
{0, 1}, // down
|
||||
}
|
||||
|
||||
// nocheckin
|
||||
gameover_anim_time: time.Duration = 0
|
||||
|
||||
@private
|
||||
|
||||
+14
-5
@@ -2,12 +2,19 @@
|
||||
// +private
|
||||
package zephr
|
||||
|
||||
import "core:log"
|
||||
|
||||
import x11 "vendor:x11/xlib"
|
||||
import gl "vendor:OpenGL"
|
||||
import "vendor:stb/image"
|
||||
|
||||
import "../glx"
|
||||
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")
|
||||
PropModeReplace :: 0
|
||||
@@ -26,6 +33,8 @@ x11_window : x11.Window
|
||||
x11_colormap : x11.Colormap
|
||||
@(private="file")
|
||||
glx_context : glx.Context
|
||||
@(private="file")
|
||||
window_delete_atom : x11.Atom
|
||||
|
||||
@(private="file")
|
||||
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)
|
||||
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
|
||||
{
|
||||
@@ -334,7 +343,7 @@ backend_get_os_events :: proc(e_out: ^Event) -> bool {
|
||||
return true
|
||||
} else if xev.type == .ClientMessage {
|
||||
// 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
|
||||
|
||||
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[.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")
|
||||
}
|
||||
}
|
||||
|
||||
+1
-4
@@ -5,9 +5,7 @@ import "core:log"
|
||||
import "core:os"
|
||||
import "core:container/queue"
|
||||
|
||||
import x11 "vendor:x11/xlib"
|
||||
import gl "vendor:OpenGL"
|
||||
import "vendor:stb/image"
|
||||
|
||||
Cursor :: enum {
|
||||
ARROW,
|
||||
@@ -347,7 +345,6 @@ Keyboard :: struct {
|
||||
}
|
||||
|
||||
Context :: struct {
|
||||
//window_delete_atom: x11.Atom,
|
||||
should_quit: bool,
|
||||
screen_size: Vec2,
|
||||
window: Window,
|
||||
@@ -867,4 +864,4 @@ set_zephr_mods :: proc(scancode: Scancode, is_press: bool) -> KeyMod {
|
||||
zephr_ctx.keyboard.mods = mods
|
||||
|
||||
return mods
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user