kleines Problem, bin in VS2008 unterwegs und würde gern n kleines Feld initialisieren, was mir viele lustige Vierecke malt (als Grafiken eingebunden)
Soweit das Konzept, jetzt meckert allerdings der Linker wieder rum mit der Standardmeldung: LNK2019... ich komm nicht weiter

Code: Alles auswählen
#include "SDL.h"
#include <iostream>
#include <string>
using namespace std;
const int SCREEN_WIDTH = 1280;
const int SCREEN_HEIGHT = 800;
const int SCREEN_BPP = 32;
SDL_Surface* screen = NULL;
SDL_Surface* background = NULL;
SDL_Surface* message = NULL;
SDL_Surface* load_image(string filename)
{
SDL_Surface* loadedImage = NULL;
SDL_Surface* optimizedImage = NULL;
loadedImage = SDL_LoadBMP(filename.c_str());
if(loadedImage != NULL)
{
optimizedImage = SDL_DisplayFormat(loadedImage);
SDL_FreeSurface(loadedImage);
}
return optimizedImage;
};
void apply_surface(int x, int y, SDL_Surface* source, SDL_Surface* destination)
{
SDL_Rect offset;
offset.x = x;
offset.y = y;
SDL_BlitSurface(source, NULL, destination, &offset);
};
int main(int argc, char* args[])
{
if(SDL_Init(SDL_INIT_EVERYTHING) == -1)
return 1;
screen = SDL_SetVideoMode(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP,SDL_SWSURFACE);
if (screen == NULL)
return 1;
SDL_WM_SetCaption("Sukkas World",NULL); // die NULL beschreibt das Icon, könnte also auch ein Favicon sein
message = load_image("images/hallo.bmp");
background = load_image("images/background.bmp");
apply_surface(0, 0, background, screen);
apply_surface(640, 0, background, screen);
apply_surface(0, 400, background, screen);
apply_surface(640, 400, background, screen);
apply_surface(531, 328, message, screen);
if(SDL_Flip(screen) == -1)
return 1;
SDL_Delay(5000);
SDL_FreeSurface(background);
SDL_FreeSurface(message);
SDL_Quit();
return 0;
};
viele Grüße,
Sukka