SDL Template for VC7
How can I make an SDL project in Visual C++.net sppedier? Can I make my own template for new projects? [Edited by - Yamian on December 20, 2004 5:47:55 PM]
Are you talking about using C++.Net in VC7 or just using C++ in VC7. If you are talking about a simple framework you can easily use over and over - take a look at my last post here. It is an example for OpenGL. Now if you want just SDL and no OpenGL - take out:
replace:
int Flags = SDL_OPENGL | SDL_RESIZABLE;
with
int Flags = SDL_HWSURFACE | SDL_DOUBLEBUF | SDL_RESIZABLE;
and finally change the draw function to:
Everytime you need access to your video screen, call SDL_GetVideoSurface(), it returns a SDL_Surface* to the screen. I hope this helps!!
glViewport(0,0,640,480);// Reset The Current ViewportglMatrixMode(GL_PROJECTION); // Select The Projection MatrixglLoadIdentity(); // Reset The Projection MatrixgluPerspective(45.0f,(GLfloat)640/(GLfloat)480,0.1f,100.0f);glMatrixMode(GL_MODELVIEW); // Select The Modelview MatrixglLoadIdentity(); // Reset The Modelview Matrix
replace:
int Flags = SDL_OPENGL | SDL_RESIZABLE;
with
int Flags = SDL_HWSURFACE | SDL_DOUBLEBUF | SDL_RESIZABLE;
and finally change the draw function to:
void Draw(){ SDL_FillRect( SDL_GetVideoSurface() , NULL, 0x000000); // Your draw code goes here SDL_Flip( SDL_GetVideoSurface() );}
Everytime you need access to your video screen, call SDL_GetVideoSurface(), it returns a SDL_Surface* to the screen. I hope this helps!!
What I mean liek is can I have code like that and like a SDL project when I'm making a new project?
In VS .NET, you can make a custom wizard, just click New->Projects..., and pick "Custom Wizard", and it'll set up a blank template for you.
As for what sorts of things you'll need to put into your appwizard, take a look at C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\VCWizards's subfolders for how the other wizards work.
(I should really make an SDL app wizard...)
As for what sorts of things you'll need to put into your appwizard, take a look at C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\VCWizards's subfolders for how the other wizards work.
(I should really make an SDL app wizard...)
Get off my lawn!
I have all the .dlls and a basic template for SDL in it but how do I make it so it has all the compile options in it, because it's a pain to make it Multi-thread, then add the libs, and all that.
Quote:
Original post by TANSTAAFL
(I should really make an SDL app wizard...)
Same here...but I just made an engine instead [lol].
I still can't figure it out, could someone plz put all this into a SDL makewizard for the community?
Just like an empty Win32 application ecept:
Project -> Properties -> C++ -> Code Generatiion -> Runtime Library = Multi-threaded
Project -> Properties -> Linker -> Input -> Ignore all Default Libraries = Yes
Project -> Properties -> Linker -> Command Line -> Additional Options:
msvcrt.lib
libcpmt.lib
SDL.lib
SDLmain.lib
SDL_image.lib
SDL_mixer.lib
SDL_gfx.lib
A file Main.cpp that has:
And a version.rc for simple version stuff. I woudl realy appreciate it to anyone hwo does.
P.S. What woudl be really cool would be you coudl select the extensions you want to use in a wizard and that would affect how the program was made. Like noe of the Mix_ stuff would be teher if u weren't SDL_mixer and no header or LIB linkage for it.
Just like an empty Win32 application ecept:
Project -> Properties -> C++ -> Code Generatiion -> Runtime Library = Multi-threaded
Project -> Properties -> Linker -> Input -> Ignore all Default Libraries = Yes
Project -> Properties -> Linker -> Command Line -> Additional Options:
msvcrt.lib
libcpmt.lib
SDL.lib
SDLmain.lib
SDL_image.lib
SDL_mixer.lib
SDL_gfx.lib
A file Main.cpp that has:
/* Name: Author: Description:*///Headers#include <stdlib.h>#include <SDL\SDL.h>#include <SDL\SDL_image.h>#include <SDL\SDL_mixer.h>#include <SDL\SDL_gfx.h>//Mainint main(int argc, char *argv[]){ //Initialize SDL and the screen. SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO ); SDL_Surface *screen = SDL_SetVideoMode(640, 480, 32, SDL_HWSURFACE | SDL_DOUBLEBUF | SDL_FULLSCREEN); SDL_WM_SetCaption("SDL Project", "SDL Project"); Mix_OpenAudio(44100, MIX_DEFAULT_FORMAT, 2, 1024); //Initialize the framerate. FPSmanager framerate; SDL_initFramerate(&framerate); SDL_setFramerate(&framerate, 100); //Initialize images. //Initialize sounds. //Initialize variables. //Loop start. while(true) { //See if the user exits. SDL_Event event; while ( SDL_PollEvent(&event) ) { if ( event.type == SDL_QUIT ){ //Free Surfaces. //Free sounds. Mix_CloseAudio(); SDL_Quit(); exit(0); } if ( event.type == SDL_KEYDOWN ) { if ( event.key.keysym.sym == SDLK_ESCAPE ){ //Free Surfaces. //Free sounds. Mix_CloseAudio(); SDL_Quit(); exit(0); } } } //Clear the screen. SDL_FillRect(screen,NULL,SDL_MapRGB(screen->format,0,0,0)); //Get keys. Uint8 *keys = SDL_GetKeyState(NULL); //Respond to keys. /* Everything else. */ //Draw //Synchronize the screen. SDL_Flip(screen); SDL_framerateDelay(&framerate); } }
And a version.rc for simple version stuff. I woudl realy appreciate it to anyone hwo does.
P.S. What woudl be really cool would be you coudl select the extensions you want to use in a wizard and that would affect how the program was made. Like noe of the Mix_ stuff would be teher if u weren't SDL_mixer and no header or LIB linkage for it.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement