コード例 #1
0
ファイル: main.cpp プロジェクト: BigR-Lab/CodeRes_Cpp
int CreateScene() {

    CFURLRef balls_dat_url = CFBundleCopyResourceURL(CFBundleGetMainBundle(), CFSTR("balls"), CFSTR("dat"),NULL);
    char filename[1024];
    CFURLGetFileSystemRepresentation(balls_dat_url, true, (UInt8*)filename, (CFIndex)sizeof(filename));
    CFRelease(balls_dat_url);

    global_scene = rt_newscene();
    rt_initialize();

    if ( readmodel(filename, global_scene) != 0 ) {
        rt_finalize();
        return -1;
    }

    // need these early for create_graphics_window() so grab these here...
    scenedef *scene = (scenedef *) global_scene;

    get_screen_resolution(&global_xsize, &global_ysize);

    // scene->hres and scene->vres should be equal to screen resolution
    scene->hres = global_xwinsize = global_xsize;
    scene->vres = global_ywinsize = global_ysize;
    return 0;
}
コード例 #2
0
ファイル: console.c プロジェクト: 304471720/GridOS
void hal_console_init(void)
{
	video_console_ops.write = write_string;
	
	dsp_ctx.window.topline = 2 * sizeof(unsigned int);
	dsp_ctx.window.pos_x = 0;
	dsp_ctx.window.pos_y = 0;
	dsp_ctx.window.lastchar = 2 * sizeof(unsigned int);
	dsp_ctx.window.downward = 0;
	dsp_ctx.window.step[0] = -1;
	dsp_ctx.window.step[1] = -1;

	/* fix me 目前仅静态分配 */
	memset(&dsp_ctx.buffer.buf, 0, CONSOLE_BUFFER_SIZE);

	dsp_ctx.color = WHITE_PIX;
	dsp_ctx.buffer.topline = 2 * sizeof(unsigned int);
	dsp_ctx.buffer.lastchar = 2 * sizeof(unsigned int); /*  */	
	dsp_ctx.buffer.tail_line = 2 * sizeof(unsigned int);
	reset_up_idx();

	/* Init the global lock */
	spin_lock_init(&dsp_ctx.lock);

	/* 取分辨率 */
	get_screen_resolution(&dsp_ctx.max_x, &dsp_ctx.max_y, NULL); 

	console_cursor_setup();
	console_cursor_set_height(DOTFNT_CHAR_LINE_HEIGHT);

	return;
}