Author Topic: Is Surface bellow layers possible ?  (Read 3921 times)

0 Members and 1 Guest are viewing this topic.

MetalZelda

  • Hero Member
  • *****
  • Posts: 551
    • View Profile
Is Surface bellow layers possible ?
« 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
« Last Edit: November 09, 2015, 04:56:45 PM by Username »

Christopho

  • Administrator
  • Hero Member
  • *****
  • Posts: 1194
    • View Profile
Re: Is Surface bellow layers possible ?
« Reply #1 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.

MetalZelda

  • Hero Member
  • *****
  • Posts: 551
    • View Profile
Re: Is Surface bellow layers possible ?
« Reply #2 on: November 09, 2015, 05:13:17 PM »
That's a good news though

Christopho

  • Administrator
  • Hero Member
  • *****
  • Posts: 1194
    • View Profile
Re: Is Surface bellow layers possible ?
« Reply #3 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?

MetalZelda

  • Hero Member
  • *****
  • Posts: 551
    • View Profile
Re: Is Surface bellow layers possible ?
« Reply #4 on: November 09, 2015, 05:57:41 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