Discussion:
[directfb-users] scrolling text : question
Sagaert Johan
2012-04-16 22:25:57 UTC
Permalink
Hi

I am relatively new to directFB and i am struggling to create a scrolling text.

My screen is 320*240 and now i draw a text at a position x40, y60

Because the screen is small and i need to display strings that can not fit the screen size i want to create a scrolling text.

As i understand it i need to create a subsurface and draw my string in that subsurface and apply clipping in some way.
The text should never be drawn in parts outside the window i want.

I am not quite sure if this is the right approach, can someone point me in the right direction or give some hints ?

0.0
_______________________________________________________0,320
| |
| |
| |
| |
| +-------------------------------+ |
| | | |
| | text should appear here | |
| | and i would scroll it by | |
| | changing x,y draw position. | |
| +-------------------------------+ |
| |
_________________________________________________________320,240

Sagaert Johan

Thanks
Ezequiel García
2012-04-17 19:17:56 UTC
Permalink
Hi,
Post by Sagaert Johan
I am relatively new to directFB and i am struggling to create a scrolling text.
Yes you are in the right direction.

I maintain a Lua binding for DirectFB [1],
and I've created a small example [2] to show you exactly how a scrolling
window can be done. I used this approach for a Closed Caption STB module.

I apologise for having the example in directfb-lua, rather than plain C.
It's because Lua allows for readable, compact code (and to showoff
the binding a little, the example is just 100 lines :) and it allows
for fast debugging and testing.

I'm sure you'll be able to translate this to C, since it uses the *same* syntax
as DirectFB library (per design).
Also, you can also give it a shot as it is! It should compile right
out of the box.
Feel free to report any issues.

Hope it helps,
Ezequiel.

[1] https://github.com/ezequielgarcia/directfb-lua/
[2] https://github.com/ezequielgarcia/directfb-lua/blob/master/examples/scroll.lua
Sagaert Johan
2012-04-17 22:20:55 UTC
Permalink
Hi Ezequiel

Thanks very much for the reply !

I do not know lua but i recognise the structure easely.

In the mean time i did some further coding and i made it working by creating a subsurface for the text instead of using clipping.
And then i made a clipping version also.

I think the clipping version is the least expensive in cpu terms.
I'am running it on a 200Mhz ARM9 (at91sam9261) so i need to take this in mind....

Thanks , Johan

Short video :



-----Oorspronkelijk bericht-----
Van: Ezequiel García [mailto:***@gmail.com]
Verzonden: dinsdag 17 april 2012 21:18
Aan: Sagaert Johan
CC: directfb-***@directfb.org
Onderwerp: Re: [directfb-users] scrolling text : question

Hi,
Post by Sagaert Johan
I am relatively new to directFB and i am struggling to create a scrolling text.
Yes you are in the right direction.

I maintain a Lua binding for DirectFB [1], and I've created a small example [2] to show you exactly how a scrolling window can be
done. I used this approach for a Closed Caption STB module.

I apologise for having the example in directfb-lua, rather than plain C.
It's because Lua allows for readable, compact code (and to showoff the binding a little, the example is just 100 lines :) and it
allows for fast debugging and testing.

I'm sure you'll be able to translate this to C, since it uses the *same* syntax as DirectFB library (per design).
Also, you can also give it a shot as it is! It should compile right out of the box.
Feel free to report any issues.

Hope it helps,
Ezequiel.

[1] https://github.com/ezequielgarcia/directfb-lua/
[2] https://github.com/ezequielgarcia/directfb-lua/blob/master/examples/scroll.lua
Ezequiel García
2012-04-18 13:41:59 UTC
Permalink
Hi,
Post by Sagaert Johan
http://youtu.be/fNlbHnq391I
That looks nice!

Good luck,
Ezequiel.

Loading...