Surfaces and Drawing
Moderator: Moderator
Surfaces and Drawing
It doesn't seem like there is any documentation on surfaces or drawing images. I can't even find a good example of how to draw images in the TOME module either. Any example code for drawing an image on a surface?
Re: Surfaces and Drawing
Yes the C code has no luadoc this needs to be fixed :=)
To load an image the simpliest way is to do:
Then you can draw it on an other surface like that:
You can also directly display a surface on screen:
If the surface wont change later you can make an opengl texture from it to speed up rendering:
and display it:
You can actually update the texture if the surface changes (this is how dialogs work internally) this is faster than jsut drawing the surface.
But you probably dont need to optimize just yet
To load an image the simpliest way is to do:
Code: Select all
local img = core.display.loadImage("/data/..../foo.png")
Code: Select all
dest:merge(img, x, y)
Code: Select all
img:toScreen(x, y)
Code: Select all
local tex = im:glTexture()
Code: Select all
tex:toScreen(x, y, w, h)
But you probably dont need to optimize just yet

[tome] joylove: You can't just release an expansion like one would release a Kraken XD
--
[tome] phantomfrettchen: your ability not to tease anyone is simply stunning
--
[tome] phantomfrettchen: your ability not to tease anyone is simply stunning

-
- Higher
- Posts: 71
- Joined: Sun May 23, 2010 9:55 am
Re: Surfaces and Drawing
I see this has not been added to the wiki yet.
This situation has been fixed.
This situation has been fixed.
Re: Surfaces and Drawing
Yeah thanks anta 

[tome] joylove: You can't just release an expansion like one would release a Kraken XD
--
[tome] phantomfrettchen: your ability not to tease anyone is simply stunning
--
[tome] phantomfrettchen: your ability not to tease anyone is simply stunning
