• Advertisement
Sign in to follow this  

console in sdl

This topic is 4307 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

Hi, I´m testing this program. Take a look: #include <SDL/SDL.h> #include <stdio.h> #include <stdlib.h> int getInt(){ printf("\nValor de N: \n"); SDL_Event event; while(1){ if ( SDL_PollEvent ( &event ) ) { switch(event.type) { case SDL_QUIT: exit(EXIT_SUCCESS); break; case SDL_KEYDOWN: switch(event.key.keysym.sym) { case SDLK_ESCAPE: exit(0); case SDLK_KP1: return 1; case SDLK_KP2: return 2; case SDLK_KP3: return 3; case SDLK_KP4: return 4; case SDLK_KP5: return 5; case SDLK_KP6: return 6; case SDLK_KP7: return 7; case SDLK_KP8: return 8; case SDLK_KP9: return 9; case SDLK_KP0: return 0; } } } } return -1; } int main(int argc, char *argv[]) { char op; int n; n = 0; do{ printf("\nValor de N: \n"); n = getInt(); printf("\nContinuar? S N\n"); op = getch(); }while(toupper(op) == 'S'); return 0; } this program must run on MS-DOS console, but it not works. I´m using Dev C++ 4.9.9.0 and using multimedia/SDL project

Share this post


Link to post
Share on other sites
Advertisement
And you can't use getch(); Write SDL get key routine to replace it. Also, don't use exit(); because SDL also needs to be shut down with SDL_Quit();

Share this post


Link to post
Share on other sites
thank you but the problems remains
Could you run this code?
I think that this problem is from dev. I´m using the standard linkers from SDL.
Using visual c++ 6.0 it works

Share this post


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

  • Advertisement