Game Development Community

Rotating GUIBitmap Object

by kinleong · in Torque X 2D · 07/20/2009 (6:42 am) · 3 replies

Hi all,

I am making a little clock in my game. I would like my clock Needle to rotate to simulate a wall clock. I made both the clock surface and clock needle as a GUIBitmap. However, I couldn't find a property of Rotation like T2DSceneObject.

I tried another way. I wrote a component for rotating the clock needle. In the constructor of defining the clock needle. I added:

_clockPinBitmap.Components.AddComponent(new ClockComponent());

However, the clock needle didn't move. How can I do it? Thanks.


#1
07/20/2009 (10:30 am)
GUI controls, sadly, are a completely different implementation that T2D objects, which means that things you should expect from them are different. GUIBitmaps can't rotate, for example.

Think of GUI Controls as a necessary evil for menu controls (where you need focus and selection), scores (static text), and layout of your T2DSceneviews. If you need fancy behaviors, you either need to:
* Build a custom GUI Control (powerful, but undesireable in most cases)
* Create a small secondary GUISceneview control that just has the T2D stuff for the HUD you are building.

This second bullet is probably what you want. You can have as many T2DSceneviews as you like, which makes managing their scenegraphs and behaviors really simple.
#2
07/20/2009 (10:40 am)
Yeah, for true rotation, you'll need to use scene objects. If you wanted to, you could try having a different bitmap for the needle in different positions and change the bitmaps over time. When I thought about changing bitmaps, that reminded me of Jason's video gui control, which changes based on the frames of a video. If you got a WMV of a clock working, that could be looped. I guess it depends on what you really have in mind for this.
#3
07/20/2009 (10:51 am)
@kinleong - You might also try the airplane tutorial in the official documentation. It has a compass that spins that should be similar to your clock and also shows you how to do the sceneview stuff that Jason is referring to.

Brian