gurdmatt's Profile User Rating: -----

Reputation: 0 Apprentice
Group:
New Members
Active Posts:
7 (0.01 per day)
Joined:
27-February 13
Profile Views:
780
Last Active:
User is offline Mar 04 2013 04:00 PM
Currently:
Offline

Previous Fields

Dream Kudos:
0
Icon   gurdmatt has not set their status

Posts I've Made

  1. In Topic: sdl_getkeystates not working correctly

    Posted 28 Feb 2013

    you are correct. I had just figured this out by searching around on another forum. I had my screen being initialized by my play.drawchar() method, which was a function in a seperate class instance. I believe what happened is the screen kept going out of scope.

    I appreciate the helpful and accurate answer. Has been a real pain for me all day. Thanks.
  2. In Topic: sdl_getkeystates not working correctly

    Posted 28 Feb 2013

    shouldnt matter i am just testing the input, no where in my loop do i call on anything from my object.
    well except play1.drawchar() but that does not operate on the bool left.

    this is strictly a console loop.
  3. In Topic: sdl_getkeystates not working correctly

    Posted 28 Feb 2013

    #include "Object.h"
    #include "SDL.h"
    #include <string>
    using namespace std;
    
    
    
    
    SDL_Event event;
    Uint8 * keystates = SDL_GetKeyState(NULL);
    
    int main(int argc, char *args[] ){
    	bool quit = false;
    	bool left = false;
    
    	Object play1;
    	
    	SDL_Init(SDL_INIT_EVERYTHING);
    	
    
    	while( quit != true ){
    		
    		while( SDL_PollEvent  (&event)){
    			if ( event.type == SDL_KEYDOWN){
    				switch(event.key.keysym.sym){
    					case SDLK_LEFT:
    						(left = true);
    						break;
    					default:
    						break;
    				}
    			
    			}
    			if ( event.type == SDL_KEYUP){
    				switch(event.key.keysym.sym){
    					case SDLK_LEFT:
    						(left = false);
    						break;
    					default:
    						break;
    				}
    			}
    			}
    		
    		if (left == true ){
    			std::cout << "true";
    		}
    		if (left == false ){
    			std::cout << "false";
    		}
    		play1.draw_char();
    	
    	}
    	return 0;
    }
    
    


    I went ahead and tried this as a test loop. If i press left it becomes true for one frame and then resets back to false right away. I have got to be missing something here, because i have implemented this same input structure on previous games without any problems like this.
  4. In Topic: sdl_getkeystates not working correctly

    Posted 28 Feb 2013

    #include "Object.h"
    #include "SDL.h"
    #include <string>
    using namespace std;
    
    
    
    
    SDL_Event event;
    Uint8 * keystates = SDL_GetKeyState(NULL);
    
    int main(int argc, char *args[] ){
    	bool quit = false;
    	bool left = false;
    
    	Object play1;
    	
    	SDL_Init(SDL_INIT_EVERYTHING);
    	
    
    	while( quit != true ){
    		
    		while( SDL_PollEvent  (&event)){
    			if ( event.type == SDL_KEYDOWN){
    				switch(event.key.keysym.sym){
    					case SDLK_LEFT:
    						(left = true);
    						break;
    					default:
    						break;
    				}
    			
    			}
    			if ( event.type == SDL_KEYUP){
    				switch(event.key.keysym.sym){
    					case SDLK_LEFT:
    						(left = false);
    						break;
    					default:
    						break;
    				}
    			}
    			}
    		
    		if (left == true ){
    			std::cout << "true";
    		}
    		if (left == false ){
    			std::cout << "false";
    		}
    		play1.draw_char();
    	
    	}
    	return 0;
    }
    
    


    I went ahead and tried this as a test loop. If i press left it becomes true for one frame and then resets back to false right away. I have got to be missing something here, because i have implemented this same input structure on previous games without any problems like this.

My Information

Member Title:
New D.I.C Head
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:

Contact Information

E-mail:
Click here to e-mail me

Friends

gurdmatt hasn't added any friends yet.

Comments

gurdmatt has no profile comments yet. Why not say hello?