Exemple #1
0
static void draw_game(game_t *p_game)
{
  center_map(p_game);

  vMapSetXY(p_game->bg_x, p_game->bg_y);
  vUpdateMap();

  /* Draw everything */
  vDrawObject(p_game->player.sprite.pt.x-p_game->bg_x, p_game->player.sprite.pt.y-p_game->bg_y,
	      p_game->pp_sprites[p_game->player.sprite.frame]);
  vFlipScreen(1);
}
void ofApp::draw()
{
	ofBackground(0);
	if (gen_fb)
	{
		draw_fb();
	}
	if (gen_tw)
	{
		draw_tw();
	}
	
	draw_block();
	if(centering)
		center_map();
	
	ofSetColor(255, 155, 0, 255);
	ofDrawRectangle(0, 0, map_win_x1, 1000);
	ofSetColor(0, 0, 0);
	ofDrawRectangle(0, 0, (map_win_x1-2), 1000);
	
	ofSetColor(255, 155, 0, 255);
	ofDrawRectangle(0, 0, 10000, 200); 
	ofSetColor(0, 0, 0);
	ofDrawRectangle(0, 0, 10000, 198);
	
	ofSetColor(255, 155, 0, 255);
	ofDrawRectangle(0, map_win_y2, 10000, 150);
	ofSetColor(0, 0, 0);
	ofDrawRectangle(0, (map_win_y2+2), 10000, 150);
	
	ofDrawRectangle(0, 0, (map_win_x1-2), 1000);
	
	ofSetColor(255, 155, 0, 255);
	ofDrawRectangle(map_win_x2, 0, 10000, 800);
	ofSetColor(0, 0, 0);
	ofDrawRectangle((map_win_x2+2), 0, 10000, 800);
	
	ofDrawRectangle(0, 0, 1000, (map_win_y1-2));
	ofDrawRectangle(0, (map_win_y2+2), 10000, 1000);
	
	/*draw GUI*/
	gui.draw();
	print_fb_users();
	print_tw_users();
	draw_msg();
	update();
}
Exemple #3
0
void	calcul_2d(t_pts *pts, t_win *w, int total)
{
	int		i;
	int		j;

	i = 0;
	while (i < total)
	{
		j = 0;
		while (j < w->map[j].size)
		{
			pts[i].y2d = ((pts[i].x3d + pts[i].y3d) * w->zoomy);
			pts[i].x2d = ((pts[i].x3d - pts[i].y3d) * w->zoomx);
			j++;
			i++;
		}
	}
	center_map(w, pts, total);
	draw_map(pts, w);
}
Exemple #4
0
void create_map(void) {
	struct island_data *isle;

	init_grid();
	
	// make a ton of plains islands
	printf("Generating islands with %d total land target...\n", TARGET_LAND_SIZE);
	create_islands();

	printf("Adding mountains and rivers...\n");
	for (isle = island_list; isle; isle = isle->next) {
		// fillings based on location (it's not desert or jungle YET, so we check prcs
		if (IS_IN_Y_PRC_RANGE(Y_COORD(isle->loc), DESERT_START_PRC, DESERT_END_PRC)) {
			// desert
			add_mountains(isle);
			// rare chance of river
			if (!number(0, 2)) {
				add_river(isle);
			}
		}
		else if (IS_IN_Y_PRC_RANGE(Y_COORD(isle->loc), JUNGLE_START_PRC, JUNGLE_END_PRC)) {
			// jungle
			// chance of mountain
			if (!number(0, 1)) {
				add_mountains(isle);
			}
			// always get extra river
			add_river(isle);
			add_river(isle);
		}
		else {
			// not jungle or desert
			add_mountains(isle);
			add_river(isle);
			
			// chance to add additional river
			if (!number(0, 2)) {
				add_river(isle);
			}
		}

		// not currently adding passes
		// add_pass(isle);
	}
	
	// these really need to go in order, as they modify the map in passes
	printf("Adding desert...\n");
	add_latitude_terrain(DESERT, DESERT_START_PRC, DESERT_END_PRC);
	printf("Adding jungle...\n");
	add_latitude_terrain(JUNGLE, JUNGLE_START_PRC, JUNGLE_END_PRC);
	
	printf("Numbering islands and fixing lakes...\n");
	number_islands_and_fix_lakes();
	
	printf("Irrigating from rivers...\n");
	replace_near(DESERT, PLAINS, RIVER, 2);
	replace_near(DESERT, PLAINS, LAKE, 2);
	replace_near(JUNGLE, SWAMP, RIVER, 2);
	replace_near(JUNGLE, SWAMP, LAKE, 2);

	// tundra if no y-wrap
	if (!USE_WRAP_Y && TUNDRA_HEIGHT >= 1) {
		printf("Adding tundra...\n");
		add_tundra();
	}
	
	// center maps if they use only x-wrap
	if (USE_WRAP_X && !USE_WRAP_Y) {
		printf("Centering map horizontally...\r\n");
		center_map();
	}
	
	// finish up the map
	printf("Finishing map...\n");
	complete_map();
	add_start_points();
}