Sprite sheet in GUI?!? [solved]
by Max Kielland · in Torque Game Builder · 01/23/2013 (4:10 pm) · 5 replies
I have managed to create a HUD on top of my game screen. Now I want to display the same graphical elements that I use in my tile layer's sprite sheet (static sprite cells).
I haven't found any GUI control that can take a cell from a static sprite sheet, they all seems to refere to a single bitmap image.
The closest I found is the GuiChunkedBitmapCtrl, but how do I select what cell to display?!?
I haven't found any GUI control that can take a cell from a static sprite sheet, they all seems to refere to a single bitmap image.
The closest I found is the GuiChunkedBitmapCtrl, but how do I select what cell to display?!?
About the author
Owner of MK Development www.mkdevelopment.se
#2
So in the GUI builder, I add a new t2dSceneWindow over my hud.
Then in the GameStartup I create a t2dStaticSprite in that HUD sceneWindow and assigns my TileSprites to the created HUD t2dStaticSprite.
I will try the approach you suggest...
01/24/2013 (2:46 am)
I see what you mean.So in the GUI builder, I add a new t2dSceneWindow over my hud.
Then in the GameStartup I create a t2dStaticSprite in that HUD sceneWindow and assigns my TileSprites to the created HUD t2dStaticSprite.
I will try the approach you suggest...
#3
01/24/2013 (4:43 am)
The upcoming release of T2D MIT has GUI controls that can use sprites images and animations. For the older tech, Richard's suggestion is the best approach.
#4
In the StartGame() I attached the sceneGraph to my HUD scene.
Then I only point the camera on the tile I want to display. The advantage of this is that it will also display any layers on top of the tile grid.
01/24/2013 (4:52 am)
While I was investigating how to use the second t2dSceneWindow I came up with a nice variant of what I'm trying to accomplish.%graph = sceneWindow2D.loadLevel(%level);
TileSprite_sceneWindow2D.setSceneGraph(%graph);
TileSprite_sceneWindow2D.setCurrentCameraPosition("-100 0 0 0"); // Start offscreenIn the StartGame() I attached the sceneGraph to my HUD scene.
%camera = FactoryTileMap.getTileWorldPosition(%tile)@" 10 10"; TileSprite_sceneWindow2D.setCurrentCameraPosition(%camera);
Then I only point the camera on the tile I want to display. The advantage of this is that it will also display any layers on top of the tile grid.
#5
@Max - there are many tricks you can pull with scene windows, they're pretty handy. T2D MIT will provide simpler solutions for some of those tricks (as Mich mentioned) and has tons of new functionality that should keep people happy for a minute or two.
01/24/2013 (6:42 am)
@Mich - I thought about mentioning that, but I would have also had to mention all the work it would take to port his current project to use them.... I was trying not to demoralize the guy. ;p@Max - there are many tricks you can pull with scene windows, they're pretty handy. T2D MIT will provide simpler solutions for some of those tricks (as Mich mentioned) and has tons of new functionality that should keep people happy for a minute or two.
Torque Owner Richard Ranft
Roostertail Games