Refactored some code relating to colours, trivially simplified some calculations

This commit is contained in:
Maruno17
2022-08-13 23:59:24 +01:00
parent aa9b1a9e23
commit b1cde2db42
42 changed files with 294 additions and 250 deletions

View File

@@ -368,7 +368,7 @@ class SpriteFrame < InvalidatableSprite
@previous = previous
@locked = false
@selected = false
@selcolor = Color.new(0, 0, 0)
@selcolor = Color.black
@unselcolor = Color.new(220, 220, 220)
@prevcolor = Color.new(64, 128, 192)
@contents = Bitmap.new(64, 64)

View File

@@ -7,11 +7,11 @@ class ControlPointSprite < Sprite
def initialize(red, viewport = nil)
super(viewport)
self.bitmap = Bitmap.new(6, 6)
self.bitmap.fill_rect(0, 0, 6, 1, Color.new(0, 0, 0))
self.bitmap.fill_rect(0, 0, 1, 6, Color.new(0, 0, 0))
self.bitmap.fill_rect(0, 5, 6, 1, Color.new(0, 0, 0))
self.bitmap.fill_rect(5, 0, 1, 6, Color.new(0, 0, 0))
color = (red) ? Color.new(255, 0, 0) : Color.new(0, 0, 0)
self.bitmap.fill_rect(0, 0, 6, 1, Color.black)
self.bitmap.fill_rect(0, 0, 1, 6, Color.black)
self.bitmap.fill_rect(0, 5, 6, 1, Color.black)
self.bitmap.fill_rect(5, 0, 1, 6, Color.black)
color = (red) ? Color.new(255, 0, 0) : Color.black
self.bitmap.fill_rect(2, 2, 2, 2, color)
self.x = -6
self.y = -6
@@ -54,7 +54,7 @@ class PointSprite < Sprite
def initialize(x, y, viewport = nil)
super(viewport)
self.bitmap = Bitmap.new(2, 2)
self.bitmap.fill_rect(0, 0, 2, 2, Color.new(0, 0, 0))
self.bitmap.fill_rect(0, 0, 2, 2, Color.black)
self.x = x
self.y = y
end