Code: (Select All)
Screen _NewImage(800, 600, 32)
red = _NewImage(200, 200, 32)
green = _NewImage(200, 200, 32)
blue = _NewImage(200, 200, 32)
'color the screens the proper colors
Cls , &HFFFF0000&&, red
Cls , &HFF00FF00&&, green
Cls , &HFF0000FF&&, blue
green_hw = _CopyImage(green, 33)
blue_hw = _CopyImage(blue, 33)
Do
Cls , 0
k = _KeyHit
Select Case k
Case 18432, 19712: o = o + 1
Case 19200, 20480: o = o - 1
Case 27, 32: System
End Select
If o < 0 Then o = 5
If o > 5 Then o = 0
Print "ORDER "; o;
Select Case o
Case 0
_DisplayOrder _Software , _Hardware , _Hardware1
Print " _DisplayOrder _Software , _Hardware , _Hardware1"
Case 1
_DisplayOrder _Software , _Hardware1 , _Hardware
Print " _DisplayOrder _Software , _Hardware1 , _Hardware"
Case 2
_DisplayOrder _Hardware , _Software , _Hardware1
Print " _DisplayOrder _Hardware , _Software , _Hardware1"
Case 3
_DisplayOrder _Hardware1 , _Software , _Hardware
Print " _DisplayOrder _Hardware1 , _Software , _Hardware"
Case 4
_DisplayOrder _Hardware , _Hardware1 , _Software
Print " _DisplayOrder _Hardware , _Hardware1 , _Software"
Case 5
_DisplayOrder _Hardware1 , _Hardware , _Software
Print " _DisplayOrder _Hardware1 , _Hardware , _Software"
End Select
_PutImage (100, 100), red
_PutImage (150, 150), green_hw
_PutImage (100, 150), blue_hw, 1
_Display
_Limit 30
Loop
A quick and simply little demo to showcase layering with our software screens and hardware screens.
Notice that this makes three simple boxes for us -- red, green, and blue.
It places them on the screen so they overlap each other.
At this point, you can now use the arrow keys to change the display order of those boxes. Each layer is independent of all the others, and we can stack them however we want just by changing the displayorder.
I was thinking this might be simple enough and help @Unseen Machine sort out the basics of hardware images and how to use them. In a game, something like this could be used to layer one hardware image for the background (clouds and buildings and such behind the moving characters and mobs). Then the software layer would usually be the moving parts (such as the player and enemies or bullets or whatnot). Then the next hardware layer would normally be the bushes or items which the character might hide behind.
Three layers, each working independently, but put together to make it seem like the hero is in the middle of whatever scene is on the screen. He's in front of the background sky, by behind the upclose bushes, and dealing with the enemies on the street.


