about summary refs log tree commit diff stats
path: root/app.lua
diff options
context:
space:
mode:
Diffstat (limited to 'app.lua')
-rw-r--r--app.lua29
1 files changed, 23 insertions, 6 deletions
diff --git a/app.lua b/app.lua
index cac1303..2135fb0 100644
--- a/app.lua
+++ b/app.lua
@@ -1,4 +1,4 @@
--- main entrypoint for LÖVE
+-- love.run: main entrypoint function for LÖVE
 --
 -- Most apps can just use the default, but we need to override it to
 -- install a test harness.
@@ -11,13 +11,10 @@
 --
 -- Scroll below this function for more details.
 function love.run()
+  App.snapshot_love()
   -- Tests always run at the start.
-  App.run_tests()
-
+  App.run_tests_and_initialize()
 --?   print('==')
-  App.disable_tests()
-  App.initialize_globals()
-  App.initialize(love.arg.parseGameArguments(arg), arg)
 
   love.timer.step()
   local dt = 0
@@ -123,6 +120,26 @@ end
 
 App = {screen={}}
 
+-- save/restore various framework globals we care about -- only on very first load
+function App.snapshot_love()
+  if Love_snapshot then return end
+  Love_snapshot = {}
+  -- save the entire initial font; it doesn't seem reliably recreated using newFont
+  Love_snapshot.initial_font = love.graphics.getFont()
+end
+
+function App.undo_initialize()
+  love.graphics.setFont(Love_snapshot.initial_font)
+end
+
+function App.run_tests_and_initialize()
+  App.load()
+  App.run_tests()
+  App.disable_tests()
+  App.initialize_globals()
+  App.initialize(love.arg.parseGameArguments(arg), arg)
+end
+
 function App.initialize_for_test()
   App.screen.init({width=100, height=50})
   App.screen.contents = {}  -- clear screen
84fd4590740cb6dc23e951848108f671aac'>^
b38d7fff ^
a6d9bd9b ^


e3894819 ^
b38d7fff ^
a6d9bd9b ^



1ae4e0d9 ^
a6d9bd9b ^
31a9d39e ^

a6d9bd9b ^
2e534c0e ^
1ae4e0d9 ^
b94f150a ^
1ae4e0d9 ^
fbf0536d ^


fbf0536d ^
10f49c64 ^
b38d7fff ^
e3894819 ^
1ae4e0d9 ^
fc2046a1 ^
1ead3562 ^
38f0b91a ^
1ead3562 ^
70f70118 ^
04afb4b0 ^
426009da ^
b38d7fff ^

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68