Ok tahnks guys! Sorry for bieng so slow to rsepond, but I'm a little drunk.
None of your tips has wokrked out so far, but TyroWorks' tip decreases the number of errors to 3 in all;
--------------------Configuration: SDL DrawImage test - Win32 Debug--------------------Compiling...main.cppC:\Programs\C++\SDL\SDL DrawImage test\main.cpp(21) : error C2501: 'player_imgs' : missing storage-class or type specifiersC:\Programs\C++\SDL\SDL DrawImage test\main.cpp(21) : error C2371: 'player_imgs' : redefinition; different basic types C:\Programs\C++\SDL\SDL DrawImage test\main.cpp(19) : see declaration of 'player_imgs'C:\Programs\C++\SDL\SDL DrawImage test\main.cpp(21) : error C2440: 'initializing' : cannot convert from 'struct SDL_Surface ** ' to 'int' This conversion requires a reinterpret_cast, a C-style cast or function-style castC:\Programs\C++\SDL\SDL DrawImage test\main.cpp(94) : warning C4018: '>' : signed/unsigned mismatchError executing cl.exe.SDL DrawImage test.exe - 3 error(s), 1 warning(s)
Here's the whole code.. I don't think there's anything wrong on the line above:
#include <stdio.h>#include <stdlib.h>#include <SDL.h>#include <windows.h>#include "SDLWrapper_Memory.h"#include "list.h"SDL_Surface *back;SDL_Surface *image;SDL_Surface *screen;SDL_Event event;linkedList *EnemyList;int timer;//These are used to animate the playership.int frame_timer = SDL_GetTicks();int frame_count = 0;SDL_Surface player_imgs;//player_imgs[0] = SDL_LoadBMP("Graphics/Ships/Player/anim/pl_left01.bmp");player_imgs = new SDL_Surface *[7];BITFIELD_CREATE(KeyboardDown, SDLK_LAST);void DrawImage(SDL_Surface *img, int x, int y){ SDL_Rect dest; dest.x = x; dest.y = y; SDL_BlitSurface(img, NULL, screen, &dest);}bool KeyDown(uint32 uiAscii){ return (BITFIELD_GET(KeyboardDown, uiAscii) != 0);}///////////////////////////// GAME STRUCTS ///////////////////////////////////////typedef struct _PLAYER{ int ypos; int xpos; SDL_Surface *img;} player; typedef struct _ENEMY{ int ypos; int xpos; SDL_Surface *img;} enemy;////////////////////////////////////////////////////////////////////////////////////player p;linkedList *list;int main(int argc, char *argv[]){ if (SDL_Init(SDL_INIT_AUDIO|SDL_INIT_VIDEO) < 0) { printf("Unable to init SDL: %s\n", SDL_GetError()); exit(1); } screen=SDL_SetVideoMode(640,480,32,SDL_HWSURFACE|SDL_DOUBLEBUF); if ( screen == NULL ) { printf("Unable to set 640x480 video: %s\n", SDL_GetError()); exit(1); } int done=0; p.img = SDL_LoadBMP("Graphics/Ships/Player/plyshp01a.bmp"); p.xpos = 250; p.ypos = 200; while(done == 0) { while (SDL_PollEvent(&event)) { if (event.type == SDL_QUIT) {done = 1;} if (event.type == SDL_KEYDOWN) { BITFIELD_SET( KeyboardDown, event.key.keysym.sym); } if (event.type == SDL_KEYUP) { BITFIELD_RESET( KeyboardDown, event.key.keysym.sym); } } //This shit right here enables us to generate enemies every half second. if(timeGetTime() > timer + 500) { timer = timeGetTime(); listNode *enemy; } if(KeyDown(SDLK_ESCAPE)) { done = 1; } if(KeyDown(SDLK_UP)) { if(p.ypos > 0) { p.ypos = p.ypos - 2; } } if(KeyDown(SDLK_DOWN)) { if(p.ypos < 426) { p.ypos = p.ypos + 2; } } if(KeyDown(SDLK_LEFT)) { if(p.xpos > 0) { p.xpos = p.xpos - 2; } } if(KeyDown(SDLK_RIGHT)) { if(p.xpos < 576) { p.xpos = p.xpos + 2; } } SDL_FillRect(screen, NULL, SDL_MapRGB(screen -> format, 0, 0, 0)); DrawImage(p.img, p.xpos, p.ypos); SDL_Flip(screen); } return 0;}