Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

idinkin

SDL Input Problem

This topic is 5564 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 everybody! The problem is that I don''t get the input event... And one more problem: if I declare the event variable as just SDL_Event it says that I did not declare it and I get error... So I turned it into static and everything is all right now... Here is my code:
 int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
				   PSTR szCmdLine, int iCmdShow)
{
	bool bDone = false;
	//window = new CWindow(800, 600, 32, true);
	log = new CLog("log.htm");
	settings = new CSettings(window, log);
	static SDL_Event event;

	while(!bDone)
	{
		switch(event.type)
		{
			case SDL_KEYDOWN:
				bDone = true;
				log->Log("Key press detected\n");
				break;
		
			case SDL_KEYUP:
				log->Log( "Key release detected\n");
				break;
		
			default:
				log->Log( "The type of the event is: %d", event.type);
				break;
		}
	}
	return 0;
} 

Share this post


Link to post
Share on other sites
Advertisement
Why are you using WinMain() in an SDL app?

Anyways, you're never polling for events. Check out SDL_PollEvent().

Not sure about your other problem though.

Edit: Oh yeah, uh, what's the CWindow? If that sets up an SDL window, then cool. If not, it'll need to. Either way, you oughta uncomment it.

[edited by - BradDaBug on August 18, 2003 1:33:40 PM]

Share this post


Link to post
Share on other sites
check the SDL homepage, they have great examples in the documentation of how to set up a window with SDL etc.

and as asked, why are you using winmain? SDL is a crossplattform library. Just use regular int main(int argc, char *argv[]) and SDL converts to native stuff as WinMain

"No lies of sugar can sweeten the sournes of reality"

}+TITANIUM+{ A.K.A. DXnewbie[onMIRC]

Share this post


Link to post
Share on other sites
isn''t there another way to supress the console?.. I think it''s an option you have to set in the compiler.

why use SDL if you''re using WinAPI anyway? Win32 has already input and sound and it''s easy to set up a OGL window...

whatever

"No lies of sugar can sweeten the sournes of reality"

}+TITANIUM+{ A.K.A. DXnewbie[onMIRC]

Share this post


Link to post
Share on other sites
If you''re using MSVC, simply make your project a "win32 application" rather than a "console application". This will get rid of the console and forward stdout and stderr into nice handy text files.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!