@Jasoco: Ah, ok, that makes sense. As a side note, I noticed you worked on your own game engine (viewtopic.php?f=5&t=888&start=350). It doesn't run when I try to open it (it seems to be a directory-related problem). I was just wondering if you were still working on it or if you had a working version. I'm really interested since I'm planning on eventually creating an RPG framework, though I won't try to create my own editors (Tiled does a great job at that).
@coffee: Currently, I'm cleaning up and commenting the code. Once that's done, I'll check for bugs, and then make it more independent following Jasoco's suggestions. I just don't want to put something up and have people pick it apart when I already know it has problems.
Navi - a message library (6/11 demo)
Re: A message system
That's ok. I saw you announcing/posting so many changes but didn't saw new uploads here in thread. I thought that you already were uploading it to git instead. Take your time.litearc wrote:@coffee: Currently, I'm cleaning up and commenting the code. Once that's done, I'll check for bugs, and then make it more independent following Jasoco's suggestions. I just don't want to put something up and have people pick it apart when I already know it has problems.
Re: A message system
Hi litearc!
Not sure the use of '|n' works the way you intended.
If '|n' is placed in the string, the resulting text box will have a line break at that point AND a subsiquent line break at the point where the line would have wraped if no '|n' had been inserted - leaving a line fragment.
tttttt|n|tttaaaaa (where the line would normally break at 9 characters)
becomes:
tttttt
ttt --<= a line fragment which should be included on next line
aaaaa
Would rather have the capability of doing:
ttttttt
ttttttt
ttttttt
The code controling line breaks are as as follows:
and the additional line break is the added by the subsiquent code:
Just in case that this behavior is not what you want.
Not sure the use of '|n' works the way you intended.
If '|n' is placed in the string, the resulting text box will have a line break at that point AND a subsiquent line break at the point where the line would have wraped if no '|n' had been inserted - leaving a line fragment.
tttttt|n|tttaaaaa (where the line would normally break at 9 characters)
becomes:
tttttt
ttt --<= a line fragment which should be included on next line
aaaaa
Would rather have the capability of doing:
ttttttt
ttttttt
ttttttt
The code controling line breaks are as as follows:
Code: Select all
for i = 1, #s do
if s:sub(i,i) == ' ' then -- find word break for wrapping
if si and sj and fontw(b:sub(bj,j-1)) > w then -- there must be at least one ' ' before this
ss = ss .. s:sub(bi,si-1) .. '|n' -- add line break
bi = si+1
bj = sj+1
end
si = i
sj = j
end
Code: Select all
elseif z == '|n' then
b = s:sub(j,i-1)
dx,dy = -xc,fonth
Re: A message system
Thanks Ref! If you add this at the top of the loop, it fixes it:
Code: Select all
-- handle when there's already a newline
if s:sub(i,i+1) == '|n' then
ss = ss .. s:sub(bi,i+1)
j = j-2
si = i+1
sj = j
bi = si+1
bj = sj+1
end
Re: A message system
I sort of figured that out but your code is much better.
Attached is my attempt to see how far I could push the existing code (definitely not an end product or attempt to steal your thunder.)
Waiting for rolling text in a box {O^O}
Thanks
Attached is my attempt to see how far I could push the existing code (definitely not an end product or attempt to steal your thunder.)
Waiting for rolling text in a box {O^O}
Thanks
- Attachments
-
- MessageBoxes.love
- Just a demo!
- (5.13 KiB) Downloaded 118 times
- Jasoco
- Inner party member
- Posts: 3726
- Joined: Mon Jun 22, 2009 9:35 am
- Location: Pennsylvania, USA
- Contact:
Re: A message system
That particular project is on hold to be redone later.litearc wrote:@Jasoco: Ah, ok, that makes sense. As a side note, I noticed you worked on your own game engine (viewtopic.php?f=5&t=888&start=350). It doesn't run when I try to open it (it seems to be a directory-related problem). I was just wondering if you were still working on it or if you had a working version. I'm really interested since I'm planning on eventually creating an RPG framework, though I won't try to create my own editors (Tiled does a great job at that).
Re: A message system
Hey, here is what I have currently. I added a few more features in, but I have not yet made the library independent (sorry Jasoco). I will do that in the final release. I initially wanted this to be the final release but Ref suggested to use a Canvas to display the message, which will be cleaner and possibly faster, but will require big changes to the system. So I decided to release the current canvas-free message system before making those changes.
- Attachments
-
- arc.love
- (231.52 KiB) Downloaded 112 times
- Roland_Yonaba
- Inner party member
- Posts: 1563
- Joined: Tue Jun 21, 2011 6:08 pm
- Location: Ouagadougou (Burkina Faso)
- Contact:
Re: A message system
Holy ****! I Love it.
As in the screenies.
Keep on!
Also, no performance issues, I get around 320-330 fps running this.
Much Löve!
Do this, and I'll shoot myself.
My graphic card doesn't support Canvas...
Optionnally, you can make two release, Canvas one, and Canvas-free one...?
Yet, code require some cleaning, mostly about the use of locals, as I mentionned before.
But I guess that'll be on the final release...
By the way, your table.print function could be minified using table.concat.
As in the screenies.
Keep on!
Also, no performance issues, I get around 320-330 fps running this.
Much Löve!
Whaaaaaaaaaaaaaaaaaaaat ?litearc wrote:I initially wanted this to be the final release but Ref suggested to use a Canvas to display the message, which will be cleaner and possibly faster,
Do this, and I'll shoot myself.
My graphic card doesn't support Canvas...
Optionnally, you can make two release, Canvas one, and Canvas-free one...?
Yet, code require some cleaning, mostly about the use of locals, as I mentionned before.
But I guess that'll be on the final release...
By the way, your table.print function could be minified using table.concat.
Last edited by Roland_Yonaba on Tue Jun 05, 2012 10:15 am, edited 1 time in total.
Re: A message system
I'm a bit incredulous. I think you going then in the wrong direction. Even that my computer support it, there is still some other people machines that don't support that. So I as a "coder" think that wouldn't be wise/safe use in a project of mine a 3rd party-library that would require use canvas. Honestly I don't see a technical necessity in your project for use that.litearc wrote:Hey, here is what I have currently. I added a few more features in, but I have not yet made the library independent (sorry Jasoco). I will do that in the final release. I initially wanted this to be the final release but Ref suggested to use a Canvas to display the message, which will be cleaner and possibly faster, but will require big changes to the system. So I decided to release the current canvas-free message system before making those changes.
- Roland_Yonaba
- Inner party member
- Posts: 1563
- Joined: Tue Jun 21, 2011 6:08 pm
- Location: Ouagadougou (Burkina Faso)
- Contact:
Who is online
Users browsing this forum: No registered users and 3 guests