-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
simpler text printing with 2x res support
- Loading branch information
1 parent
f93323b
commit 0474ff5
Showing
9 changed files
with
88 additions
and
49 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
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
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
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
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,32 @@ | ||
|
||
text = {} | ||
|
||
function text.print(txt, x, y) | ||
local _shader = love.graphics.getShader() | ||
love.graphics.setShader(shaders.fontAlias) | ||
love.graphics.print(txt, math.floor(x), math.floor(y)) | ||
love.graphics.setShader(_shader) | ||
end | ||
|
||
function text.printSmall(txt, x, y) | ||
local _canvas = love.graphics.getCanvas() | ||
local _shader = love.graphics.getShader() | ||
setGameCanvas2x() | ||
love.graphics.setShader(shaders.fontAlias) | ||
|
||
love.graphics.push() | ||
-- set camera with 2x screen size | ||
if camera.isSet then | ||
love.graphics.origin() | ||
love.graphics.translate(camera.ssx, camera.ssy) | ||
love.graphics.scale(camera.scale) | ||
love.graphics.rotate(camera.rotation) | ||
love.graphics.translate(-camera.x*2, -camera.y*2) | ||
end | ||
|
||
love.graphics.print(txt, math.floor(x*2), math.floor(y*2)) | ||
|
||
love.graphics.pop() | ||
love.graphics.setCanvas(_canvas) | ||
love.graphics.setShader(_shader) | ||
end |