Advertisement

Player Select blues....

Started by April 09, 2001 12:06 AM
4 comments, last by NitrusOxyde 23 years, 10 months ago
I''m working on a cheesy 2d game right now. My big hang up is in the player select. The general idea is this... There are 2 teams and each team(one player) picks 4 of 8 charachters. I''d like to use mouse input to do this. SO FAR it isn''t tricky....here we go. I''ve got approx 12 bitmaps I''m blitting onto a 2d surface then flipping it. So the code for what to do when a player clicks a charachter to add it to his team is easier to make - I put it in a while loop. THE PROBLEM- While I''m in the while loop I get an hour glass cursor. I''ve tried changing the cursor, I''ve tried everything. THE QUESTION- HOW CAN I GET RID OF THE HOUR GLASS? Any suggetsions as for a way to do the player select would be great, or just some simple code to get rid of the hour glass that works. BLITTING A BITMAP OVER THE CURSOR AND USING SHOWCURSOR(FALSE) Already tried it...so I wouldn''t have ''ghost'' images of the cursor I have to re-blit all the images every time it gets a new mouse position (aka while(1)...). I''m running dual 400Mhz processors with 256MB of RAM and NT5...my computer ground to a screeching halt after about 5 seconds of doing this. SUGGESTIONS PLEASE? e-mail: webmaster@yatescenterks.net -Nitrus Oxyde aka Jared Starkey Nautilus Web Development
-Nitrus Oxydeaka Jared StarkeyNautilus Web Development
Uhh... unless I''m misunderstanding, it sounds like you''re putting a big infinite while loop in the middle of your code to be broken from when a player is selected... And you''re also running Windows...

You shouldn''t just freeze Windows like that, you need some kind of state machine that will be called once per frame when you''re selecting the character.

It doesn''t sound like it should be any more of a big deal than detecting (in your state machine) if the mouse is clicked, and if so, then where. Check that location against bounding RECTs for all your character icons, and if it hits one, you have a selection.

Or am I misunderstanding?
Advertisement
Or just throw it in another thread, if you want to keep the while loop as it is. Not sure if it''d help the cursor problem, but mightn''t be a bad idea anyways



----------------------------------------
Damian.
Email: damian@returnity.com
Web: www.gamedevcentral.com
----------------------------------------Damian.Email: damian@returnity.comWeb: www.gamedevcentral.com
Hide the mouse, and redraw everything each frame. Using a state counter like Qoy said.

It's fast enough in your main game, so it'll be fast enough for just a menu =)


Edited by - freshya on April 9, 2001 7:41:40 PM
Call me a newbie...but why is creating another thread going to speed this up?

One thread draws everything while one waits for input?


-Nitrus Oxyde
aka Jared Starkey
Nautilus Web Development
-Nitrus Oxydeaka Jared StarkeyNautilus Web Development
A new thread won''t speed it up (unless *possibly* it''s on a multiprocessor machine..). However, if you put it in another thread, then you can safely run infinite loops and stuff without worrying about Windows messages. (The thread owning process will still need a message pump of course.)

Libraries like PTC use this approach to let you program as if Windows'' message system didn''t exist in the first place.

There''s an article from some time ago on GameDev that outlines this process, and a few advantages of it.

This topic is closed to new replies.

Advertisement