Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pfirsich/superprintf_love2d
This is a new printf function for love2d that let's you include images in your text, change colors inside the string and define custom commands.
https://github.com/pfirsich/superprintf_love2d
Last synced: 18 days ago
JSON representation
This is a new printf function for love2d that let's you include images in your text, change colors inside the string and define custom commands.
- Host: GitHub
- URL: https://github.com/pfirsich/superprintf_love2d
- Owner: pfirsich
- License: apache-2.0
- Created: 2015-03-10T22:46:14.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-04-05T10:42:04.000Z (over 9 years ago)
- Last Synced: 2024-04-24T11:15:45.382Z (7 months ago)
- Language: Lua
- Size: 164 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# superprintf_love2d
This is a new printf function for love2d that let's you include images in your text, change colors inside the string and define custom commands.## Usage
> printf = require("printf")> printf["img"]["xbox_a"] = love.graphics.newImage("xbox_button_image_a.png")
> printf("[color:255,0,0,255]This is red text.[n]In a new line, I include an [img:xbox_a] inside the text", 5, 5, 300, "center", 300, "center")
The usage is very similar to love2d's printf only with a few extra parameters and, if given the same parameters, should behave identically (I hope). The important features regarding custom commands and images in the text are used in the main.lua example. Please note that there is also support for vertically and horizontally scrolling text and vertical alignment.
To define your custom commands, just add another key to printf and have a look at printf.lua to see how exactly these functions have to be implemented:
> function printf.red() return printf.color("", {255, 0, 0, 255}) end
If there are any questions or improvements, please let me know!