fix image smoothing

master
Josha von Gizycki 6 years ago
parent dddbec48c6
commit abcaf09b12

@ -138,6 +138,7 @@
then, it calls itself again with a delay according to the target fps"
[gamestate]
(let [newstate (update-step gamestate)]
(set! (.-imageSmoothingEnabled (:ctx gamestate)) false)
(draw-step newstate)
(when-not @reloaded
(.setTimeout js/window
@ -150,13 +151,9 @@
(defn init-scenes
"initiates the scene data maps using their respective init functions"
[]
(aset (:ctx gamestate)
"imageSmoothingEnabled"
false)
(aset (:canvas gamestate)
"width" (get-in gamestate [:dimensions :w]))
(aset (:canvas gamestate)
"height" (get-in gamestate [:dimensions :h]))
(as-> (:canvas gamestate) c
(set! (.-width c) (get-in gamestate [:dimensions :w]))
(set! (.-height c) (get-in gamestate [:dimensions :h])))
(update gamestate
:scenes
#(reduce

@ -16,7 +16,7 @@
scenestate
{:map-def {:images {:pokelike (by-id "demoscene-tileset")}
:def nil
:zoom 4}
:zoom 3}
:player {:x (- (/ (get-in gamestate [:dimensions :w]) 2) 32)
:y (- (/ (get-in gamestate [:dimensions :h]) 2) 32)
:d :s

@ -1,8 +1,6 @@
(ns topdown2d.tileset
(:require [topdown2d.collision :as coll]))
(def ^:dynamic tileset)
(defn next-animation-cycle [animation curr-cycle]
(let [curr-ix (.indexOf animation curr-cycle)
next-ix (inc curr-ix)

Loading…
Cancel
Save