Author Topic: Arrange Surface in Order?  (Read 8555 times)

zeroid

  • Full Member
  • ***
  • Posts: 30
    • View Profile
Arrange Surface in Order?
« on: June 10, 2015, 09:57:26 AM »
Anyway to arrange "Surface" in Front & Back order?

liquid8d

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 442
    • View Profile
Re: Arrange Surface in Order?
« Reply #1 on: June 10, 2015, 10:16:58 AM »
No, but you can create multiple surfaces ahead of time, then draw on the surface you want to create a sort of z-order of surfaces

zeroid

  • Full Member
  • ***
  • Posts: 30
    • View Profile
Re: Arrange Surface in Order?
« Reply #2 on: June 10, 2015, 11:11:56 AM »
thank you

tomek

  • Full Member
  • ***
  • Posts: 29
    • View Profile
    • About Me
Re: Arrange Surface in Order?
« Reply #3 on: August 10, 2015, 01:40:07 AM »
Slightly off topic but related, how do I actually render a surface? They're off screen textures and I can use them to composite graphics but how do I show it?

liquid8d

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 442
    • View Profile
Re: Arrange Surface in Order?
« Reply #4 on: August 10, 2015, 11:25:29 PM »
Well depending on if you mean technically (offscreen) or literally..  they aren't actually "offscreen"..

When you add a surface, you provide a width/height:
Code: [Select]
local mysurface = fe.add_surface(640,480);
By default the surface will be at 0, 0 of its parent (either fe's "surface", or some other surface). So it's already "onscreen", but invisible because nothing has been drawn on it yet. Once you add something to it:
Code: [Select]
mysurface.add_text("My Surface", 0, 0, 640, 30);
You should see the objects on it. Surfaces have no background, so something has to be drawn on it to be seen. You can move your surfaces x/y also if you want, and you should notice that the text would move with it.

Hope that helps!

tomek

  • Full Member
  • ***
  • Posts: 29
    • View Profile
    • About Me
Re: Arrange Surface in Order?
« Reply #5 on: August 11, 2015, 02:01:49 AM »
Thanks for that. I was stumped by the docs:
Quote
A surface is an off- screen texture upon which you can draw other image, artwork, text, listbox and surface objects.


I understood that as an object which you don't see until you decide to show it. But I couldn't see any show/display/render method on the class.


Anyway, I'm getting a pretty good idea of how the system works now. Thanks to you clever folks.


I'll be putting a quick preview of my theme together soon and I'll be sure to post a link to the forum. I'm taking a slightly different approach from most themes in that mine is going to rely heavily on purchased stock material. Background videos and sounds etc. I can highly recommend envato.com as a good source of pretty cheap source material. The only issue is that I won't be able to share any of the digital assets of my theme as the license prohibits me from sharing. But I'll be happy to share the nuts ;-)


cheers,
-tomek

liquid8d

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 442
    • View Profile
Re: Arrange Surface in Order?
« Reply #6 on: August 11, 2015, 10:02:15 AM »
Yeah I figured that might be throwing you off - in developmental terms it's an "offscreen texture" - the program draws all surface objects onto a single texture, then renders that as one texture offscreen - then the one texture is drawn onscreen :)

That's done on the backend though, and in terms of creating the surface, it's immediately drawn to the screen and just needs something on it to be visible in the layout.

Surfaces have a .visible attribute if you want to show/hide them. However there is a bug in the current release where setting visible to false on the surface objects will not work - they will remain visible, but you can trick around that just setting alpha on those objects instead.

Theme sounds great, looking forward to seeing it!

omegaman

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 880
    • View Profile
Re: Arrange Surface in Order?
« Reply #7 on: August 11, 2015, 03:50:20 PM »
Great topic guys, figured I'd chime in. Using surfaces are invaluable when you want to enforce specific resolutions or manipulate artwork with pinch, skew and shader effects. It should practicably be mandatory with the inclusion of web scraping in am. Learned this the hard way, as I assumed everyone used pay sites like EmuMovies or tor to get their artwork. So, the moral of the story is use surfaces if you don't want things to get messy.