Example #1
0
int
main(int argc, char *argv[])
{
	struct display *display;
	struct demoapp *app;

	parse_options(options, ARRAY_LENGTH(options), &argc, argv);
	if (option_help) {
		printf(help_text, argv[0]);
		return 0;
	}

	display = display_create(&argc, argv);
	if (display == NULL) {
		fprintf(stderr, "failed to create display: %m\n");
		return -1;
	}

	app = demoapp_create(display);

	display_run(display);

	demoapp_destroy(app);
	display_destroy(display);

	return 0;
}
Example #2
0
File: editor.c Project: Blei/weston
int
main(int argc, char *argv[])
{
	struct editor editor;

	editor.display = display_create(argc, argv);
	if (editor.display == NULL) {
		fprintf(stderr, "failed to create display: %m\n");
		return -1;
	}
	wl_display_add_global_listener(display_get_display(editor.display),
				       global_handler, &editor);


	editor.window = window_create(editor.display);
	editor.widget = frame_create(editor.window, &editor);

	editor.entry = text_entry_create(&editor, "Entry");
	editor.editor = text_entry_create(&editor, "Editor");

	window_set_title(editor.window, "Text Editor");

	widget_set_redraw_handler(editor.widget, redraw_handler);
	widget_set_resize_handler(editor.widget, resize_handler);
	widget_set_button_handler(editor.widget, button_handler);

	window_schedule_resize(editor.window, 500, 400);

	display_run(editor.display);

	text_entry_destroy(editor.entry);
	text_entry_destroy(editor.editor);

	return 0;
}
Example #3
0
int
main (void)
{
    display scr;
    polygon p;

    display_create(&scr, 80, 35);
    obj_pol_create(&p, 5);
    srand(time(NULL));

    for (;;)
    {
        obj_pol_add_vertex(&p, 1 + abs(rand() % scr.width-2), 1 + abs(rand() % scr.height-2));
        obj_pol_add_vertex(&p, 1 + abs(rand() % scr.width-2), 1 + abs(rand() % scr.height-2));
        obj_pol_add_vertex(&p, 1 + abs(rand() % scr.width-2), 1 + abs(rand() % scr.height-2));
        obj_pol_add_vertex(&p, 1 + abs(rand() % scr.width-2), 1 + abs(rand() % scr.height-2));
        obj_pol_add_vertex(&p, 1 + abs(rand() % scr.width-2), 1 + abs(rand() % scr.height-2));

        draw_polygon(&scr, &p);

        display_show(&scr);
        display_clear(&scr);
#ifdef _WIN32
        Sleep(150);
#else
        usleep(150000);
#endif
    }
}
Example #4
0
int
main(int argc, char *argv[])
{
	struct stacking stacking;

	memset(&stacking, 0, sizeof stacking);

#ifdef HAVE_PANGO
	g_type_init();
#endif

	stacking.display = display_create(&argc, argv);
	if (stacking.display == NULL) {
		fprintf(stderr, "Failed to create display: %m\n");
		return -1;
	}

	display_set_user_data(stacking.display, &stacking);

	stacking.root_window = new_window(&stacking, NULL);

	display_run(stacking.display);

	window_destroy(stacking.root_window);
	display_destroy(stacking.display);

	return 0;
}
Example #5
0
int
main(int argc, char *argv[])
{
	struct display *display;
	struct calibrator *calibrator;

	display = display_create(argc, argv);

	if (display == NULL) {
		fprintf(stderr, "failed to create display: %m\n");
		return -1;
	}

	calibrator = calibrator_create(display);

	if (!calibrator)
		return -1;

	display_run(display);

	calibrator_destroy(calibrator);
	display_destroy(display);

	return 0;
}
Example #6
0
int
main(int argc, char *argv[])
{
	struct display *display;
	struct demoapp *app;

	parse_options(options, ARRAY_LENGTH(options), &argc, argv);
	if (option_help) {
		printf(help_text, argv[0]);
		return 0;
	}

	display = display_create(&argc, argv);
	if (display == NULL) {
		fprintf(stderr, "failed to create display: %m\n");
		return -1;
	}

	if (!display_has_subcompositor(display)) {
		fprintf(stderr, "compositor does not support "
			"the subcompositor extension\n");
		return -1;
	}

	app = demoapp_create(display);

	display_run(display);

	demoapp_destroy(app);
	display_destroy(display);

	return 0;
}
Example #7
0
int
main(int argc, char *argv[])
{
	struct display *d;
	struct cliptest *cliptest;

	if (argc > 1) {
		if (argc == 2 && !strcmp(argv[1], "-b"))
			return benchmark();
		printf("Usage: %s [OPTIONS]\n  -b  run benchmark\n", argv[0]);
		return 1;
	}

	d = display_create(&argc, argv);
	if (d == NULL) {
		fprintf(stderr, "failed to create display: %m\n");
		return -1;
	}

	cliptest = cliptest_create(d);
	display_run(d);

	cliptest_destroy(cliptest);
	display_destroy(d);

	return 0;
}
Example #8
0
/**
 * \brief Connects to the display, creates the window and hands over
 * to the main loop.
 */
int
main(int argc, char *argv[])
{
	struct display *d;
	struct eventdemo *e;

	parse_options(eventdemo_options,
		      ARRAY_LENGTH(eventdemo_options), &argc, argv);

	/* Connect to the display and have the arguments parsed */
	d = display_create(&argc, argv);
	if (d == NULL) {
		fprintf(stderr, "failed to create display: %m\n");
		return -1;
	}

	/* Create new eventdemo window */
	e = eventdemo_create(d);
	if (e == NULL) {
		fprintf(stderr, "failed to create eventdemo: %m\n");
		return -1;
	}

	display_run(d);

	/* Release resources */
	eventdemo_destroy(e);
	display_destroy(d);

	return 0;
}
Example #9
0
int main(int argc, char *argv[])
{
	struct flower flower;
	struct display *d;
	struct timeval tv;

	d = display_create(&argc, argv);
	if (d == NULL) {
		fprintf(stderr, "failed to create display: %m\n");
		return -1;
	}

	gettimeofday(&tv, NULL);
	srandom(tv.tv_usec);

	flower.width = 200;
	flower.height = 200;
	flower.display = d;
	flower.window = window_create(d);
	flower.widget = window_add_widget(flower.window, &flower);
	window_set_title(flower.window, "Flower");

	widget_set_resize_handler(flower.widget, resize_handler);
	widget_set_redraw_handler(flower.widget, redraw_handler);
	widget_set_button_handler(flower.widget, button_handler);
	widget_set_default_cursor(flower.widget, CURSOR_HAND1);
	widget_set_touch_down_handler(flower.widget, touch_down_handler);

	window_schedule_resize(flower.window, flower.width, flower.height);

	display_run(d);

	return 0;
}
Example #10
0
int
main(int argc, char *argv[])
{
	struct display *d;
	int i;
	int view_counter = 0;

#if !GLIB_CHECK_VERSION(2, 35, 0)
	g_type_init();
#endif

	parse_options(view_options, ARRAY_LENGTH(view_options), &argc, argv);

	d = display_create(&argc, argv);
	if (d == NULL) {
		fprintf(stderr, "failed to create display: %m\n");
		return -1;
	}

	for (i = 1; i < argc; i++)
		view_create (d, i, argv[i], option_fullscreen, &view_counter);

	if (view_counter > 0)
		display_run(d);

	return 0;
}
Example #11
0
int main ()
{
    display tela;
    display_create(&tela, 52, 25);

    char direcao = 77;
    int posicao[2] = {tela.width/2, tela.height/2 + 1};

    int inimigos[23*48 - 1][2];
    int n_inimigos = 0;
	int vel = 150;

	menu(&tela);
    criar_cobra(&tela);

    while (1) {
        display_clear(&tela);

        criar_inimigo(&tela, inimigos, &n_inimigos);
        int i;
        for (i = 0; i < n_inimigos; i++)
            display_put_raw(&tela, inimigos[i][0], inimigos[i][1], 'X');

        criar_bordas(&tela);
        display_paint(&tela, posicao[0], posicao[1]);

        while (kbhit()){
            char aux = getch();
            if (aux == CIMA || aux == BAIXO || aux == ESQUERDA || aux == DIREITA)
                direcao = aux;
        }

        switch (direcao)
        {
            case CIMA:
                posicao[1]++;
                break;
            case BAIXO:
                posicao[1]--;
                break;
            case ESQUERDA:
                posicao[0]--;
                break;
            case DIREITA:
                posicao[0]++;
                break;
        }

        velocidade(&vel);
        placar(&tela, n_inimigos);
        verificar_morte(&tela, posicao);
        display_show(&tela);
		Sleep(vel);
    }

    return 0;
}
Example #12
0
/**
 * \brief Connects to the display, creates the window and hands over
 * to the main loop.
 */
int
main(int argc, char *argv[])
{
	struct display *d;
	struct eventdemo *e;

	if (parse_options(eventdemo_options,
			  ARRAY_LENGTH(eventdemo_options), &argc, argv) > 1) {
		unsigned k;
		printf("Usage: %s [OPTIONS]\n\n", argv[0]);
		for (k = 0; k < ARRAY_LENGTH(eventdemo_options); k++) {
			const struct weston_option* p = &eventdemo_options[k];
			if (p->name) {
				printf("  --%s", p->name);
				if (p->type != WESTON_OPTION_BOOLEAN)
					printf("=VALUE");
				putchar('\n');
			}
			if (p->short_name) {
				printf("  -%c", p->short_name);
				if (p->type != WESTON_OPTION_BOOLEAN)
					printf("VALUE");
				putchar('\n');
			}
		}
		return 1;
	}

	if (!log_redraw && !log_resize && !log_focus && !log_key &&
	    !log_button && !log_axis && !log_motion)
	  log_redraw = log_resize = log_focus = log_key =
	    log_button = log_axis = log_motion = 1;

	/* Connect to the display and have the arguments parsed */
	d = display_create(&argc, argv);
	if (d == NULL) {
		fprintf(stderr, "failed to create display: %m\n");
		return -1;
	}

	/* Create new eventdemo window */
	e = eventdemo_create(d);
	if (e == NULL) {
		fprintf(stderr, "failed to create eventdemo: %m\n");
		return -1;
	}

	display_run(d);

	/* Release resources */
	eventdemo_destroy(e);
	display_destroy(d);

	return 0;
}
Example #13
0
void
app_init(int argc, char **argv)
{
  framework_set_mouse_handler(handle_mouse);
  framework_set_keyboard_handlers(handle_keyup, handle_keydown);
  framework_set_frame_handler(draw_frame);
  framework_set_resize_handler(handle_resize);
  
  screen = display_create("Star", 800, 600, 24, 0);
  init();
}
Example #14
0
int main(int argc, char *argv[])
{
	struct display *d;

	d = display_create(&argc, &argv, NULL, NULL);
	if (d == NULL) {
		fprintf(stderr, "failed to create display: %m\n");
		return -1;
	}
	gears_create(d);
	display_run(d);

	return 0;
}
Example #15
0
int main(int argc, char *argv[])
{
	struct timespec ts;
	struct smoke smoke;
	struct display *d;
	int size;

	d = display_create(&argc, argv);
	if (d == NULL) {
		fprintf(stderr, "failed to create display: %m\n");
		return -1;
	}

	smoke.width = 200;
	smoke.height = 200;
	smoke.display = d;
	smoke.window = window_create(d);
	smoke.widget = window_add_widget(smoke.window, &smoke);
	window_set_title(smoke.window, "smoke");

	window_set_buffer_type(smoke.window, WINDOW_BUFFER_TYPE_SHM);
	clock_gettime(CLOCK_MONOTONIC, &ts);
	srandom(ts.tv_nsec);

	smoke.current = 0;
	size = smoke.height * smoke.width;
	smoke.b[0].d = calloc(size, sizeof(float));
	smoke.b[0].u = calloc(size, sizeof(float));
	smoke.b[0].v = calloc(size, sizeof(float));
	smoke.b[1].d = calloc(size, sizeof(float));
	smoke.b[1].u = calloc(size, sizeof(float));
	smoke.b[1].v = calloc(size, sizeof(float));

	widget_set_motion_handler(smoke.widget, mouse_motion_handler);
	widget_set_touch_motion_handler(smoke.widget, touch_motion_handler);
	widget_set_resize_handler(smoke.widget, resize_handler);
	widget_set_redraw_handler(smoke.widget, redraw_handler);

	window_set_user_data(smoke.window, &smoke);

	widget_schedule_resize(smoke.widget, smoke.width, smoke.height);

	display_run(d);

	widget_destroy(smoke.widget);
	window_destroy(smoke.window);
	display_destroy(d);

	return 0;
}
Example #16
0
int main(int argc, char *argv[])
{
	struct display *d;
	struct gears *gears;

	d = display_create(&argc, argv);
	if (d == NULL) {
		fprintf(stderr, "failed to create display: %m\n");
		return -1;
	}
	gears = gears_create(d);
	display_run(d);

	gears_destroy(gears);
	display_destroy(d);

	return 0;
}
Example #17
0
int main(int argc, char *argv[])
{
	struct display *d;
	struct wscreensaver screensaver = { 0 };

	init_frand();

	if (parse_options(wscreensaver_options,
			ARRAY_LENGTH(wscreensaver_options), &argc, argv) > 1) {
		printf("Usage: %s [OPTIONS]\n  --demo for demo mode\n",
		       argv[0]);
		exit(1);
	}

	d = display_create(&argc, argv);
	if (d == NULL) {
		fprintf(stderr, "failed to create display: %m\n");
		return EXIT_FAILURE;
	}

	if (!demo_mode) {
		/* iterates already known globals immediately */
		display_set_user_data(d, &screensaver);
		display_set_global_handler(d, global_handler);
		if (!screensaver.interface) {
			fprintf(stderr,
				"Server did not offer screensaver interface,"
				" exiting.\n");
			return EXIT_FAILURE;
		}
	}

	if (init_wscreensaver(&screensaver, d) < 0) {
		fprintf(stderr, "wscreensaver init failed.\n");
		return EXIT_FAILURE;
	}

	display_run(d);

	free((void *)progname);

	return EXIT_SUCCESS;
}
Example #18
0
int main(int argc, char *argv[])
{
	cairo_surface_t *s;
	struct flower flower;
	struct display *d;
	struct timeval tv;

	d = display_create(&argc, &argv, NULL, NULL);
	if (d == NULL) {
		fprintf(stderr, "failed to create display: %m\n");
		return -1;
	}

	gettimeofday(&tv, NULL);
	srandom(tv.tv_usec);

	flower.width = 200;
	flower.height = 200;
	flower.display = d;
	flower.window = window_create(d, flower.width, flower.height);

	window_set_title(flower.window, "flower");
	window_set_decoration(flower.window, 0);
	window_draw(flower.window);
	s = window_get_surface(flower.window);
	if (s == NULL || cairo_surface_status (s) != CAIRO_STATUS_SUCCESS) {
		fprintf(stderr, "failed to create cairo egl surface\n");
		return -1;
	}

	draw_stuff(s, flower.width, flower.height);
	cairo_surface_flush(s);
	cairo_surface_destroy(s);
	window_flush(flower.window);

	window_set_motion_handler(flower.window, motion_handler);
	window_set_button_handler(flower.window, button_handler);
	window_set_user_data(flower.window, &flower);
	display_run(d);

	return 0;
}
Example #19
0
struct client *client_create(int sock_fd)
{
	struct client *client;
	ssize_t size;
	client = calloc(1, sizeof(struct client));
	if (!client)
		error(1, errno, "cannot allocate memory");

	client->d = display_create();
	client->w = window_create(client->d);
	client->sock_fd = sock_fd;

	init_shaders(client);

	glViewport(0, 0, client->w->width, client->w->height);
	glClearColor(0.0, 1.0, 0.0, 0.0);
	glClear(GL_COLOR_BUFFER_BIT);

	eglSwapBuffers(client->d->x11.egl_display, client->w->x11.egl_surface);

	glUniform1i(client->tex_loc, 0);
	sleep(1);
	for (;;) {
/* glClear(GL_COLOR_BUFFER_BIT); */
/* eglSwapBuffers(client->d->x11.egl_display, client->w->x11.egl_surface); */
		struct cmd_buf buf;
		int myfd;
		size = sock_fd_read(client->sock_fd, &buf, sizeof(buf), &myfd);
		if (size <= 0)
			break;

		if (buf.type == CMD_TYPE_BUF) {
			add_texture(client, &buf, myfd);
		} else if (buf.type == CMD_TYPE_DIRT) {
			draw_screen(client);

			eglSwapBuffers(client->d->x11.egl_display, client->w->x11.egl_surface);
		}

	}
	return client;
}
Example #20
0
int
main(int argc, char *argv[])
{
	struct display *display;
	struct clickdot *clickdot;

	display = display_create(&argc, argv);
	if (display == NULL) {
		fprintf(stderr, "failed to create display: %m\n");
		return -1;
	}

	clickdot = clickdot_create(display);

	display_run(display);

	clickdot_destroy(clickdot);
	display_destroy(display);

	return 0;
}
Example #21
0
int
main(int argc, char *argv[])
{
	struct display *d;
	int i;
	int image_counter = 0;

	d = display_create(&argc, argv);
	if (d == NULL) {
		fprintf(stderr, "failed to create display: %m\n");
		return -1;
	}

	for (i = 1; i < argc; i++)
		image_create(d, argv[i], &image_counter);

	if (image_counter > 0)
		display_run(d);

	return 0;
}
Example #22
0
int
main(int argc, char *argv[])
{
	struct display *display;
	struct resizor *resizor;

	display = display_create(&argc, argv);
	if (display == NULL) {
		fprintf(stderr, "failed to create display: %m\n");
		return -1;
	}

	resizor = resizor_create(display);

	display_run(display);

	resizor_destroy(resizor);
	display_destroy(display);

	return 0;
}
Example #23
0
int main(int argc, char *argv[])
{
	struct display *d;
	struct wscreensaver screensaver = { 0 };

	init_frand();

	argc = parse_options(wscreensaver_options,
			     ARRAY_LENGTH(wscreensaver_options), argc, argv);

	d = display_create(argc, argv);
	if (d == NULL) {
		fprintf(stderr, "failed to create display: %m\n");
		return EXIT_FAILURE;
	}

	if (!demo_mode) {
		/* iterates already known globals immediately */
		wl_display_add_global_listener(display_get_display(d),
					       global_handler, &screensaver);
		if (!screensaver.interface) {
			fprintf(stderr,
				"Server did not offer screensaver interface,"
				" exiting.\n");
			return EXIT_FAILURE;
		}
	}

	if (init_wscreensaver(&screensaver, d) < 0) {
		fprintf(stderr, "wscreensaver init failed.\n");
		return EXIT_FAILURE;
	}

	display_run(d);

	free((void *)progname);

	return EXIT_SUCCESS;
}
Example #24
0
int
main(int argc, char *argv[])
{
	struct editor editor;

	memset(&editor, 0, sizeof editor);

	editor.display = display_create(argc, argv);
	if (editor.display == NULL) {
		fprintf(stderr, "failed to create display: %m\n");
		return -1;
	}

	display_set_user_data(editor.display, &editor);
	display_set_global_handler(editor.display, global_handler);

	editor.window = window_create(editor.display);
	editor.widget = frame_create(editor.window, &editor);

	editor.entry = text_entry_create(&editor, "Entry");
	editor.editor = text_entry_create(&editor, "Editor");

	window_set_title(editor.window, "Text Editor");
	window_set_key_handler(editor.window, key_handler);
	window_set_user_data(editor.window, &editor);

	widget_set_redraw_handler(editor.widget, redraw_handler);
	widget_set_resize_handler(editor.widget, resize_handler);
	widget_set_button_handler(editor.widget, editor_button_handler);

	window_schedule_resize(editor.window, 500, 400);

	display_run(editor.display);

	text_entry_destroy(editor.entry);
	text_entry_destroy(editor.editor);

	return 0;
}
Example #25
0
int
main(int argc, char *argv[])
{
	struct virtual_keyboard virtual_keyboard;

	virtual_keyboard.display = display_create(argc, argv);
	if (virtual_keyboard.display == NULL) {
		fprintf(stderr, "failed to create display: %m\n");
		return -1;
	}

	virtual_keyboard.context = NULL;
	virtual_keyboard.preedit_string = NULL;

	display_set_user_data(virtual_keyboard.display, &virtual_keyboard);
	display_set_global_handler(virtual_keyboard.display, global_handler);
	display_set_output_configure_handler(virtual_keyboard.display, handle_output_configure);

	display_run(virtual_keyboard.display);

	return 0;
}
Example #26
0
int
main(int argc, char *argv[])
{
	struct display *d;
	int i;

	d = display_create(&argc, &argv, option_entries);
	if (d == NULL) {
		fprintf(stderr, "failed to create display: %m\n");
		return -1;
	}

	for (i = 1; i < argc; i++) {
		struct image *image;

		image = image_create (d, i, argv[i]);
	}

	display_run(d);

	return 0;
}
Example #27
0
File: view.c Project: N8Fear/adwc
int
main(int argc, char *argv[])
{
	struct display *d;
	int i;

	g_type_init();

	argc = parse_options(view_options,
			     ARRAY_LENGTH(view_options), argc, argv);

	d = display_create(argc, argv);
	if (d == NULL) {
		fprintf(stderr, "failed to create display: %m\n");
		return -1;
	}

	for (i = 1; i < argc; i++)
		view_create (d, i, argv[i], option_fullscreen);

	display_run(d);

	return 0;
}
Example #28
0
int
main(int argc, char *argv[])
{
	struct virtual_keyboard virtual_keyboard;
	struct output *output;

	memset(&virtual_keyboard, 0, sizeof virtual_keyboard);

	virtual_keyboard.display = display_create(&argc, argv);
	if (virtual_keyboard.display == NULL) {
		fprintf(stderr, "failed to create display: %m\n");
		return -1;
	}

	display_set_user_data(virtual_keyboard.display, &virtual_keyboard);
	display_set_global_handler(virtual_keyboard.display, global_handler);

	output = display_get_output(virtual_keyboard.display);
	keyboard_create(output, &virtual_keyboard);

	display_run(virtual_keyboard.display);

	return 0;
}
Example #29
0
Display::Display(int* argc, char** argv)
: m_isOwner(true)
{
	m_display = display_create(argc, argv);
	assert(m_display);
}
Example #30
0
int main(int argc, char** argv) {
	int ref = EXIT_SUCCESS;
	srand(OSTimeGet());
	control_init();
	appTimer = timer_create();

	fgl_texture* tempDispTex = fgl_texture_create(320, 240);
	display* appDisplay = display_create(320, 240, 320, (DISPLAY_FILTER_NEAREST | DISPLAY_FORMAT_RGB565), tempDispTex->data, NULL);
	if(appDisplay == NULL)
		return EXIT_FAILURE;

	fgl_draw_buffer_set(tempDispTex);
	fgl_texture* tempRenderTarget = fgl_draw_buffer_get();
	uint16_t* tempDepth = (uint16_t*)malloc(tempRenderTarget->width * tempRenderTarget->height * 2);
	if(tempDepth != NULL)
		fgl_depth_buffer_set(tempDepth);
	fgl_enable(FGL_DEPTH_TEST);

	fgl_matrix_mode_set(FGL_MATRIX_VIEWPORT);
	fgl_matrix_identity();
	fgl_viewport(0, 0, fgl_fix16_from_int(320), fgl_fix16_from_int(240));
	fgl_matrix_mode_set(FGL_MATRIX_PROJECTION);
	fgl_matrix_identity();
	fgl_perspective((fgl_fix16_pi >> 3), fgl_fix16_div(fgl_fix16_from_int(320), fgl_fix16_from_int(240)), fgl_fix16_one, fgl_fix16_from_int(1024));
	fgl_matrix_mode_set(FGL_MATRIX_VIEW);
	fgl_matrix_identity();
	fgl_translate(fgl_fix16_from_int(0), fgl_fix16_from_int(0), fgl_fix16_from_int(10));
	fgl_matrix_mode_set(FGL_MATRIX_MODEL);
	fgl_matrix_identity();

	fgl_scale(fgl_fix16_from_int(2), fgl_fix16_from_int(2), fgl_fix16_from_int(2));

	fgl_texture* tempTexture = fgl_texture_load_tga("earth.tga");
	fgl_texture_bind(tempTexture);
	fgl_enable(FGL_TEXTURE_2D);

	//fgl_enable(FGL_CULL_FACE);

	int sysref;
	while(appRunning) {
		sysref = _sys_judge_event(NULL);
		if(sysref < 0) {
			ref = sysref;
			break;
		}

		// Control
		control_poll();
		if(control_check(CONTROL_BUTTON_START).pressed && control_check(CONTROL_BUTTON_SELECT).pressed)
			appRunning = false;
		else if(control_check(CONTROL_BUTTON_SELECT).pressed && control_check(CONTROL_BUTTON_SELECT).changed)
			appScreenshot();

		if(control_just_pressed(CONTROL_DPAD_UP)) {
			fgl_matrix_mode_set(FGL_MATRIX_VIEW);
			fgl_translate(fgl_fix16_from_int(0), fgl_fix16_from_int(0), fgl_fix16_from_int(-1));
			fgl_matrix_mode_set(FGL_MATRIX_MODEL);
		}
		if(control_just_pressed(CONTROL_DPAD_DOWN)) {
			fgl_matrix_mode_set(FGL_MATRIX_VIEW);
			fgl_translate(fgl_fix16_from_int(0), fgl_fix16_from_int(0), fgl_fix16_from_int(+1));
			fgl_matrix_mode_set(FGL_MATRIX_MODEL);
		}

		// Draw
		fgl_clear(FGL_COLOR_BUFFER_BIT | FGL_DEPTH_BUFFER_BIT);
		fgl_draw_sphere(16);
		fgl_rotate_y(500);
		display_flip(appDisplay);
	}

	fgl_texture_delete(tempTexture);
	if(tempDepth != NULL)
		free(tempDepth);

	timer_delete(appTimer);
	control_term();
	display_delete(appDisplay);
	return EXIT_SUCCESS;
}