checkbox thingie hehe

This commit is contained in:
Cameron Taylor 2021-03-27 20:01:53 -07:00
parent 5408781804
commit f1325d31e5
6 changed files with 58 additions and 4 deletions

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<TextureAtlas imagePath="options-screen-cs3.png">
<!-- Created with Adobe Animate version 21.0.4.39603 -->
<!-- http://www.adobe.com/products/animate.html -->
<SubTexture name="Check Box Selected Static0000" x="0" y="198" width="120" height="174" frameX="0" frameY="0" frameWidth="140" frameHeight="225"/>
<SubTexture name="Check Box Selected Static0001" x="0" y="198" width="120" height="174" frameX="0" frameY="0" frameWidth="140" frameHeight="225"/>
<SubTexture name="Check Box selecting animation0000" x="371" y="0" width="121" height="82" frameX="-15" frameY="-133" frameWidth="140" frameHeight="225"/>
<SubTexture name="Check Box selecting animation0001" x="371" y="0" width="121" height="82" frameX="-15" frameY="-133" frameWidth="140" frameHeight="225"/>
<SubTexture name="Check Box selecting animation0002" x="132" y="0" width="127" height="180" frameX="-4" frameY="-45" frameWidth="140" frameHeight="225"/>
<SubTexture name="Check Box selecting animation0003" x="0" y="0" width="127" height="193" frameX="0" frameY="0" frameWidth="140" frameHeight="225"/>
<SubTexture name="Check Box selecting animation0004" x="0" y="0" width="127" height="193" frameX="0" frameY="0" frameWidth="140" frameHeight="225"/>
<SubTexture name="Check Box selecting animation0005" x="257" y="185" width="138" height="146" frameX="-2" frameY="-62" frameWidth="140" frameHeight="225"/>
<SubTexture name="Check Box selecting animation0006" x="257" y="185" width="138" height="146" frameX="-2" frameY="-62" frameWidth="140" frameHeight="225"/>
<SubTexture name="Check Box selecting animation0007" x="132" y="185" width="120" height="176" frameX="-12" frameY="-29" frameWidth="140" frameHeight="225"/>
<SubTexture name="Check Box selecting animation0008" x="132" y="185" width="120" height="176" frameX="-12" frameY="-29" frameWidth="140" frameHeight="225"/>
<SubTexture name="Check Box selecting animation0009" x="0" y="198" width="120" height="174" frameX="-12" frameY="-29" frameWidth="140" frameHeight="225"/>
<SubTexture name="Check Box selecting animation0010" x="0" y="198" width="120" height="174" frameX="-12" frameY="-29" frameWidth="140" frameHeight="225"/>
<SubTexture name="Check Box unselected0000" x="264" y="0" width="102" height="103"/>
</TextureAtlas>

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<TextureAtlas imagePath="checkboxThingie.png">
<!-- Created with Adobe Animate version 21.0.4.39603 -->
<!-- http://www.adobe.com/products/animate.html -->
<SubTexture name="Check Box Selected Static0000" x="0" y="198" width="120" height="174" frameX="0" frameY="0" frameWidth="140" frameHeight="225"/>
<SubTexture name="Check Box Selected Static0001" x="0" y="198" width="120" height="174" frameX="0" frameY="0" frameWidth="140" frameHeight="225"/>
<SubTexture name="Check Box selecting animation0000" x="371" y="0" width="121" height="82" frameX="-15" frameY="-133" frameWidth="140" frameHeight="225"/>
<SubTexture name="Check Box selecting animation0001" x="371" y="0" width="121" height="82" frameX="-15" frameY="-133" frameWidth="140" frameHeight="225"/>
<SubTexture name="Check Box selecting animation0002" x="132" y="0" width="127" height="180" frameX="-4" frameY="-45" frameWidth="140" frameHeight="225"/>
<SubTexture name="Check Box selecting animation0003" x="0" y="0" width="127" height="193" frameX="0" frameY="0" frameWidth="140" frameHeight="225"/>
<SubTexture name="Check Box selecting animation0004" x="0" y="0" width="127" height="193" frameX="0" frameY="0" frameWidth="140" frameHeight="225"/>
<SubTexture name="Check Box selecting animation0005" x="257" y="185" width="138" height="146" frameX="-2" frameY="-62" frameWidth="140" frameHeight="225"/>
<SubTexture name="Check Box selecting animation0006" x="257" y="185" width="138" height="146" frameX="-2" frameY="-62" frameWidth="140" frameHeight="225"/>
<SubTexture name="Check Box selecting animation0007" x="132" y="185" width="120" height="176" frameX="-12" frameY="-29" frameWidth="140" frameHeight="225"/>
<SubTexture name="Check Box selecting animation0008" x="132" y="185" width="120" height="176" frameX="-12" frameY="-29" frameWidth="140" frameHeight="225"/>
<SubTexture name="Check Box selecting animation0009" x="0" y="198" width="120" height="174" frameX="-12" frameY="-29" frameWidth="140" frameHeight="225"/>
<SubTexture name="Check Box selecting animation0010" x="0" y="198" width="120" height="174" frameX="-12" frameY="-29" frameWidth="140" frameHeight="225"/>
<SubTexture name="Check Box unselected0000" x="264" y="0" width="102" height="103"/>
</TextureAtlas>

View File

@ -107,27 +107,43 @@ class PreferencesMenu extends ui.OptionsState.Page
class CheckboxThingie extends FlxSprite
{
public var daValue(default, set):Bool = false;
public var daValue(default, set):Bool;
public function new(x:Float, y:Float, daValue:Bool = false)
{
super(x, y);
frames = Paths.getSparrowAtlas('checkboxThingie');
animation.addByPrefix('static', 'Check Box unselected', 24, false);
animation.addByPrefix('checked', 'Check Box selecting animation', 24, false);
antialiasing = true;
setGraphicSize(Std.int(width * 0.7));
updateHitbox();
this.daValue = daValue;
makeGraphic(50, 50, FlxColor.WHITE);
}
override function update(elapsed:Float)
{
super.update(elapsed);
switch (animation.curAnim.name)
{
case 'static':
offset.set();
case 'checked':
offset.set(17, 70);
}
}
function set_daValue(value:Bool):Bool
{
if (value)
color = FlxColor.GREEN;
animation.play('checked', true);
else
color = FlxColor.RED;
animation.play('static');
return value;
}