mouse overrides.
This commit is contained in:
@@ -1,12 +1,17 @@
|
||||
(ns advent.screens.rooms
|
||||
(:require [advent.zone :as zone]))
|
||||
(:require [advent.zone :as zone])
|
||||
(:import [com.badlogic.gdx.graphics Pixmap Pixmap$Filter Texture Texture$TextureFilter]
|
||||
[com.badlogic.gdx.graphics.g2d TextureRegion]
|
||||
[com.badlogic.gdx.utils.viewport FitViewport]
|
||||
[com.badlogic.gdx.scenes.scene2d Actor Stage]
|
||||
[java.lang Object]))
|
||||
|
||||
(defn make-entity [id entity]
|
||||
(merge entity
|
||||
{:mouse-in? (fn [entities x y]
|
||||
(let [{entity-x :x entity-y :y width :width scale-x :scale-x scale-y :scale-y height :height region :object} (get-in entities [:room :entities id])
|
||||
width (or width (.getRegionWidth region))
|
||||
height (or height (.getRegionHeight region))]
|
||||
width (or width (if (isa? TextureRegion region) (.getRegionWidth region) 0))
|
||||
height (or height (if (isa? TextureRegion region) (.getRegionHeight region) 0))]
|
||||
((zone/box entity-x entity-y (+ entity-x (* width (or 1 scale-x))) (+ entity-y (* height (or scale-y 1)))) x y)))}
|
||||
(when (or (:scripts entity) (:script entity))
|
||||
{:get-script (fn [cursor [x y]]
|
||||
|
||||
@@ -91,6 +91,7 @@
|
||||
entities))
|
||||
:on-ui-changed
|
||||
(fn [screen [entities]]
|
||||
(println "HER")
|
||||
(swap! utils/settings
|
||||
assoc
|
||||
:music-volume (slider! (:music-volume-slider entities) :get-value)
|
||||
|
||||
Reference in New Issue
Block a user