Realtime input and drawing.
Realtime input and drawing.
Ok, I'll start outright by saying I'm programming a game, and I've just made the move to wxWidgets, woot.
But... generally when I would do something like this in Win32 I would use winMain and do something like:
while(!done) {
grab events
handle MY events
handle defaults (go ahead windows...)
game code (includes drawing)
}
but with wx I realized the main thing really isn't wanna-be editible and seems to leave me with only two options, maybe 3 =P
One way would be to use my main frames EVT_IDLE to just handle everything (drawing,input,etc). (can I use the wxApp's EVT_IDLE?)
Another would be to use IMPLEMENT_APP_NO_MAIN, but then I'm not sure about wxEntry's loop variable and whether or nto that makes my main lose control, also with that way I'm worried that I would have to handle more events that the application does by default... not really sure.
A third way might be threads, though I've never actually worked with them, and it really seems like a hack to use it for this.
Any suggestions as to which method to use? I'm trying the first one right now... have some issues... I think it's because I'm trying to use a wxApp with EVT_IDLE... anyways, any ideas?
But... generally when I would do something like this in Win32 I would use winMain and do something like:
while(!done) {
grab events
handle MY events
handle defaults (go ahead windows...)
game code (includes drawing)
}
but with wx I realized the main thing really isn't wanna-be editible and seems to leave me with only two options, maybe 3 =P
One way would be to use my main frames EVT_IDLE to just handle everything (drawing,input,etc). (can I use the wxApp's EVT_IDLE?)
Another would be to use IMPLEMENT_APP_NO_MAIN, but then I'm not sure about wxEntry's loop variable and whether or nto that makes my main lose control, also with that way I'm worried that I would have to handle more events that the application does by default... not really sure.
A third way might be threads, though I've never actually worked with them, and it really seems like a hack to use it for this.
Any suggestions as to which method to use? I'm trying the first one right now... have some issues... I think it's because I'm trying to use a wxApp with EVT_IDLE... anyways, any ideas?
-
- Filthy Rich wx Solver
- Posts: 203
- Joined: Tue Aug 31, 2004 7:06 pm
- Location: Behind a can of Mountain Dew
- Contact:
I'd do option 4: Don't use wxWidgets to make a game. In my opinion, unless you need a lot of GUI code (controls/events/etc.) I'd just use SDL for everything. It's also crossplatform but is faster and more geared towards games. If you need a lot of sound/joystick/keyboard stuff wxWidgets might just get in the way.
That said, I'd probably do the first method you wrote if I were to do it. Just make sure you scale your graphic movement code by time rather than "frames" since I doubt EVT_IDLE is going to be very consistent about its execution.
That said, I'd probably do the first method you wrote if I were to do it. Just make sure you scale your graphic movement code by time rather than "frames" since I doubt EVT_IDLE is going to be very consistent about its execution.
well...
Well yes I realize SDL and even GLUT would be good choices, however due to the network options that wxWidgets provides it seemed much more integrated and developed.
Also any development tools I'd be making would require the capabilities of wxWidgets so I figured I might as well learn it... but I guess learning wxWidgets and SDL would only help me.
Ok, so I looked at SDL (it's been a few months since I've been on that site) and I realize that it would be missing one thing... netcode, unless I'm wrong of course. Any ideas on what I would be able to do when it comes to network code? I'm going for cross platform of course...
I don't think my dev team is going to like this switch =P
But then again I guess I will only need widgets for the tools more than anything else.
As for scaling by frames, never =p
Also any development tools I'd be making would require the capabilities of wxWidgets so I figured I might as well learn it... but I guess learning wxWidgets and SDL would only help me.
Ok, so I looked at SDL (it's been a few months since I've been on that site) and I realize that it would be missing one thing... netcode, unless I'm wrong of course. Any ideas on what I would be able to do when it comes to network code? I'm going for cross platform of course...
I don't think my dev team is going to like this switch =P
But then again I guess I will only need widgets for the tools more than anything else.
As for scaling by frames, never =p
Ok, well I see now that I would most likely have to use wxWidgets for the netcode seeing as how SDL does not support it.
So here's a question, I don't really need to run an instance of application or links against most of wxWidgets to use the net part of the API do I? is there something that I don't know about here?
So here's a question, I don't really need to run an instance of application or links against most of wxWidgets to use the net part of the API do I? is there something that I don't know about here?
-
- Knows some wx things
- Posts: 31
- Joined: Fri Sep 10, 2004 1:03 pm
- Location: Troy, NY
- Contact:
Re: well...
SDL not GLUT. GLUT is good for demos, or proof-of-concept.
Networking: http://www.libsdl.org/projects/SDL_net/
Networking: http://www.libsdl.org/projects/SDL_net/
soks wrote:Well yes I realize SDL and even GLUT would be good choices, however due to the network options that wxWidgets provides it seemed much more integrated and developed.
wow, it's like people don't read anything at all...
I've been doing this for too many years and am too young to be able to control myself still, so I just won't comment.
Suffice it to say I enjoy the API interface of wxWidgets soooo much, I'll stick to it for now and hopefully things go okay.... worst case scenario I'll need SDL later or something, hopefully using OpenAL will be enough.
Thank you for all your help and.... *poof* *dissapears*
I've been doing this for too many years and am too young to be able to control myself still, so I just won't comment.
Suffice it to say I enjoy the API interface of wxWidgets soooo much, I'll stick to it for now and hopefully things go okay.... worst case scenario I'll need SDL later or something, hopefully using OpenAL will be enough.
Thank you for all your help and.... *poof* *dissapears*
-
- Earned some good credits
- Posts: 128
- Joined: Sat Sep 25, 2004 9:11 pm
- Location: Nuremberg, Germany
- Contact:
SDL isn't designed for that.Scorcher24 wrote:I know that maybe a little be offtopic but I have tried before a few months to code a little game by myself: a blackjack. I used also SDL and I am missing one feature (or didn't find it):
Is there any way to add a menu to the window ?? thats something sdl is lack of...
rya.
Scorcher24
Making a simple GUI controller for a menu yourself isn't hard though.
- Ryan Norton
- wxWorld Domination!
- Posts: 1319
- Joined: Mon Aug 30, 2004 6:01 pm
Don't forget allegro -
http://alleg.sf.net
http://alleg.sf.net
[Mostly retired moderator, still check in to clean up some stuff]
-
- Knows some wx things
- Posts: 31
- Joined: Fri Sep 10, 2004 1:03 pm
- Location: Troy, NY
- Contact:
OpenAL is quite good for most things.
However...if your app is going to be free, I highly recommend [url=htttp://www.fmod.org/]FMOD[/url]. FMOD is cross platform, fast, cool, good C API, and is pretty trivial to wrap in C++.
You shouldn't have trouble using either in your app. I've used both for proof-of concept stuff along side wxWidgets, and I've also used both along side SDL.
However...if your app is going to be free, I highly recommend [url=htttp://www.fmod.org/]FMOD[/url]. FMOD is cross platform, fast, cool, good C API, and is pretty trivial to wrap in C++.
You shouldn't have trouble using either in your app. I've used both for proof-of concept stuff along side wxWidgets, and I've also used both along side SDL.
soks wrote:...hopefully using OpenAL will be enough.