Believe it or not, it still has its uses.
Hint: some mail browsers deactivate all CSS rules they find on emails.
a Rich Text library for LÖVE
- kikito
- Inner party member
- Posts: 3153
- Joined: Sat Oct 03, 2009 5:22 pm
- Location: Madrid, Spain
- Contact:
Re: a Rich Text library for LÖVE
When I write def I mean function.
Re: Idea: RichText
I know it's probably too late for this, but may I propose a kind of lispy syntax? It would be rather easy to parse and also to write:Robin wrote:Code: Select all
rt = rich.new{"{black}Hello {green}world{red}, {smile} how are {{}you} doing? {big}I'm doing fine.", 200, black = {0, 0, 0}, green = {0, 255, 0}, big = love.graphics.newFont(20), red = {255, 0, 0}, smile = love.graphics.newImage('face-laugh.png')}
Code: Select all
rt = rich.new{"{black Hello} {green world}{red,} {smile} how are {{} you} doing? {big I'm doing fine}.", 200, black = {0, 0, 0}, green = {0, 255, 0}, big = love.graphics.newFont(20), red = {255, 0, 0}, smile = love.graphics.newImage('face-laugh.png')}
Code: Select all
{big {blue Hello {red cruel} World}} -- instead of {big}{blue}Hello {red}cruel {blue}World
Code: Select all
modifiers = {}
modifiers["{}"] = function(text) return "{"..text.."}" end
modifiers["big"] = function(text) ... end
modifiers["blue"] = function(text) ... end
...
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: a Rich Text library for LÖVE
Nice idea, however it will be problematic, because it requires the lib to reset the font/color itself, and the feasibility of nesting is doubtful at best. The modifiers make it even worse, because it means you can't just supply a font, but it has to be built by the renderer first.
Help us help you: attach a .love.
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: a Rich Text library for LÖVE
Help us help you: attach a .love.
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: a Rich Text library for LÖVE
Gentlement, friends, lovers.
As the release of LÖVE 0.7.0 creeps ever closer, it's time RT has a proper release as well. For that, I need help with testing.
Grab the library here (raw link). Experiment with it, use it in a new game project of yours, try to break it. From my personal testing, I can say it's fairly stable, but I really miss other people's perspectives here.
So if you are interested in this project, now's the time to help by testing it!
As the release of LÖVE 0.7.0 creeps ever closer, it's time RT has a proper release as well. For that, I need help with testing.
Grab the library here (raw link). Experiment with it, use it in a new game project of yours, try to break it. From my personal testing, I can say it's fairly stable, but I really miss other people's perspectives here.
So if you are interested in this project, now's the time to help by testing it!
Help us help you: attach a .love.
-
- Prole
- Posts: 34
- Joined: Fri Sep 24, 2010 5:46 am
Re: a Rich Text library for LÖVE
I just switched my combat log rendering from native love drawing to rich text. Looks nice so far. One thing I needed to hack into my copy of it was storing the total height of the rendered text on the rich text object so I could access it later -- unless I'm overlooking something I don't see anywhere that's currently stored.
Apart from that it all looks good for my admittedly limited use of it at the moment -- though I've noticed rendering text to a buffer seems to make it extremely ugly and hard to read. That seems to be love wide rather than specific to this library though. I don't suppose anyone knows what's going on there? I can attach screenshots if someone wants.
Apart from that it all looks good for my admittedly limited use of it at the moment -- though I've noticed rendering text to a buffer seems to make it extremely ugly and hard to read. That seems to be love wide rather than specific to this library though. I don't suppose anyone knows what's going on there? I can attach screenshots if someone wants.
Re: a Rich Text library for LÖVE
Just FYI, this is what I get when I run your example code (supplying my own smiley):
Magnified:
Magnified:
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: a Rich Text library for LÖVE
Oh, good. I think I forgot to implement that.luminosity wrote:One thing I needed to hack into my copy of it was storing the total height of the rendered text on the rich text object so I could access it later -- unless I'm overlooking something I don't see anywhere that's currently stored.
EDIT: And done.
Odd, I have never seen that effect. Screenshots would be useful, yes.luminosity wrote:I've noticed rendering text to a buffer seems to make it extremely ugly and hard to read. That seems to be love wide rather than specific to this library though. I don't suppose anyone knows what's going on there? I can attach screenshots if someone wants.
I'm not sure, what this is, but the LÖVE 0.7.0 used to contain a bug regarding text placement. I think it'll work better if you upgrade LÖVE to the latest build.Mud wrote:Just FYI, this is what I get when I run your example code (supplying my own smiley):
Help us help you: attach a .love.
Re: a Rich Text library for LÖVE
I was more concerned with those funky rectangles (which I know is not your library's fault).Robin wrote:I'm not sure, what this is, but the LÖVE 0.7.0 used to contain a bug regarding text placement.
I got the latest from here (7 weeks old). Is there a more recent binary somewhere? I pulled down the source last night, but it doesn't include the libraries it depends on (that I could see) and I was too lazy to dig them up.I think it'll work better if you upgrade LÖVE to the latest build.
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: a Rich Text library for LÖVE
Oh, I thought you enabled debug mode, which draws those rectangles so you can check whether everything's aligned OK.Mud wrote:I was more concerned with those funky rectangles (which I know is not your library's fault).
Oh, that's old. Are you on windows? I think for that you need to wait until rude makes another build, or ask a friendly lover on windows who just happened to have compiled it themselves recently. If you're on Linux, you can probably work with the PPA bartbes has set up.Mud wrote:I got the latest from here (7 weeks old). Is there a more recent binary somewhere? I pulled down the source last night, but it doesn't include the libraries it depends on (that I could see) and I was too lazy to dig them up.
Help us help you: attach a .love.
Who is online
Users browsing this forum: No registered users and 8 guests