예제 #1
0
파일: scene7.c 프로젝트: artyfarty/bb-osx
static void ui_do_julia(double xx, double yy)
{
    int oldw = zcontext->width, oldh = zcontext->height;
    float size;

    unsigned char *vold = zcontext->vbuff;
    incalculation = 1;
    zcontext->pre = xx, zcontext->pim = yy;
    if (zcontext->windowwidth > zcontext->windowheight)
	size = zcontext->windowheight;
    else
	size = zcontext->windowwidth;
    zcontext->width = zcontext->width * size / zcontext->windowwidth - 1;
    zcontext->height = zcontext->height * size / zcontext->windowheight - 1;
    if (!dual)
	zcontext->vbuff += (oldw - zcontext->width) / 2;
    else
	zcontext->vbuff += (oldw / 2 - zcontext->width) / 2;
    do_julia(zcontext,
	     zcontext->pre,
	     zcontext->pim);
    if (dual) {
	zcontext->currentformula = formulas + 1;
	zcontext->vbuff += aa_imgwidth(context) / 2;
	do_julia(zcontext,
		 zcontext->pre,
		 zcontext->pim);
	zcontext->currentformula = formulas;
    }
    zcontext->width = oldw;
    zcontext->height = oldh;
    zcontext->vbuff = vold;
    ui_display();
}
예제 #2
0
파일: uisdl.c 프로젝트: Borf/CaveQuake
static void
display(void)
{
    double time;

    time = (double) SDL_GetTicks() / 1000.0 - starttime;
    ui_move(time);
    ui_display(r_context, time);
    hud_render(r_context);
    SDL_GL_SwapBuffers();
}
예제 #3
0
파일: scene7.c 프로젝트: artyfarty/bb-osx
static void updatestatus(void)
{
    double times = (zcontext->currentformula->v.mc - zcontext->currentformula->v.nc) / (zcontext->s.mc - zcontext->s.nc);
    ui_display();
    sprintf(zoomed, "%.2f", times);

    tl_process_group(syncgroup, NULL);
    bbupdate();
    drawingtime = tl_lookup_timer(maintimer);
    tl_reset_timer(maintimer);
    if (drawingtime > 200000)
	drawingtime = 200000;
    mul = (double) drawingtime / FRAMETIME;
    incalculation = 0;
}
예제 #4
0
파일: kernel.c 프로젝트: 8l/Hydrogen
void kmain_bsp(void)
{
    size_t i = 0;
    for (i = 0; i < 256; ++i) {
        isr_handlers[i] = (uintptr_t) &fault_gp;
    }
    isr_handlers[KEYBOARD_IRQ_VECTOR] = (uintptr_t) &keyboard_handler;

    char *buffer = (char *) HY_INFO_ROOT->free_paddr;
    buffer = build_overview(buffer);
    buffer = build_cpu(&buffer[1]);
    buffer = build_ioapic(&buffer[1]);
    buffer = build_memory(&buffer[1]);
    buffer = build_modules(&buffer[1]);

    ui_display(0, 0);
    asm volatile ("sti");
    keyboard_init();
    while (1);
}
예제 #5
0
파일: ncrzlstat.c 프로젝트: Don42/ncrzlstat
int
main(int argc, char *argv[])
{
	enum fetch_ipversion ipresolve = FETCH_IPVANY;

	int ch;
	while ((ch = getopt(argc, argv, "h46")) != -1) {
		switch (ch) {
		case '4':
			if (ipresolve == FETCH_IPV6ONLY) {
				usage();
				exit(EXIT_FAILURE);
			}
			ipresolve = FETCH_IPV4ONLY;
			break;
		case '6':
			if (ipresolve == FETCH_IPV4ONLY) {
				usage();
				exit(EXIT_FAILURE);
			}
			ipresolve = FETCH_IPV6ONLY;
			break;
		case 'h':
			usage();
			exit(EXIT_SUCCESS);
		default:
			usage();
			exit(EXIT_FAILURE);
		}
	}

	char *cosmkey = getenv("RZLCOSMKEY");
	if (cosmkey == NULL) {
		fprintf(stderr,
		    "Environment variable RZLCOSMKEY is not set.\n");
		exit(EXIT_FAILURE);
	}
	char *cosmurl;
	asprintf(&cosmurl, COSMURL, cosmkey);

	ui_init();
	atexit(&ui_deinit);

	enum ui_event event = UI_UNDEFINED;
	while (event != UI_QUIT) {
		char *status = fetch_data_string(STATUSURL, ipresolve);
		assert(status != NULL);

		char *cosm = fetch_data_string(cosmurl, ipresolve);
		assert(cosm != NULL);

		bool loop = true;
		bool refresh = true;
		time_t last = time(NULL);
		while (loop) {
			if (refresh) {
				refresh = false;

				struct model *model = parse_fill_model(last,
				    status, cosm);
				assert(model != NULL);

				ui_display(model);

				parse_free_model(model);
			}

			event = ui_getevent();
			switch (event) {
			case UI_QUIT:
				loop = false;
				break;
			case UI_RESIZE:
				refresh = true;
				break;
			case UI_UNDEFINED:
			default:
				break;
			}

			if (last <= time(NULL) - REFRESH)
				loop = false;
		}

		free(cosm);
		free(status);
	}

	free(cosmurl);

	return (0);
}