Jump to content
  • Advertisement
Sign in to follow this  
Zeptera

SDL compiling problems in Dev c++

This topic is 4958 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 need some help with my dev c++ 4.9.9.2 compiler: when i compile my SDL code wich i have written from Cone3D programming tutorials. i get these errors: Permission Denied Id returned 1 exit status [Build Error] [SDL.exe] Error 1 and finally, here's my code: #include <stdio.h> #include <stdlib.h> #include <SDL/SDL.h> #include <iostream> using namespace std; void DrawPixel(SDL_Surface* screen, int x, int y, Uint8 R, Uint8 G, Uint8 B) { Uint32 color = SDL_MapRGB(screen->format, R, G, B); switch(screen->format->BytesPerPixel) { case 1: { Uint8* bufp; bufp = (Uint8 *)screen->pixels + y*screen->pitch + x; *bufp = color; } break; case 2: { Uint16* bufp; bufp = (Uint16 *)screen->pixels + y*screen->pitch/2 + x; *bufp = color; } break; case 3: { Uint8* bufp; bufp = (Uint8 *)screen->pixels + y*screen->pitch + x * 3; if(SDL_BYTEORDER == SDL_LIL_ENDIAN) { bufp[0] = color; bufp[1] = color >> 8; bufp[2] = color >> 16; }else{ bufp[2] = color; bufp[1] = color >> 8; bufp[0] = color >> 16; } }break; case 4: { Uint32* bufp; bufp = (Uint32 *)screen->pixels + y*screen->pitch/4 + x; *bufp = color; } break; } } void Slock(SDL_Surface* screen) { if(SDL_MUSTLOCK(screen) ) { if(SDL_LockSurface(screen) < 0) { return; } } } void Sulock(SDL_Surface* screen) { if(SDL_MUSTLOCK(screen) ) { SDL_UnlockSurface(screen); } } int main(int argc, char* argv[]) { if(SDL_Init(SDL_INIT_AUDIO|SDL_INIT_VIDEO) < 0) { cout << "Unable to init SDL: %s\n",SDL_GetError(); exit(1); } atexit(SDL_Quit); SDL_Surface* screen; screen = SDL_SetVideoMode(640,480,32,SDL_HWSURFACE|SDL_DOUBLEBUF); if(screen == NULL) { cout << "Unable to set graphics mode to 640x480: %s\n",SDL_GetError(); exit(1); } //drawing goes here return 0; }

Share this post


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

  • 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!