-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TODO: unbreak onBorderDraw
- Loading branch information
Showing
7 changed files
with
131 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
---@class Border.spinnysquare: Border | ||
local SpinnySquare, super = Class(Border) | ||
|
||
function SpinnySquare:init() | ||
super.init(self) | ||
end | ||
|
||
function SpinnySquare:drawRect(max_depth, white) | ||
if max_depth < 0 then return end | ||
love.graphics.push("all") | ||
if white then | ||
Draw.setColor(1,1,1) | ||
else | ||
Draw.setColor(0.2,0.2,0.2) | ||
end | ||
love.graphics.scale( | ||
Utils.clampMap( | ||
math.sin(Kristal.getTime()), | ||
-1, 1, 0.6, 0.93 | ||
) | ||
) | ||
love.graphics.rotate(math.rad(20)) | ||
love.graphics.rectangle("fill", -1000*BORDER_SCALE, -1000*BORDER_SCALE, 1000*2*BORDER_SCALE, 1000*2*BORDER_SCALE) | ||
self:drawRect(max_depth - 1, not white) | ||
love.graphics.pop() | ||
end | ||
|
||
function SpinnySquare:draw() | ||
love.graphics.push("all") | ||
love.graphics.translate(1920*0.5*BORDER_SCALE, 1080*0.5*BORDER_SCALE) | ||
love.graphics.scale(2) | ||
love.graphics.rotate(math.rad(Kristal.getTime() * 20)) | ||
|
||
self:drawRect(20, true) | ||
love.graphics.pop() | ||
-- TODO: find a better way to add the fading | ||
Draw.setColor(COLORS.black, 1-BORDER_ALPHA) | ||
love.graphics.rectangle("fill", -love.graphics.getWidth(), -love.graphics.getHeight(), love.graphics.getWidth()*2, love.graphics.getHeight()*2) | ||
end | ||
|
||
return SpinnySquare |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
---@class Border: Class | ||
local Border = Class() | ||
|
||
function Border:init() | ||
end | ||
|
||
function Border:draw() | ||
end | ||
|
||
return Border |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
---@class ImageBorder: Border | ||
---@overload fun(texture:love.Image|string, id?: string) | ||
local ImageBorder, super = Class(Border) | ||
|
||
function ImageBorder:init(texture, path) | ||
super.init(self) | ||
if type(texture) == "string" then | ||
texture = Assets.getTexture("borders/"..texture) | ||
path = texture | ||
end | ||
self.texture = texture | ||
self.id = path | ||
end | ||
|
||
function ImageBorder:draw() | ||
super.draw(self) | ||
Draw.draw(self.texture, 0, 0, 0, BORDER_SCALE) | ||
end | ||
|
||
return ImageBorder |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters