Skip to content

Commit

Permalink
shift-esc: always exit, -s - true scale, -fs - fullscreen
Browse files Browse the repository at this point in the history
  • Loading branch information
hugeping committed Jun 5, 2024
1 parent 9b6d46f commit 2e048e7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
4 changes: 2 additions & 2 deletions data/boot.lua
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ local function help()
rein sprited - gfx editor
rein voiced - sfx editor
rein irc - irc client
rein <lua file>
rein [-s] [-fs] <lua file>
Try:
rein demo/aadv.lua - run&play
Expand Down Expand Up @@ -145,7 +145,7 @@ while sys.running() do
gfx.printf(4, H - 2*FH, 1, [[Remove file? Press Y to confirm!]])
else
gfx.printf(4, H - 2*FH, 1, [[F1-help ⬇,⬆,z-run,x-edit,del-remove
shift+esc-return to this launcher]])
shift+esc-exit]])
end

local xoff, yoff = 26 + 7, 72
Expand Down
7 changes: 3 additions & 4 deletions data/core/api.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ local conf = {
fps = 1/50;
w = 256;
h = 256;
fullscreen = false;
pal = {
[-1] = { 0, 0, 0, 0 }, -- transparent
[0] = { 0, 0, 0, 0xff },
Expand Down Expand Up @@ -677,7 +676,7 @@ function api.event(e, v, a, b, c)
input.fifo = {}
mixer.done()
elseif e == 'keydown' and (v == 'escape' and input.kbd.shift)
and #core.suspended > 0 then
then -- and #core.suspended > 0 then
mixer.done()
core.stop()
return true
Expand All @@ -688,8 +687,8 @@ function api.event(e, v, a, b, c)
end

if e == 'keydown' and v == 'return' and input.kbd.alt then
conf.fullscreen = not conf.fullscreen
if conf.fullscreen then
core.fullscreen = not core.fullscreen
if core.fullscreen then
sys.window_mode 'fullscreen'
else
sys.window_mode 'normal'
Expand Down
9 changes: 6 additions & 3 deletions data/core/core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,12 @@ function core.init()
s = true,
nosound = true,
vpad = true,
fs = true,
})
core.fullscreen = opts.fs
if core.fullscreen then
sys.window_mode 'fullscreen'
end
core.scale = opts.s
core.nosound = opts.nosound
core.vpad_enabled = opts.vpad
Expand Down Expand Up @@ -278,10 +283,8 @@ function core.render(force)
local w, h = env.screen:size()
local xs, ys = ww/w, hh/h
local scale = (xs <= ys) and xs or ys
if scale > 1.0 then
local oscale = scale
if scale > 1.0 and not core.scale then
scale = math.floor(scale)
if core.scale and scale + 0.5 <= oscale then scale = scale + 0.5 end
end
local dw = w * scale
local dh = h * scale
Expand Down

0 comments on commit 2e048e7

Please sign in to comment.