about summary refs log tree commit diff stats
path: root/app.lua
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2022-09-17 10:47:47 -0700
committerKartik K. Agaram <vc@akkartik.com>2022-09-17 10:47:47 -0700
commit287050d598184943209b564657cb1e29ff641fd7 (patch)
tree7d0d83b434a04240455689f46b66c41ab8dcf49e /app.lua
parent69f406202035a3e0b520639a5ca87cd7096c2f99 (diff)
downloadlines.love-287050d598184943209b564657cb1e29ff641fd7.tar.gz
get rid of ugly side-effects in tests
Diffstat (limited to 'app.lua')
-rw-r--r--app.lua25
1 files changed, 25 insertions, 0 deletions
diff --git a/app.lua b/app.lua
index 69507ec..994f0c7 100644
--- a/app.lua
+++ b/app.lua
@@ -154,6 +154,27 @@ function App.screen.init(dims)
   App.screen.height = dims.height
 end
 
+-- operations on the LÖVE window within the monitor/display
+function App.screen.resize(width, height, flags)
+  App.screen.width = width
+  App.screen.height = height
+  App.screen.flags = flags
+end
+
+function App.screen.size()
+  return App.screen.width, App.screen.height, App.screen.flags
+end
+
+function App.screen.move(x,y, displayindex)
+  App.screen.x = x
+  App.screen.y = y
+  App.screen.displayindex = displayindex
+end
+
+function App.screen.position()
+  return App.screen.x, App.screen.y, App.screen.displayindex
+end
+
 function App.screen.print(msg, x,y)
   local screen_row = 'y'..tostring(y)
 --?   print('drawing "'..msg..'" at y '..tostring(y))
@@ -379,6 +400,10 @@ function App.disable_tests()
   App.fake_mouse_press = nil
   App.fake_mouse_release = nil
   -- other methods dispatch to real hardware
+  App.screen.resize = love.window.setMode
+  App.screen.size = love.window.getMode
+  App.screen.move = love.window.setPosition
+  App.screen.position = love.window.getPosition
   App.screen.print = love.graphics.print
   App.newText = love.graphics.newText
   App.screen.draw = love.graphics.draw