Skip to content

Commit 5aed48a

Browse files
committed
Fixed pre-open UI crash
1 parent 80c0bd9 commit 5aed48a

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

src/globals.lisp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,6 @@
3232

3333
(defvar *ui-font*)
3434

35-
(defvar *ui-context*)
35+
(defvar *ui-context* (cffi:null-pointer))
3636

3737
(defvar *quit*)

src/main.lisp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,7 @@
8181
+button-background-path+)
8282
*button-background2*
8383
(al:ensure-loaded #'nk:allegro-create-image
84-
+button-background2-path+)
85-
*ui-context*
86-
(nk:allegro-init
87-
*ui-font* display +window-width+ +window-height+))
84+
+button-background2-path+))
8885
(setf *storage* (ecs:make-storage))
8986
(load-sprites)
9087
(load-sounds)
@@ -104,6 +101,9 @@
104101
(setf *player-entity* player
105102
*deathp* nil))
106103
(ecs:run-systems *storage* :dt 0d0) ;; HACK: prime system bitmaps
104+
(setf *ui-context*
105+
(nk:allegro-init
106+
*ui-font* display +window-width+ +window-height+))
107107
(livesupport:setup-lisp-repl)
108108
(trivial-garbage:gc :full t)
109109
(loop :named event-loop

src/ui.lisp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717

1818
(ecs:defsystem ui
1919
(:components-rw (ui))
20-
(when (plusp ui-active)
20+
(when (and (not (cffi:null-pointer-p *ui-context*))
21+
(plusp ui-active))
2122
(nk:with-styles *ui-context*
2223
((:item nk:+style-window-fixed-background+
2324
(nk:style-item-image *window-background*))

0 commit comments

Comments
 (0)