Jump to content
  • Advertisement
Sign in to follow this  
Techieman

Having trouble with WinAPI....

This topic is 2012 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello,

I'm currently rewritting a part of the ClockGear-Game-Engine ( a private project made by my friend and me ).

We decided to create a XNA like Game class. This class contains another class called cgWindow. That's the problem.

I can create a Window, but we cannot put our game logic there without functionpointers to classmethods.

So we decided to create functions like IsOpened...

How ever the class should look like this:

[attachment=16006:Window.png]

 

I have no Idea how to put this into working Code.

Are there any ressource that can help me with that problem?

 

Thanks Techie

Edited by Techieman

Share this post


Link to post
Share on other sites
Advertisement

Which part specifically is causing the problem?

 

My guess is that you're having difficulty because the window procedure must be static, but you want to have access to the window object and it's members. One solution is described here.

Share this post


Link to post
Share on other sites

Well the WindowProcedure it self not. I've problems with calling the Game Logic. Since I have an XNA like Game Class I don't want to use Functionpointer.

I've now Idea how to Implement things like this:

 

while( Window.IsOpened ){
// Do such things
// Exploding Clowns.
}

 

I end up here:

 

ShowWindow( m_hWnd, NULL ); 

 

After this I've no Idea how to put the gamelogic into the loop.

 

I hope I've properly formulated my problem.

 

Thanks Techie

Edited by Techieman

Share this post


Link to post
Share on other sites

Since nobody is answering, I'll specify my problem:

How do I implement something like this into my code/class :

while( Window.IsOpen() ){
// Exploding Clowns 
}

 

 

 

I have no idea how to get this in common with my Messageloop.

Any ideas?

 

Thanks Techie

Share this post


Link to post
Share on other sites

I can create a Window, but we cannot put our game logic there without functionpointers to classmethods.

... while( Window.IsOpen() ){

Are you familiar with the game loop, and how it works?

 

General window programming is event driven.  The human does something to generate an event, it gets passed to the appropriate UI control, the control gets the event, processes it until it is finished, and you are done.

 

A game loop follows the pattern of the game engine running in a time-driven loop.  Game systems and objects can register with the engine that they want to be included. Those systems perform a tiny bit of processing and return control as fast as reasonable.

 

 

 

The message loop you described above would surrender control to the window indefinitely until the processing is complete.  That is fine for an event-driven window program, but contrary to the design of most time-driven games.

Share this post


Link to post
Share on other sites

Sorry, I don't get the gist, how this may work blink.png

 

EDIT: Well, strange phenomen: Whenever I try something, I don't get the gist. So I writte a topic in the forum and in the next moment I understand it or I have got a possible solution that just has to be tested. LOL! PeekMessage... seems usefull, though.

Edited by Techieman

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!