#include "main.h"
#include "Playmat.h"
const int WINDOW_WIDTH = 800;
const int WINDOW_HEIGHT = 600;
bool gamerunning = true;
SDL_Surface* screen = SDL_SetVideoMode( WINDOW_WIDTH, WINDOW_HEIGHT, 0,
SDL_SWSURFACE | SDL_FULLSCREEN);
Playmat::Playmat()
{
playmat_source.x = 0;
playmat_source.y = 0;
playmat_source.w = 804;
playmat_source.h = 604;
playmat_dest.x = 0;
playmat_dest.y = 0;
playmat_dest.w = 20;
playmat_dest.h = 100;
}
Playmat::~Playmat()
{
}
void Playmat::Create()
{
SDL_Surface* playmat = SDL_LoadBMP("data/playmat.bmp");
}
void Playmat::Destroy()
{
}
void Playmat::Draw()
{
SDL_BlitSurface(playmat, &playmat_source, screen, &playmat_dest);
}
int main(int argc, char **argv)
{
SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER);
SDL_Surface* cardbg = SDL_LoadBMP("data/cardbg.bmp");
SDL_Surface* aguhand = SDL_LoadBMP("data/agumon card(hand size).bmp");
SDL_Surface* wargreyrow = SDL_LoadBMP("data/Wargreymon card (row size).bmp");
SDL_Surface* weregarururow = SDL_LoadBMP("data/Weregarurumon card(row size).bmp");
SDL_Surface* onlinepile = SDL_LoadBMP("data/online pile.bmp");
SDL_Rect cardbg_source;
cardbg_source.x = 0;
cardbg_source.y = 0;
cardbg_source.w = 248;
cardbg_source.h = 329;
SDL_Rect cardbg_dest;
cardbg_dest.x = 450;
cardbg_dest.y = 100;
cardbg_dest.w = 20;
cardbg_dest.h = 100;
SDL_Rect aguhand_source;
aguhand_source.x = 0;
aguhand_source.y = 0;
aguhand_source.w = 126;
aguhand_source.h = 168;
SDL_Rect aguhand_dest;
aguhand_dest.x = 163;
aguhand_dest.y = 420;
aguhand_dest.w = 20;
aguhand_dest.h = 100;
SDL_Rect wargreyrow_source;
wargreyrow_source.x = 0;
wargreyrow_source.y = 0;
wargreyrow_source.w = 117;
wargreyrow_source.h = 156;
SDL_Rect wargreyrow_dest;
wargreyrow_dest.x = 170;
wargreyrow_dest.y = 234;
wargreyrow_dest.w = 20;
wargreyrow_dest.h = 100;
SDL_Rect weregarururow_source;
weregarururow_source.x = 0;
weregarururow_source.y = 0;
weregarururow_source.w = 117;
weregarururow_source.h = 156;
SDL_Rect weregarururow_dest;
weregarururow_dest.x = 296;
weregarururow_dest.y = 234;
weregarururow_dest.w = 20;
weregarururow_dest.w = 100;
SDL_Rect onlinepile_source;
onlinepile_source.x = 0;
onlinepile_source.y = 0;
onlinepile_source.w = 150;
onlinepile_source.h = 198;
SDL_Rect onlinepile_dest;
onlinepile_dest.x = 10;
onlinepile_dest.y = 20;
onlinepile_dest.w = 20;
onlinepile_dest.h = 20;
SDL_Event event;
while(gamerunning)
{
if(SDL_PollEvent(&event))
{
if(event.type == SDL_QUIT)
{
gamerunning = false;
}
Uint8 *keysheld = SDL_GetKeyState(0);
if( keysheld[SDLK_ESCAPE])
{
gamerunning=false;
break;
}
}
SDL_BlitSurface(onlinepile, &onlinepile_source, screen, &onlinepile_dest);
SDL_BlitSurface(cardbg, &cardbg_source, NULL, &cardbg_dest);
SDL_BlitSurface(aguhand, &aguhand_source, screen, &aguhand_dest);
SDL_BlitSurface(wargreyrow, &wargreyrow_source, screen, &wargreyrow_dest);
SDL_BlitSurface(weregarururow, &weregarururow_source, screen, &weregarururow_dest);
SDL_Flip(screen);
}
SDL_Quit();
return 0;
}
#ifndef _MAIN_H_
#define _MAIN_H_
#include <iostream>
#include <SDL/SDL.h>
#endif
#ifndef PLAYMAT_H_
#define PLAYMAT_H_
class Playmat
{
public:
Playmat();
~Playmat();
void Create();
void Destroy();
void Draw();
private:
SDL_Rect playmat_source;
SDL_Rect playmat_dest;
SDL_Surface* playmat;
};
#endif