Fix scaling
This commit is contained in:
parent
6502ac76d9
commit
c850a5dc8e
File diff suppressed because one or more lines are too long
|
@ -30,8 +30,8 @@
|
||||||
(let [maps (icollect [imap _ (ipairs files.game.levels)] (.. :map imap))
|
(let [maps (icollect [imap _ (ipairs files.game.levels)] (.. :map imap))
|
||||||
map (or action.map (. maps 1))
|
map (or action.map (. maps 1))
|
||||||
y (+ y style.padding.y)
|
y (+ y style.padding.y)
|
||||||
map (dropdown view [:warp :map i] map maps x y 100)
|
map (dropdown view [:warp :map i] map maps x y (* 100 SCALE))
|
||||||
(position-string y) (textbox view [:warp :loc i] (string.format "%x" (or action.position 0)) (+ x 150) y 150)
|
(position-string y) (textbox view [:warp :loc i] (string.format "%x" (or action.position 0)) (+ x (* 150 SCALE)) y (* 150 SCALE))
|
||||||
position (or (tonumber position-string 16) action.position)]
|
position (or (tonumber position-string 16) action.position)]
|
||||||
(set action.map map)
|
(set action.map map)
|
||||||
(set action.position position)
|
(set action.position position)
|
||||||
|
@ -47,13 +47,13 @@
|
||||||
(let [y (+ y style.padding.y)
|
(let [y (+ y style.padding.y)
|
||||||
x (renderer.draw_text style.font "Set " x y style.text)
|
x (renderer.draw_text style.font "Set " x y style.text)
|
||||||
flag (or action.flag (. files.game.flags 1))
|
flag (or action.flag (. files.game.flags 1))
|
||||||
flag (dropdown view [:set-flag :flag i] flag files.game.flags x y 100)
|
flag (dropdown view [:set-flag :flag i] flag files.game.flags x y (* 100 SCALE))
|
||||||
x (renderer.draw_text style.font " to " (+ x 100) y style.text)
|
x (renderer.draw_text style.font " to " (+ x (* 100 SCALE)) y style.text)
|
||||||
options (lume.concat
|
options (lume.concat
|
||||||
[{:label "<Yes>" :value 0xffff} {:label "<No>" :value 0}]
|
[{:label "<Yes>" :value 0xffff} {:label "<No>" :value 0}]
|
||||||
(icollect [_ flag (ipairs files.game.flags)] {:label flag :value (.. :cond- flag)}))
|
(icollect [_ flag (ipairs files.game.flags)] {:label flag :value (.. :cond- flag)}))
|
||||||
rhs (or action.rhs (. options 1))
|
rhs (or action.rhs (. options 1))
|
||||||
(rhs y) (dropdown view [:set-flag :rhs i] rhs options x y 100)]
|
(rhs y) (dropdown view [:set-flag :rhs i] rhs options x y (* 100 SCALE))]
|
||||||
(set action.flag flag)
|
(set action.flag flag)
|
||||||
(set action.rhs rhs)
|
(set action.rhs rhs)
|
||||||
y))
|
y))
|
||||||
|
|
|
@ -102,10 +102,10 @@
|
||||||
(values (button view label x y w h) (+ y h)))
|
(values (button view label x y w h) (+ y h)))
|
||||||
|
|
||||||
(fn checkbox [view name isset x y ?tag]
|
(fn checkbox [view name isset x y ?tag]
|
||||||
(love.graphics.rectangle (if isset :fill :line) x y 12 12)
|
(love.graphics.rectangle (if isset :fill :line) x y (* 12 SCALE) (* 12 SCALE))
|
||||||
(local xEnd (renderer.draw_text style.font name (+ x 16) y style.text))
|
(local xEnd (renderer.draw_text style.font name (+ x (* 16 SCALE)) y style.text))
|
||||||
(love.graphics.setColor 1 1 1 1)
|
(love.graphics.setColor 1 1 1 1)
|
||||||
(button view (or ?tag name) x y (- xEnd x) 12))
|
(button view (or ?tag name) x y (- xEnd x) (* 12 SCALE)))
|
||||||
|
|
||||||
(fn focused? [view tag] (= (make-tag tag) (-?> view.imstate.focus (. :tag))))
|
(fn focused? [view tag] (= (make-tag tag) (-?> view.imstate.focus (. :tag))))
|
||||||
(fn focus [view tag x y w h opts]
|
(fn focus [view tag x y w h opts]
|
||||||
|
|
|
@ -66,7 +66,7 @@
|
||||||
level-count (length files.game.levels)
|
level-count (length files.game.levels)
|
||||||
_ (do (for [i 1 level-count] (tset options i i))
|
_ (do (for [i 1 level-count] (tset options i i))
|
||||||
(table.insert options :New))
|
(table.insert options :New))
|
||||||
(ilevel yNext) (dropdown self :map-selector self.ilevel options (+ x 50) y 100)]
|
(ilevel yNext) (dropdown self :map-selector self.ilevel options (+ x (* 50 SCALE)) y (* 100 SCALE))]
|
||||||
(when (not= ilevel self.ilevel)
|
(when (not= ilevel self.ilevel)
|
||||||
(set self.ilevel (if (= ilevel :New) (+ level-count 1) ilevel))
|
(set self.ilevel (if (= ilevel :New) (+ level-count 1) ilevel))
|
||||||
(self:load-level))
|
(self:load-level))
|
||||||
|
@ -170,13 +170,13 @@
|
||||||
(var istep-to-delete nil)
|
(var istep-to-delete nil)
|
||||||
(when (not object.steps) (set object.steps []))
|
(when (not object.steps) (set object.steps []))
|
||||||
(each [istep step (ipairs object.steps)]
|
(each [istep step (ipairs object.steps)]
|
||||||
(when (textbutton self "X" (+ x 280) y)
|
(when (textbutton self "X" (+ x (* 280 SCALE)) y)
|
||||||
(set istep-to-delete istep))
|
(set istep-to-delete istep))
|
||||||
(set step.condition (. (dropdown self [:code-condition istep] (condition-label step.condition) (condition-options)
|
(set step.condition (. (dropdown self [:code-condition istep] (condition-label step.condition) (condition-options)
|
||||||
(+ x 100 style.padding.x) y 100)
|
(+ x (* 100 SCALE) style.padding.x) y (* 100 SCALE))
|
||||||
:flag))
|
:flag))
|
||||||
(set (step.action y) (dropdown self [:code-action istep] (or step.action (. actions.actionlist 1)) actions.actionlist x y 100))
|
(set (step.action y) (dropdown self [:code-action istep] (or step.action (. actions.actionlist 1)) actions.actionlist x y (* 100 SCALE)))
|
||||||
(set y (actions.edit step self x y 300 istep))
|
(set y (actions.edit step self x y (* 300 SCALE) istep))
|
||||||
(set y (+ y style.padding.y)))
|
(set y (+ y style.padding.y)))
|
||||||
(when istep-to-delete (table.remove object.steps istep-to-delete))
|
(when istep-to-delete (table.remove object.steps istep-to-delete))
|
||||||
(let [(do-new y) (textbutton self "+ New Step" x (+ y style.padding.y))]
|
(let [(do-new y) (textbutton self "+ New Step" x (+ y style.padding.y))]
|
||||||
|
@ -190,11 +190,11 @@
|
||||||
(not= object.func nil))))
|
(not= object.func nil))))
|
||||||
|
|
||||||
(fn MapEditView.draw-object-advanced-editor [self object x y]
|
(fn MapEditView.draw-object-advanced-editor [self object x y]
|
||||||
(let [(func y) (textfield self "Word" object.func x y 100 200)
|
(let [(func y) (textfield self "Word" object.func x y (* 100 SCALE) (* 200 SCALE))
|
||||||
(name y) (textfield self "Name" object.name x (+ y style.padding.y) 100 200)
|
(name y) (textfield self "Name" object.name x (+ y style.padding.y) (* 100 SCALE) (* 200 SCALE))
|
||||||
(linkword y) (textfield self "Link word" object.linkword x (+ y style.padding.y) 100 200)
|
(linkword y) (textfield self "Link word" object.linkword x (+ y style.padding.y) (* 100 SCALE) (* 200 SCALE))
|
||||||
(do-unlink y) (if object.link (textbutton self "Unlink" x (+ y style.padding.y)) (values false y))
|
(do-unlink y) (if object.link (textbutton self "Unlink" x (+ y style.padding.y)) (values false y))
|
||||||
(linkentity y) (if object.link (values object.linkentity y) (textfield self "Link entity" object.linkentity x (+ y style.padding.y) 100 200))]
|
(linkentity y) (if object.link (values object.linkentity y) (textfield self "Link entity" object.linkentity x (+ y style.padding.y) (* 100 SCALE) (* 200 SCALE)))]
|
||||||
(lume.extend object {: func : name : linkword : linkentity})
|
(lume.extend object {: func : name : linkword : linkentity})
|
||||||
(when do-unlink (set object.link nil))
|
(when do-unlink (set object.link nil))
|
||||||
y))
|
y))
|
||||||
|
@ -204,10 +204,10 @@
|
||||||
y (if (advanced? object)
|
y (if (advanced? object)
|
||||||
(self:draw-object-advanced-editor object x y)
|
(self:draw-object-advanced-editor object x y)
|
||||||
(self:draw-object-code-editor object x y))
|
(self:draw-object-code-editor object x y))
|
||||||
new-flag-name (textbox self :new-flag-name self.new-flag-name x (+ y style.padding.y) 200)
|
new-flag-name (textbox self :new-flag-name self.new-flag-name x (+ y style.padding.y) (* 200 SCALE))
|
||||||
(mk-new-flag y) (textbutton self "+ New Flag" (+ x 200 style.padding.x) (+ y style.padding.y))
|
(mk-new-flag y) (textbutton self "+ New Flag" (+ x (* 200 SCALE) style.padding.x) (+ y style.padding.y))
|
||||||
do-delete (textbutton self "Delete" x (+ y 40))
|
do-delete (textbutton self "Delete" x (+ y (* style.padding.y 2)))
|
||||||
(do-advanced y) (textbutton self (if (advanced? object) "Simple" "Advanced") (+ x 150) (+ y 40))]
|
(do-advanced y) (textbutton self (if (advanced? object) "Simple" "Advanced") (+ x (* 150 SCALE)) (+ y (* style.padding.y 2)))]
|
||||||
(set self.new-flag-name new-flag-name)
|
(set self.new-flag-name new-flag-name)
|
||||||
(when mk-new-flag
|
(when mk-new-flag
|
||||||
(when (= files.game.flags nil)
|
(when (= files.game.flags nil)
|
||||||
|
@ -237,14 +237,16 @@
|
||||||
(self:draw_background style.background)
|
(self:draw_background style.background)
|
||||||
(self:draw_scrollbar)
|
(self:draw_scrollbar)
|
||||||
(local ytop y)
|
(local ytop y)
|
||||||
|
(local editor-on-side (> self.size.x (+ (* tilew mapw) (* 300 SCALE))))
|
||||||
(set y (+ y (self:draw-map-selector x y) style.padding.y))
|
(set y (+ y (self:draw-map-selector x y) style.padding.y))
|
||||||
(self:draw-map-editor x y)
|
(self:draw-map-editor x y)
|
||||||
(set y (+ y (* tileh maph) style.padding.y))
|
(set y (+ y (* tileh maph) style.padding.y))
|
||||||
(set y (+ y (self:draw-tile-selector x y (- self.size.x (* style.padding.x 2)))))
|
(set y (+ y (self:draw-tile-selector x y (if editor-on-side (* tilew mapw)
|
||||||
|
(- self.size.x (* style.padding.x 2))))))
|
||||||
|
|
||||||
(set (self.level.tickword y) (textfield self "Tick word" self.level.tickword x (+ y style.padding.y) 100 200))
|
(set (self.level.tickword y) (textfield self "Tick word" self.level.tickword x (+ y style.padding.y) (* 100 SCALE) (* 200 SCALE)))
|
||||||
(set (self.level.moveword y) (textfield self "Move word" self.level.moveword x (+ y style.padding.y) 100 200))
|
(set (self.level.moveword y) (textfield self "Move word" self.level.moveword x (+ y style.padding.y) (* 100 SCALE) (* 200 SCALE)))
|
||||||
(set (self.level.loadword y) (textfield self "Load word" self.level.loadword x (+ y style.padding.y) 100 200))
|
(set (self.level.loadword y) (textfield self "Load word" self.level.loadword x (+ y style.padding.y) (* 100 SCALE) (* 200 SCALE)))
|
||||||
(let [(checked y-new) (checkbox self "Edit objects" (= self.itile nil) x (+ y style.padding.y))
|
(let [(checked y-new) (checkbox self "Edit objects" (= self.itile nil) x (+ y style.padding.y))
|
||||||
_ (when checked
|
_ (when checked
|
||||||
(set self.itile nil)
|
(set self.itile nil)
|
||||||
|
@ -261,11 +263,11 @@
|
||||||
(when checked (tset self.level levelflag (not (. self.level levelflag))))
|
(when checked (tset self.level levelflag (not (. self.level levelflag))))
|
||||||
(set y y-new)))
|
(set y y-new)))
|
||||||
(when self.iobject
|
(when self.iobject
|
||||||
(set y (math.max y (if (> self.size.x (+ (* tilew mapw) 300))
|
(set y (math.max y (if editor-on-side
|
||||||
(self:draw-object-editor (+ x (* tilew mapw) style.padding.x) ytop)
|
(self:draw-object-editor (+ x (* tilew mapw) style.padding.x) ytop)
|
||||||
(self:draw-object-editor x (+ y style.padding.y))))))
|
(self:draw-object-editor x (+ y style.padding.y))))))
|
||||||
|
|
||||||
(set self.scrollheight (- y (+ self.position.y style.padding.y (- self.scroll.y)))))
|
(set self.scrollheight (+ y (- self.position.y) self.scroll.y style.padding.y)))
|
||||||
|
|
||||||
(fn MapEditView.get_name [self] (.. "Map " self.ilevel))
|
(fn MapEditView.get_name [self] (.. "Map " self.ilevel))
|
||||||
|
|
||||||
|
|
|
@ -74,16 +74,18 @@
|
||||||
(fn TileView.draw-tile-flag [self flagname x y]
|
(fn TileView.draw-tile-flag [self flagname x y]
|
||||||
(local flags (-?> self.tilecache.tiles (. self.itile) (. :flags)))
|
(local flags (-?> self.tilecache.tiles (. self.itile) (. :flags)))
|
||||||
(local flagset (if flags (. flags flagname) false))
|
(local flagset (if flags (. flags flagname) false))
|
||||||
(when (checkbox self flagname flagset x y)
|
(let [(checked yNew) (checkbox self flagname flagset x y)]
|
||||||
(tset flags flagname (if flagset nil true))))
|
(when checked (tset flags flagname (if flagset nil true)))
|
||||||
|
yNew))
|
||||||
|
|
||||||
(fn TileView.draw-tile-flags [self x y]
|
(fn TileView.draw-tile-flags [self x y]
|
||||||
(local tile (-?> self.tilecache.tiles (. self.itile)))
|
(local tile (-?> self.tilecache.tiles (. self.itile)))
|
||||||
|
(var y y)
|
||||||
(when tile
|
(when tile
|
||||||
(set tile.word (textfield self "Default word" tile.word x y 100 200))
|
(set (tile.word y) (textfield self "Default word" tile.word x (+ y style.padding.y) (* 100 SCALE) (* 200 SCALE)))
|
||||||
(set tile.label (textfield self "Label" tile.label x (+ y pixel-size 4) 100 200)))
|
(set (tile.label y) (textfield self "Label" tile.label x (+ y style.padding.y) (* 100 SCALE) (* 200 SCALE))))
|
||||||
(each [iflag flagname (ipairs (tiles.flags))]
|
(each [iflag flagname (ipairs (tiles.flags))]
|
||||||
(self:draw-tile-flag flagname x (+ y (* (+ iflag 1) (+ pixel-size 4))))))
|
(set y (self:draw-tile-flag flagname x (+ y style.padding.y)))))
|
||||||
|
|
||||||
(fn TileView.update-tile [self newtile]
|
(fn TileView.update-tile [self newtile]
|
||||||
(self.tilecache:update-tile self.itile newtile self.tilekey))
|
(self.tilecache:update-tile self.itile newtile self.tilekey))
|
||||||
|
|
|
@ -2,11 +2,14 @@
|
||||||
(local core (require :core))
|
(local core (require :core))
|
||||||
(local command (require :core.command))
|
(local command (require :core.command))
|
||||||
(local keymap (require :core.keymap))
|
(local keymap (require :core.keymap))
|
||||||
|
(local style (require :core.style))
|
||||||
(local SlideshowView (require :presentation.engine))
|
(local SlideshowView (require :presentation.engine))
|
||||||
|
|
||||||
(fn set-scale [multiplier]
|
(fn set-scale [multiplier]
|
||||||
(set _G.SCALE (* (love.graphics.getDPIScale) multiplier))
|
(set _G.SCALE (* (love.graphics.getDPIScale) multiplier))
|
||||||
(util.hotswap :core.style))
|
(util.hotswap :core.style)
|
||||||
|
(when (= multiplier 1)
|
||||||
|
(set style.code_font (renderer.font.load (.. EXEDIR "/data/fonts/monospace.ttf") 15))))
|
||||||
|
|
||||||
(command.add nil {
|
(command.add nil {
|
||||||
"presentation:start" (fn []
|
"presentation:start" (fn []
|
||||||
|
|
BIN
presentation/pics/bsod.png
Normal file
BIN
presentation/pics/bsod.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 44 KiB |
|
@ -42,9 +42,9 @@
|
||||||
(when ?split (core.set_active_view focused-view)) ; don't switch focus
|
(when ?split (core.set_active_view focused-view)) ; don't switch focus
|
||||||
#(view-cleanup view)))
|
#(view-cleanup view)))
|
||||||
|
|
||||||
(fn openview [f ?split] {:action #(split-and-open f ?split)})
|
(fn openview [f ?extra] (lume.merge {:action #(split-and-open f $1.split)} (or ?extra {})))
|
||||||
(fn openfile [filename ?split]
|
(fn openfile [filename ?extra]
|
||||||
(openview #(core.root_view:open_doc (core.open_doc filename)) ?split))
|
(openview #(core.root_view:open_doc (core.open_doc filename)) ?extra))
|
||||||
|
|
||||||
(parse [
|
(parse [
|
||||||
[h "" "" ""
|
[h "" "" ""
|
||||||
|
@ -78,7 +78,7 @@
|
||||||
"* How can I leverage emulation?"]
|
"* How can I leverage emulation?"]
|
||||||
[h "Step 1: Assembler"
|
[h "Step 1: Assembler"
|
||||||
** "Represent instructions using Fennel data literals"
|
** "Represent instructions using Fennel data literals"
|
||||||
(openfile :asm/asm.fnl :right)
|
(openfile :asm/asm.fnl {:split :right})
|
||||||
" [:lda 0xff]"
|
" [:lda 0xff]"
|
||||||
"Represent labels with Fennel strings"
|
"Represent labels with Fennel strings"
|
||||||
" :loop [:bne :loop]"
|
" :loop [:bne :loop]"
|
||||||
|
@ -128,5 +128,35 @@
|
||||||
"Map editor"
|
"Map editor"
|
||||||
(openview #(MapEditView))
|
(openview #(MapEditView))
|
||||||
"Screen editor"
|
"Screen editor"
|
||||||
(lume.merge (openview #(ScreenEditView :neuttower/title.screen)) {:pause-after true})]
|
(openview #(ScreenEditView :neuttower/title.screen) {:pause-after true})
|
||||||
|
(openfile :presentation/slides.fnl {:split :right :line 133})
|
||||||
|
"Presentation viewer!?"]
|
||||||
|
[h "Editing Editors With My Editor"
|
||||||
|
** "Lua provides a very dynamic environment that allows me tremendous flexibility"
|
||||||
|
(openview #(MapEditView))
|
||||||
|
(openfile :editor/mapedit.fnl {:split :right})
|
||||||
|
"Downside:"
|
||||||
|
{:image "presentation/pics/bsod.png" :justify :center :pause-after true}]
|
||||||
|
[h "Step 4: Emulator Integration"
|
||||||
|
** "Directly inspired by Dagen Brock's 2016 KFest talk on GSPlus"
|
||||||
|
"Ended up using MAME - has a full Lua plugin system"
|
||||||
|
"What if I could poke my program directly into an emulator's memory?"
|
||||||
|
"What if I could preserve the current runtime state but rewrite the code?"
|
||||||
|
"... even if the data has moved?"
|
||||||
|
"What if I could interactively try out new code while my game was running?"]
|
||||||
|
[h "Step 5: Running on Hardware"
|
||||||
|
** "I have a IIgs with a serial cable - I can poke bytes in directly from the monitor"
|
||||||
|
"]IN#2\n]PR#2\n]CALL-151"
|
||||||
|
"Easy to send bytes faster than the monitor can process them"]
|
||||||
|
[h "Audio"
|
||||||
|
** "I have a II+ with a cassette port"
|
||||||
|
"LÖVE2D is a game engine - my editor can generate audio and play it back immediately"
|
||||||
|
"Need to generate a BASIC program to bootstrap my machine code"
|
||||||
|
(openfile :asm/tape.fnl {:split :right})
|
||||||
|
" [:basic [10 :call :2061]]"
|
||||||
|
"Future work: Apple Game Server fastloader"]
|
||||||
|
[h "ProDOS"
|
||||||
|
** "Eventually we'll want a disk image for release"]
|
||||||
|
|
||||||
|
|
||||||
])
|
])
|
||||||
|
|
Loading…
Reference in a new issue