Solarus-Games English Forum

Solarus => Development => Topic started by: MetalZelda on November 09, 2015, 04:52:18 PM

Title: Is Surface bellow layers possible ?
Post by: MetalZelda on November 09, 2015, 04:52:18 PM
Hi.

Does Solarus accept drawable objects (surface) to be bellow all layers ? I do have checked the API http://www.solarus-games.org/doc/latest/lua_api_surface.html and it doesn't seems to have some parameters like putting it on a certain layer or bellow
http://www.solarus-games.org/doc/latest/lua_api_drawable.html#lua_api_drawable_draw_region
This would be cool if there were a parameter "height" in drawable:draw (desired layer or top or bellow all)

Example of use :
This could be useful for auto-scrolling backgrounds
Title: Re: Is Surface bellow layers possible ?
Post by: Christopho on November 09, 2015, 05:11:30 PM
Not really. You have to use an additional layer for the background. Solarus 1.5 will allow unlimited layers.
Title: Re: Is Surface bellow layers possible ?
Post by: MetalZelda on November 09, 2015, 05:13:17 PM
That's a good news though
Title: Re: Is Surface bellow layers possible ?
Post by: Christopho on November 09, 2015, 05:25:17 PM
To allow custom background, there should be new events map:on_pre_draw() and map:on_post_draw(). For now there is only map:on_draw(), which occurs after the map is drawn and before its menus are drawn.
A problem is that the background color of the tileset should not overwrite what is done in map:on_pre_draw(). Maybe the background color of the tileset should be optional, or maybe defining it should become a default background in case map:on_pre_draw() is not defined?
Title: Re: Is Surface bellow layers possible ?
Post by: MetalZelda on November 09, 2015, 05:57:41 PM
Quote from: Christopho on November 09, 2015, 05:25:17 PM
To allow custom background, there should be new events map:on_pre_draw() and map:on_post_draw(). For now there is only map:on_draw(), which occurs after the map is drawn and before its menus are drawn.
A problem is that the background color of the tileset should not overwrite what is done in map:on_pre_draw(). Maybe the background color of the tileset should be optional, or maybe defining it should become a default background in case map:on_pre_draw() is not defined?

Hmmm, I was talking about image-based background, for the color that might be the same thing