Hey ihr Spieleprogrammierer,
ich wollte grad ein kleines Sprite in SDL laden und das ganze wollte nicht so wie ich wollte. Ich hab dann überprüft ob er das Bild überhaupt läd und hab festgestellt das er es anscheinend nicht findet. Ich habs schon in VS2012 zu den Resources hinzugefügt aber irgendwie bleibt der Erfolg aus.
Hier mal meine Source:
|
C-/C++-Quelltext
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
#include <SDL.h>
#ifdef _WIN32
#undef main
#endif
bool running = true;
void apply_surface(int x, int y, SDL_Surface* source, SDL_Surface* destination);
int main(int argc, char *argv[]){
//Initialise
SDL_Init(SDL_INIT_EVERYTHING);
SDL_Surface *screen = NULL;
SDL_Surface *background = NULL;
SDL_WM_SetCaption("SDL Testing enviroment", NULL);
//Load
screen = SDL_SetVideoMode(640, 480, 32, SDL_SWSURFACE);
if(!(background = SDL_LoadBMP("Ressourcendateien/bat.bmp")))
{
running = false;
}
while( running )
{
SDL_Event event;
if(SDL_PollEvent(&event))
{
if(event.type == SDL_QUIT)
{
running = false;
}
}
apply_surface( 10, 10, background, screen);
// Update Screen
SDL_Flip(screen);
}
SDL_Quit();
return 0;
}
void apply_surface(int x, int y, SDL_Surface* source, SDL_Surface* destination) {
SDL_Rect prect;
prect.x = x;
prect.y = y;
SDL_BlitSurface(source, NULL, destination, &prect);
}
|
Freu mich über jede Hilfe
Mit freundlichen Grüßen,
Horius