mirror of
https://gitlab.com/cc-ru/ocelot/ocelot-desktop.git
synced 2025-12-20 02:59:19 +01:00
34 lines
963 B
Scala
34 lines
963 B
Scala
package ocelot.desktop.node.nodes
|
|
|
|
import ocelot.desktop.OcelotDesktop
|
|
import ocelot.desktop.color.Color
|
|
import ocelot.desktop.graphics.Graphics
|
|
import ocelot.desktop.node.Node
|
|
import ocelot.desktop.util.TierColor
|
|
import totoro.ocelot.brain.entity.traits.Environment
|
|
import totoro.ocelot.brain.entity.{Keyboard, Screen}
|
|
|
|
class ScreenNode(val screen: Screen) extends Node {
|
|
OcelotDesktop.workspace.add(screen)
|
|
|
|
private val keyboard = new Keyboard
|
|
OcelotDesktop.workspace.add(keyboard)
|
|
|
|
screen.connect(keyboard)
|
|
|
|
override def environment: Environment = screen
|
|
|
|
override def icon: String = "nodes/Screen"
|
|
|
|
override def iconColor: Color = TierColor.get(screen.tier)
|
|
|
|
override def draw(g: Graphics): Unit = {
|
|
super.draw(g)
|
|
|
|
if (screen.getPowerState)
|
|
g.sprite("nodes/ScreenOnOverlay", position.x + 2, position.y + 2, size.width - 4, size.height - 4)
|
|
}
|
|
|
|
override lazy val window: Option[ScreenWindow] = Some(new ScreenWindow(screen))
|
|
}
|