Home | About | Account | Forums | Games
Guest   | Login
  Index  | Recent Threads  | Register  | Search  | Help  | RSS feeds  | View Unanswered Threads  
  Search  


Quick Go »
Thread Status: Normal
Forum Status: Locked
Total posts in this thread: 1
[Add To My Favorites] [Watch this Thread]
Author
Previous Thread This topic has been viewed 1129 times and has 0 replies Next Thread
hdctambien
Stranger
Member's Avatar


Joined: Sep 25, 2006
Posts: 4
Status: Offline
Static location for sprites on a VirtualMediaPanel

I have a fancy map that scrolls using the VirtualMediaPanel's setViewLocation() function and all my sprites go where they are supposed to go and everything is happy making.

BUT...

I would also like to have some buttons that sit on top of the map and just chill there, like a Heads Up Display. I'm using sprites for the buttons and I can detect when they are being clicked and whatnot, but when the virtual media panel scrolls, so do the HUD buttons.

I've tried using the viewLocationDidChange() function inside my Sprite subclass to call the sprite's setLocation() function to move my buttons so that they appear in the same place after the view moves. That didn't work.

I also tried keeping a list of button sprites in my BoardView class and overwriting the setVewLocation() function so that when it gets called it loops through the button sprites and calls their setLocation() functions with the offset coordinates. That also didn't work.

In both of the above cases when the map is in its original position, the buttons display correctly. When you scroll the map, the buttons all disappear. But if you scroll the map back to its original position the buttons all come back again.

I have found one method that works (but it is not to my liking). If, when I call setViewLocation(), I remove the sprite from the spriteManager, then create a new sprite object and give that sprite the new coordinates and add it to the sprite manager, the buttons appear in the right places. But I would rather MOVE my buttons than create new ones every time the map scrolls.

I've tried calling invalidate() all over the place and being very specific about which rectangles are dirty, but I can't get anything other than a completely new Sprite to display at the right place (I've tried removing the sprite, setLocation()ing it, and then adding it back again...that don't work)

I've also been trying to figure out a way to "layer" MediaPanels on top of each other so I could scroll the MapLayer and leave the HUD layer alone, but I haven't dug too deep into where the paint()ing gets dispatched (somewhere in PlacePanel maybe?)

Can anyone point me in the right direction for getting a HUD to display over a scrolling VirtualMediaPanel?
[Dec 16, 2008 5:55:56 PM] Show Printable Version of Post        Send Private Message [Link]  Go to top 
[Show Printable Version of Thread]

Home | About | Account | Forums | Games           ©2005 Three Rings Design, Inc