static void game_draw(GContext *ctx) {
    graphics_context_set_compositing_mode(ctx, GCompOpSet);
    // Per-frame game rendering here
    if(get_current_state() == STATE_TUTORIAL) {
        draw_track(ctx, car_get_camera_focus());
    } else if(get_current_state() == STATE_RACING) {
        draw_track(ctx, car_get_camera_focus());
        race_draw_cars(ctx);        
    } else if(get_current_state() == STATE_RESULTS) {
        // This actually only gets done once
        race_result_populate_position_layers(ctx);
    }

}
Example #2
0
File: board.c Project: verq/runners
void draw_board() {
	double value = start_position;
	double wid = 5.0;
	
	draw_track(value + NUMBER_OF_RUNERS * wid, ORANGE);
	draw_track(value, GREEN);

	for (int i = 0; i < NUMBER_OF_RUNERS; i++) {
		draw_track(value, UNFILLED);
		draw_start_position(wid, value + wid, start_shift * i);
		value = value + wid;
	}
	draw_stop_position(wid * NUMBER_OF_RUNERS, start_position);
}
Example #3
0
File: op_06.c Project: nmlgc/ReC98
void pascal near draw_tracks(unsigned char sel)
{
	int i;
	for(i = 0; i < sizeof(MUSIC_TITLES) / sizeof(MUSIC_TITLES[0]); i++) {
		draw_track(i, i == sel ? 15 : 3);
	}
}
Example #4
0
File: op_06.c Project: nmlgc/ReC98
void pascal musicroom(void)
{
	static unsigned char track_playing = 0;
	music_page = 1;

	palette_black();

	graph_showpage(0);
	graph_accesspage(0);
	graph_clear();
	graph_accesspage(1);

	pi_load_put_free(0, "op3.pi");
	music_sel = track_playing;
	draw_tracks(music_sel);
	graph_copy_page(0);

	graph_accesspage(1);
	graph_showpage(0);
	screen_back_B_snap();
	cmt_back_snap();

	graph_accesspage(1);	draw_cmt(track_playing);
	graph_accesspage(0);	draw_cmt(track_playing);

	palette_100();

	do {
		input_sense();
		if(input) {
			music_flip();
			continue;
		}
controls:
		input_sense();
		if(input & INPUT_UP) {
			draw_track(music_sel, 3);
			if(music_sel > 0) {
				music_sel--;
			} else {
				music_sel = SEL_QUIT;
			}
			if(music_sel == TRACK_COUNT) {
				music_sel--;
			}
			draw_track(music_sel, 15);
		}
		if(input & INPUT_DOWN) {
			draw_track(music_sel, 3);
			if(music_sel < SEL_QUIT) {
				music_sel++;
			} else {
				music_sel = 0;
			}
			if(music_sel == TRACK_COUNT) {
				music_sel++;
			}
			draw_track(music_sel, 15);
		}
		if(input & INPUT_SHOT || input & INPUT_OK) {
			if(music_sel != SEL_QUIT) {
				char midi_active = snd_midi_active;

				snd_midi_active = snd_midi_possible;
				snd_load(MUSIC_FILES[music_sel], SND_LOAD_SONG);
				snd_midi_active = 0;
				snd_load(MUSIC_FILES[music_sel], SND_LOAD_SONG);
				snd_midi_active = midi_active;
				snd_kaja_func(KAJA_SONG_PLAY, 0);
				track_playing = music_sel;

				draw_cmt(music_sel);
				music_flip();
				draw_cmt(music_sel);
			} else {
				break;
			}
		}
		if(input & INPUT_CANCEL) {
			break;
		}
		if(!input) {
			music_flip();
			goto controls;
		}
	} while(1);
	while(1) {
		input_sense();
		if(input) {
			music_flip();
		} else {
			break;
		}
	};
	screen_back_B_free();
	cmt_back_free();
	graph_showpage(0);
	graph_accesspage(0);
	graph_clear();
	graph_accesspage(1);
	pi_load_put_free(0, "op2.pi");
	palette_entry_rgb_show("op.rgb");
	graph_copy_page(0);
	graph_accesspage(0);
}