コード例 #1
0
ファイル: console.c プロジェクト: akoskovacs/Akosix
void console_init()
{
    disable_cursor();
    if (console_attributes == 0)
        console_attributes = (FG_COLOR_BLUE | LIGHT | BG_COLOR_WHITE);
    clear_console();
}
コード例 #2
0
ファイル: console.c プロジェクト: TacOS-team/tacos
void focus_console(int n) {
	active_console = n;
	switch_page(n);
	disable_cursor(!consoles[n].disp_cur);
	if (consoles[n].disp_cur) {
		cursor_position_video(n, consoles[n].cur_x, consoles[n].cur_y);
	}
}
コード例 #3
0
int main() {
	int i = 0;
	int j = 1;
	int musicCounter = 0;
	UINT8 *base = Physbase();
	UINT8 *base2 = buffer;
	
	UINT8 ch;
	UINT8 has_moved = 1;
	UINT8 switchBase = 0;
	
	UINT32 timeNow, timeThen, prevCall;

	struct Model game;
	struct Model *gamePtr = &game;
	
	base2 += 256 - ((long)base2 & (long)0xFF);

	init_model(gamePtr);
	
	disable_cursor();
	Setscreen(-1, base2, -1);
	disable_cursor();
	Setscreen(-1, base, -1);
	
	timeNow = get_time();
	timeThen = timeNow + DELAY;
	
	start_sound();
	prevCall = timeNow;
	srand(time(0));
	
	while(!game_over(gamePtr)) {
	
		if(update_music(get_time() - prevCall)){
			prevCall = get_time();		
		}
			
		/* Check if there is kbd input */
		if(kbd_is_waiting()) {
			ch = kbd_read_char();	
			request_player_move(gamePtr, 0, ch);
		}

		/* If clock ticked */
		if(timeNow != get_time()) {

			
			/* Check if a second has passed */
			if(timeNow >= timeThen) {
				update_score(gamePtr, 1);
				timeThen = timeNow + DELAY;
			}
			
			/* Move player ship */
			has_moved = move_player_ship(gamePtr, 0);
			if(has_moved){
				thruster();
			}

			/* Move enemy ships and check collisions with player ship */
			for(i = 0; i < NUM_ENEMIES; i++) {
				move_enemy_ship(gamePtr, i);
				collision(gamePtr,i,0);
			}	
			

			/* Render the model with double buffering */
			if(switchBase) {
				render_model(gamePtr, base, has_moved);
				Setscreen(-1, base, -1);
			}
			else {
				render_model(gamePtr, base2, has_moved);
				Setscreen(-1, base2, -1);
			}

			Vsync();
			switchBase = !switchBase;
			
		}
		
		stop_thruster();		
		timeNow = get_time();
	
	}
	
	stop_sound();
	explosion();
	
	render_model(gamePtr, base, has_moved);
	Setscreen(-1, base, -1);
	Vsync();
	
	return 0;
}