Results 1 to 6 of 6
  1. #1
    Join Date
    Aug 2003
    Location
    Peabody, MA
    Posts
    919

    Keyboard input error, help please

    ok here si my code for my beginning of my game engine, this is the mainapp.cpp:

    PHP Code:
    #include "GLCanvas.h"

    int Default_Window_Value = -1;
    int test 2;
    int Game_State 1;

    DWORD Default_GL_Style wxNO_BORDER;
    DWORD Main_Window_Style wxDEFAULT_FRAME_STYLE wxWANTS_CHARS;

    wxString Empty_String;

    // Event Table For The Main Game Window
    BEGIN_EVENT_TABLEMainAppwxApp 

        
    EVT_KEY_DOWNMainApp::EndGame )

    END_EVENT_TABLE()

    IMPLEMENT_APPMainApp );

    bool MainApp::OnInit()
    {

        
    StartGame();

        return 
    true;
        
    }

    void MainApp::StartGame()
    {

        
    MainGameWindow *GameWindow = new MainGameWindow_T "Stromgage Game Engine" ), wxPoint100100 ), wxSize800600 ), Main_Window_Style );

        
    GLCanvas *GLWindow = new GLCanvasGameWindowtestwxPoint0), wxSize800600 ), Default_GL_StyleEmpty_String );

        
    GameWindow -> Showtrue );

        
    GLWindow -> SetCurrent();

        while (
    Game_State == 1)
        {

        }

        
    delete GLWindow;
        
    delete GameWindow;

    }

    void MainApp::EndGamewxKeyEvent &event )
    {

        
    Game_State 0;
        
    wxMessageBox"Game_State = 0" );



    now here is the mainapp.h:
    PHP Code:
    #ifndef MAINAPP_H
    #define MAINAPP_H

    #include "PrecompiledHeaders.h"

    class MainApp : public wxApp
    {

        public:
            
    virtual bool OnInit();
            
    void StartGame();
            
    void EndGamewxKeyEvent &event );

        private:
            
    DECLARE_EVENT_TABLE()

    };

    #endif 
    know there are a few problems. first might be my only problem, but the code compiles fine but and teh program does start but when the program is running adn the mouse is over the applacation, the timeglass comes up and when i click X to close it say the program is not responding and muss close now. why is this happening, what is wrong with my code here? the second problem in the keyboard down event dopes not work but if the program in not responding then i guess that will not work. please someone help, i havbe tried 2 other forums including the wxWidgets and tried to read through the docs for about 2 and 1/2 days and no soslution can be founf by me. thank for your time to read this in a effort to help me.


    Posted code will be much more readable if enclosed in PHP tags.
    -- Keith
    Last edited by keithathaide; 01-10-2005 at 01:30 PM.

  2. #2
    Join Date
    Aug 2004
    Location
    little rock arkansas
    Posts
    3,482
    look here for help is the best i can tell you

    http://wiki.wxwidgets.org/wiki.pl?WxGLCanvas

  3. #3
    Join Date
    Jun 2004
    Location
    The Netherlands
    Posts
    153
    Well I think your staying in a loop
    You initialize
    PHP Code:
    Game_State 1
    And later;
    PHP Code:
    while (Game_State == 1)
    {


    Last edited by Project-A; 01-10-2005 at 11:12 AM.
    Bug? That's not a bug, that's a feature.
    LinkedIn - Twitter (dutch) - Work (dutch)

  4. #4
    Join Date
    Mar 2004
    Posts
    0
    Originally posted by Project-A
    Well I think your staying in a loop
    You initialize
    PHP Code:
    Game_State 1
    And later;
    PHP Code:
    while (Game_State == 1)
    {


    id go with that... i have no experence with wxwigits... but is the
    while(Game_State == 1)
    {
    }
    supposed to be the game loop? becuse if it is, and wxwigits is anything like win32 programinmg, you have to recive the messages with some sort of function... not just have an empty loop... if you were programing win32 (and i have no idia about wxwigits...) your game loop would look somthing like this:
    PHP Code:
        if(init() == TRUE)
        {
            
    // Enter the message pump
            
    ZeroMemory(&Msgsizeof(MSG));
            while(
    Msg.message != WM_QUIT
            {
                
    // Handle Windows messages (if any)
                
    if(PeekMessage(&MsgNULL00PM_REMOVE)) 
                {
                    
    TranslateMessage(&Msg);
                    
    DispatchMessage(&Msg);
                }
                else 
                {
                    
    // Do per-frame processing, break on FALSE return value
                    
    if(frame() == FALSE)
                        break;
                }
            }
        } 
    hopw this helps !

  5. #5
    Join Date
    Jun 2004
    Location
    The Netherlands
    Posts
    153
    I also never used wxwidgets. Can't understand whats so handy about it
    Bug? That's not a bug, that's a feature.
    LinkedIn - Twitter (dutch) - Work (dutch)

  6. #6
    Join Date
    Aug 2003
    Location
    Peabody, MA
    Posts
    919
    whats so handy about windows coding?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •