//TEST_MAIN_WINDOW_GAME source code.c
#include "stdio.h"
#include "stdlib.h"
#include "SDL/SDL.h"
#include "SDL/SDL_image.h"
int main(void)
{
SDL_Event event;
SDL_Surface *screen;
SDL_Surface *image;
SDL_Rect n,z;
///////////////初始化SDL///////////////////////////////////
(SDL_Init(SDL_INIT_EVERYTHING));
SDL_WM_SetCaption("linux game 未來有希望了! 哈~~~~^ ^",NULL);
atexit(SDL_Quit);
screen=SDL_SetVideoMode(800, 600, 16, SDL_DOUBLEBUF | SDL_HWSURFACE);
/////////////////////////////////////////////////////////////
////////////////背圖_1/////////////////
image = IMG_Load("/home/byonk/Image/test_image.png");
if(screen == NULL){
printf("Unable to load Bitmap");
return 1;
}
//////////////㬎示image/////////////
n.x=0;
n.y=0;
n.w=screen->w;
n.h=screen->h;
z.x=0;
z.y=0;
z.w=screen->w;
z.h=screen->h;
SDL_BlitSurface(image, &n, screen, &z);
//////////////CLOSE_WINDOW////////
while(SDL_WaitEvent(&event) != 0){
////////更新image//////////////////
SDL_UpdateRect(screen, 0, 0, 0, 0);
/////////////////////////////////////
switch (event.type)
case SDL_QUIT:
exit(0);
}
}
linux game 未來有希望 一定有希望
相信我! 因該有吧! ~ ~
沒有留言:
張貼留言