Createscreen/Usescreen Benefit

Previous topic - Next topic

XanthorXIII

Generally I have a semi working game but I'm always looking for ways to improve it. I noticed the Createscreen/Usescreen and while I understand how to use them is there a benefit to using them?
I was almost thinking about something like a Pause Screen or Menus.
Does anyone have some good uses for them?
Owlcat has wise

Kitty Hello

Well, it's the best way to modify the contents of a sprite image.

Gary

On one of my projects I have a menu that pops up over the current screen. Basically I have a single draw routine that ends with showscreen but if I am into the menu I draw the screen, grab it as a sprite then use that sprite as a background to my menu. Rather than having to keep draw every component on the main screen that will never change as the software is paused I can just use a single draw to display the copy and then do all the overlays

The increase in speed is well worth the time and effort setting it up

matchy

Createscreen is (and should be) a great substitute for Loadsprite where media is created internally. In this case I guess it is perfect for creating menu buttons of a certain colour at init, for example.

In the meantime, I wish for a 'Createfont' command.  :blink:

Kitty Hello

Hehe. That would be quite complicated. I think I make a FONT2SPRITE and SPRITE2FONT command, that can copy a sprite to a font and vice versa.

Slydog

Another situation I needed CREATESCREEN is when I needed to use the 'X_SPRITE' command.
It requites it's own sprite, but the sprite I was using was part of a larger sprite sheet.
I had to copy the portion to a screen to create a new sprite.

I was considering using CREATESCREEN for menus also, since once created they are static, generally.
Except if you have a 'touch' state (ie, make button red while clicking) or other animation.
The code to handle creating the static sprite complicates the process somewhat so I haven't done it.
Plus, since it's just a menu, speed isn't that important.
It makes the code easier to read and modify using an 'immediate mode' style gui, which is why I choose not to change it.

An in game HUD may be different.  Now I draw all HUD objects each frame, even the static ones.
(I'm using a custom font routine which takes two polys per character, which could add up).
I could predraw all static HUD elements to a sprite and just use that.
I actually may do this if I need a few more frames per second.
My current project (WIP) :: TwistedMaze <<  [Updated: 2015-11-25]

kaiserpc

Quote from: Gary_Leeds on 2011-May-05
On one of my projects I have a menu that pops up over the current screen. Basically I have a single draw routine that ends with showscreen but if I am into the menu I draw the screen, grab it as a sprite then use that sprite as a background to my menu. Rather than having to keep draw every component on the main screen that will never change as the software is paused I can just use a single draw to display the copy and then do all the overlays

The increase in speed is well worth the time and effort setting it up

didn't know of these commands - I also have points in the game where I display a menu over my game screen - this should be really useful for this :-)

Crivens

On a downside I had a routine that used createscreen/usescreen for an effect and while it worked on my desktop and iDevices, it didn't work at all on an older laptop (ATI 9800GT Turbo graphics card I believe from about 2005 - capable of just about getting away with Doom 3 at 1920x1200 but obviously lacking in some more modern functions). I double checked and none of the createscreen commands worked with the older laptop.

Cheers
Current fave quote: Cause you like musicians and I like people with boobs.

doimus

I wasn't aware that create/usescreen wasn't working on older cards. I tested it on a netbook with intel 945 and it worked. I thought if it worked on that, it'll work anywhere...

I currently use it big time in an old-skool adventure project. Basically, the game runs in 320x200 on virtual screen and then the whole "screen" is drawn with STRETCHSPRITE.
That way I keep the retro feeling with some nice features.
I hope it will work on mobile devices, as roughly 98.76% of my game ideas are based on resolutions 320x200 and lower.  :)

Crivens

This was a while back so maybe it has improved since. I also found another graphic glitch on the same computer where sometimes I would need to print twice to get text showing. It is a pretty old (2005) ATI card though, but pretty powerful for a laptop at the time. I've always found an alternative solution though so it doesn't bother me.

Cheers
Current fave quote: Cause you like musicians and I like people with boobs.

XanthorXIII

Good examples guys. This gave me an idea for setting up a pause screen and several other things.
Say if you were doing a comic you could draw ahead one page and have that partially displayed off to the side, then when you swipe your finger to move right, the sprite could move left along with your finger.
with your finger and the next page could be drawn on a new Sprite.
Owlcat has wise

Slydog

For my 'swipe' routines, I used VIEWPORTs.
I just created a viewport as wide as the number of entries and scrolled along inside the viewport.
(I could have just created a viewport 3x as wide as one item and when scrolled one page, update everything manually)

Using CREATESCREEN is promising too, and may simplify the code.
Plus you could do sprite animation and / or effects.
Like a 'paper/page' effect if you use polygons instead.
You would draw the polygons non-rectangular to look like a page coming towards you and then going down and resting on the other side.

I'll keep that in mind for future changes.
My current project (WIP) :: TwistedMaze <<  [Updated: 2015-11-25]

spacefractal

They are vrey great commands and I use them too. One of them is actuelly for memory saving and to save fillrate. They can't been used for realtime, but have various other uses.

I example have 3-4 very big static images and would scaling down in each frame. If I done that realtime, I guess its would kill fillrate on iPhone and such systems. But since its final picutre is really a static image, then I simply just combine them into one picture under loading, and then use that as a background picture (using the current user resolution of course to avoid overdraw).

Here those commands is very great doing that....

PS. So Yes I have started a project, but nothing shown yet.

Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/