Skip to content

Commit

Permalink
fix for switch + optimized checkbox anim
Browse files Browse the repository at this point in the history
  • Loading branch information
GuglioIsStupid committed Sep 24, 2023
1 parent 8120d0b commit 1f2ba12
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 47 deletions.
Binary file modified src/love/images/dds/menu/checkboxanim.dds
Binary file not shown.
42 changes: 20 additions & 22 deletions src/love/images/dds/menu/checkboxanim.xml
Original file line number Diff line number Diff line change
@@ -1,25 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<TextureAtlas imagePath="checkboxanim.png">
<!-- Created with Adobe Animate version 21.0.1.37179 -->
<!-- http://www.adobe.com/products/animate.html -->
<SubTexture name="checkbox0000" x="4" y="4" width="111" height="108" pivotX="0" pivotY="0"/>
<SubTexture name="checkbox anim0000" x="119" y="4" width="183" height="142" pivotX="38.45" pivotY="25.3"/>
<SubTexture name="checkbox anim0001" x="119" y="4" width="183" height="142"/>
<SubTexture name="checkbox anim0002" x="306" y="4" width="183" height="142"/>
<SubTexture name="checkbox anim0003" x="306" y="4" width="183" height="142"/>
<SubTexture name="checkbox anim0004" x="493" y="4" width="183" height="142"/>
<SubTexture name="checkbox anim0005" x="493" y="4" width="183" height="142"/>
<SubTexture name="checkbox anim0006" x="680" y="4" width="183" height="142"/>
<SubTexture name="checkbox anim0007" x="680" y="4" width="183" height="142"/>
<SubTexture name="checkbox anim0008" x="4" y="150" width="183" height="142"/>
<SubTexture name="checkbox anim0009" x="4" y="150" width="183" height="142"/>
<SubTexture name="checkbox anim reverse0000" x="191" y="150" width="178" height="167" pivotX="28.55" pivotY="29.6"/>
<SubTexture name="checkbox anim reverse0001" x="191" y="150" width="178" height="167"/>
<SubTexture name="checkbox anim reverse0002" x="373" y="150" width="178" height="167"/>
<SubTexture name="checkbox anim reverse0003" x="373" y="150" width="178" height="167"/>
<SubTexture name="checkbox anim reverse0004" x="555" y="150" width="178" height="167"/>
<SubTexture name="checkbox anim reverse0005" x="555" y="150" width="178" height="167"/>
<SubTexture name="checkbox anim reverse0006" x="737" y="150" width="178" height="167"/>
<SubTexture name="checkbox anim reverse0007" x="737" y="150" width="178" height="167"/>
<SubTexture name="checkbox finish0000" x="4" y="321" width="137" height="125" pivotX="3.4" pivotY="11.65"/>
<SubTexture name="checkbox0000" x="355" y="0" width="111" height="108" pivotX="0" pivotY="0"/>
<SubTexture name="checkbox anim0000" x="281" y="345" width="149" height="109" frameX="0" frameY="-24" frameWidth="183" frameHeight="142"/>
<SubTexture name="checkbox anim0001" x="281" y="345" width="149" height="109" frameX="0" frameY="-24" frameWidth="183" frameHeight="142"/>
<SubTexture name="checkbox anim0002" x="0" y="308" width="135" height="116" frameX="-15" frameY="-26" frameWidth="183" frameHeight="142"/>
<SubTexture name="checkbox anim0003" x="0" y="308" width="135" height="116" frameX="-15" frameY="-26" frameWidth="183" frameHeight="142"/>
<SubTexture name="checkbox anim0004" x="157" y="167" width="126" height="107" frameX="-31" frameY="-25" frameWidth="183" frameHeight="142"/>
<SubTexture name="checkbox anim0005" x="157" y="167" width="126" height="107" frameX="-31" frameY="-25" frameWidth="183" frameHeight="142"/>
<SubTexture name="checkbox anim0006" x="136" y="281" width="144" height="135" frameX="-39" frameY="0" frameWidth="183" frameHeight="142"/>
<SubTexture name="checkbox anim0007" x="136" y="281" width="144" height="135" frameX="-39" frameY="0" frameWidth="183" frameHeight="142"/>
<SubTexture name="checkbox anim0008" x="284" y="218" width="138" height="126" frameX="-34" frameY="-13" frameWidth="183" frameHeight="142"/>
<SubTexture name="checkbox anim0009" x="284" y="218" width="138" height="126" frameX="-34" frameY="-13" frameWidth="183" frameHeight="142"/>
<SubTexture name="checkbox anim reverse0000" x="355" y="109" width="111" height="108" frameX="-28" frameY="-29" frameWidth="178" frameHeight="167"/>
<SubTexture name="checkbox anim reverse0001" x="355" y="109" width="111" height="108" frameX="-28" frameY="-29" frameWidth="178" frameHeight="167"/>
<SubTexture name="checkbox anim reverse0002" x="0" y="164" width="156" height="143" frameX="-10" frameY="-10" frameWidth="178" frameHeight="167"/>
<SubTexture name="checkbox anim reverse0003" x="0" y="164" width="156" height="143" frameX="-10" frameY="-10" frameWidth="178" frameHeight="167"/>
<SubTexture name="checkbox anim reverse0004" x="0" y="0" width="175" height="163" frameX="-1" frameY="-1" frameWidth="178" frameHeight="167"/>
<SubTexture name="checkbox anim reverse0005" x="0" y="0" width="175" height="163" frameX="-1" frameY="-1" frameWidth="178" frameHeight="167"/>
<SubTexture name="checkbox anim reverse0006" x="176" y="0" width="178" height="166" frameX="0" frameY="0" frameWidth="178" frameHeight="167"/>
<SubTexture name="checkbox anim reverse0007" x="176" y="0" width="178" height="166" frameX="0" frameY="0" frameWidth="178" frameHeight="167"/>
<SubTexture name="checkbox finish0000" x="284" y="218" width="138" height="126"/>
</TextureAtlas>
Binary file modified src/love/images/png/menu/checkboxanim.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
42 changes: 20 additions & 22 deletions src/love/images/png/menu/checkboxanim.xml
Original file line number Diff line number Diff line change
@@ -1,25 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<TextureAtlas imagePath="checkboxanim.png">
<!-- Created with Adobe Animate version 21.0.1.37179 -->
<!-- http://www.adobe.com/products/animate.html -->
<SubTexture name="checkbox0000" x="4" y="4" width="111" height="108" pivotX="0" pivotY="0"/>
<SubTexture name="checkbox anim0000" x="119" y="4" width="183" height="142" pivotX="38.45" pivotY="25.3"/>
<SubTexture name="checkbox anim0001" x="119" y="4" width="183" height="142"/>
<SubTexture name="checkbox anim0002" x="306" y="4" width="183" height="142"/>
<SubTexture name="checkbox anim0003" x="306" y="4" width="183" height="142"/>
<SubTexture name="checkbox anim0004" x="493" y="4" width="183" height="142"/>
<SubTexture name="checkbox anim0005" x="493" y="4" width="183" height="142"/>
<SubTexture name="checkbox anim0006" x="680" y="4" width="183" height="142"/>
<SubTexture name="checkbox anim0007" x="680" y="4" width="183" height="142"/>
<SubTexture name="checkbox anim0008" x="4" y="150" width="183" height="142"/>
<SubTexture name="checkbox anim0009" x="4" y="150" width="183" height="142"/>
<SubTexture name="checkbox anim reverse0000" x="191" y="150" width="178" height="167" pivotX="28.55" pivotY="29.6"/>
<SubTexture name="checkbox anim reverse0001" x="191" y="150" width="178" height="167"/>
<SubTexture name="checkbox anim reverse0002" x="373" y="150" width="178" height="167"/>
<SubTexture name="checkbox anim reverse0003" x="373" y="150" width="178" height="167"/>
<SubTexture name="checkbox anim reverse0004" x="555" y="150" width="178" height="167"/>
<SubTexture name="checkbox anim reverse0005" x="555" y="150" width="178" height="167"/>
<SubTexture name="checkbox anim reverse0006" x="737" y="150" width="178" height="167"/>
<SubTexture name="checkbox anim reverse0007" x="737" y="150" width="178" height="167"/>
<SubTexture name="checkbox finish0000" x="4" y="321" width="137" height="125" pivotX="3.4" pivotY="11.65"/>
<SubTexture name="checkbox0000" x="355" y="0" width="111" height="108" pivotX="0" pivotY="0"/>
<SubTexture name="checkbox anim0000" x="281" y="345" width="149" height="109" frameX="0" frameY="-24" frameWidth="183" frameHeight="142"/>
<SubTexture name="checkbox anim0001" x="281" y="345" width="149" height="109" frameX="0" frameY="-24" frameWidth="183" frameHeight="142"/>
<SubTexture name="checkbox anim0002" x="0" y="308" width="135" height="116" frameX="-15" frameY="-26" frameWidth="183" frameHeight="142"/>
<SubTexture name="checkbox anim0003" x="0" y="308" width="135" height="116" frameX="-15" frameY="-26" frameWidth="183" frameHeight="142"/>
<SubTexture name="checkbox anim0004" x="157" y="167" width="126" height="107" frameX="-31" frameY="-25" frameWidth="183" frameHeight="142"/>
<SubTexture name="checkbox anim0005" x="157" y="167" width="126" height="107" frameX="-31" frameY="-25" frameWidth="183" frameHeight="142"/>
<SubTexture name="checkbox anim0006" x="136" y="281" width="144" height="135" frameX="-39" frameY="0" frameWidth="183" frameHeight="142"/>
<SubTexture name="checkbox anim0007" x="136" y="281" width="144" height="135" frameX="-39" frameY="0" frameWidth="183" frameHeight="142"/>
<SubTexture name="checkbox anim0008" x="284" y="218" width="138" height="126" frameX="-34" frameY="-13" frameWidth="183" frameHeight="142"/>
<SubTexture name="checkbox anim0009" x="284" y="218" width="138" height="126" frameX="-34" frameY="-13" frameWidth="183" frameHeight="142"/>
<SubTexture name="checkbox anim reverse0000" x="355" y="109" width="111" height="108" frameX="-28" frameY="-29" frameWidth="178" frameHeight="167"/>
<SubTexture name="checkbox anim reverse0001" x="355" y="109" width="111" height="108" frameX="-28" frameY="-29" frameWidth="178" frameHeight="167"/>
<SubTexture name="checkbox anim reverse0002" x="0" y="164" width="156" height="143" frameX="-10" frameY="-10" frameWidth="178" frameHeight="167"/>
<SubTexture name="checkbox anim reverse0003" x="0" y="164" width="156" height="143" frameX="-10" frameY="-10" frameWidth="178" frameHeight="167"/>
<SubTexture name="checkbox anim reverse0004" x="0" y="0" width="175" height="163" frameX="-1" frameY="-1" frameWidth="178" frameHeight="167"/>
<SubTexture name="checkbox anim reverse0005" x="0" y="0" width="175" height="163" frameX="-1" frameY="-1" frameWidth="178" frameHeight="167"/>
<SubTexture name="checkbox anim reverse0006" x="176" y="0" width="178" height="166" frameX="0" frameY="0" frameWidth="178" frameHeight="167"/>
<SubTexture name="checkbox anim reverse0007" x="176" y="0" width="178" height="166" frameX="0" frameY="0" frameWidth="178" frameHeight="167"/>
<SubTexture name="checkbox finish0000" x="284" y="218" width="138" height="126"/>
</TextureAtlas>
25 changes: 23 additions & 2 deletions src/love/modules/graphics.lua
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ return {
danceSpeed = optionsTable and optionsTable.danceSpeed or 2,
danceIdle = optionsTable and optionsTable.danceIdle or false,
maxHoldTimer = optionsTable and optionsTable.maxHoldTimer or 0.1,
align = optionsTable and optionsTable.align or "center",

visible = true,

Expand Down Expand Up @@ -429,6 +430,26 @@ return {
love.graphics.setStencilTest("greater", 0)
end

local ox, oy = 0, 0

-- tbh idk why anyone would use this but its here
if self.align == "center" then
ox = width + anim.offsetX + self.offsetX
oy = height + anim.offsetY + self.offsetY
elseif self.align == "top left" then
ox = anim.offsetX + self.offsetX
oy = anim.offsetY + self.offsetY
elseif self.align == "top right" then
ox = frameData[self.curFrame].width - width + anim.offsetX + self.offsetX
oy = anim.offsetY + self.offsetY
elseif self.align == "bottom left" then
ox = anim.offsetX + self.offsetX
oy = frameData[self.curFrame].height - height + anim.offsetY + self.offsetY
elseif self.align == "bottom right" then
ox = frameData[self.curFrame].width - width + anim.offsetX + self.offsetX
oy = frameData[self.curFrame].height - height + anim.offsetY + self.offsetY
end

if self.visible then
love.graphics.draw(
sheet,
Expand All @@ -438,8 +459,8 @@ return {
self.orientation,
self.sizeX * (self.flipX and -1 or 1),
self.sizeY,
width + anim.offsetX + self.offsetX,
height + anim.offsetY + self.offsetY,
ox,
oy,
self.shearX,
self.shearY
)
Expand Down
2 changes: 1 addition & 1 deletion src/love/modules/overrides.lua
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ love.run = love.system.getOS() ~= "NX" and function()
local delta1 = love.timer.getTime() - m1 -- measure the time at the end of the main iteration and calculate delta
if love.timer then love.timer.sleep(1/love._fps_cap-delta1) end
end
end
end or love.run

function love.setFpsCap(fps)
love._fps_cap = fps or 60
Expand Down

0 comments on commit 1f2ba12

Please sign in to comment.