예제 #1
0
	void build_team_stage_two()
	{
		//place units
		//this is separate stage because we need to place units only after every other team is constructed
		place_units();

	}
예제 #2
0
파일: board.cpp 프로젝트: verkkila/cchess
Board::Board(std::string file_name, SDL_Window *wnd, SDL_Renderer *rnd, uint16_t x, uint16_t y, uint16_t w, uint16_t h) : unit_selected(false), selected_unit(nullptr), turn(WHITE)
{
        window = wnd;
        renderer = rnd;
        SDL_Surface *icon_surf = SDL_LoadBMP(file_name.c_str());
        SDL_SetColorKey(icon_surf, SDL_TRUE, 0xFFFFFFFF);
        if (!icon_surf) {
                std::cout << SDL_GetError() << std::endl;
        }
        unit_icons = SDL_CreateTextureFromSurface(renderer, icon_surf);
        SDL_FreeSurface(icon_surf);
        render_bounds.x = x;
        render_bounds.y = y;
        render_bounds.w = w;
        render_bounds.h = h;
        for (int rows = 0; rows < 8; ++rows) {
                for (int cols = 0; cols < 8; ++cols) {
                        game_tiles[rows][cols] = Tile(BORDER_SIZE_X+cols*TILE_SIZE, BORDER_SIZE_Y+rows*TILE_SIZE);
                }
        }
        place_units();
}