Esempio n. 1
0
void init(int argc, char *argv[])
{
	// test load CAP
	if (argc > 1) t2ground = load_cap(argv[1]);
	else t2ground = load_cap("parks/grd.PRK");

	// set camera
	camera_new(camera, 32.0f, 10.0f, 32.0f);

	// load the textures
	load_texture(ground, "textures/ground.png");
	load_texture(side, "textures/side.png");
	load_texture(font, "textures/font.png");
}
Esempio n. 2
0
int main()
{
  fprintf(stderr, "%s\n", "testing camera_new");
  camera *c1 = camera_new(vec_new(0.0, 0.0, 1.0), 10, 10);
  camera_print(c1);
  fprintf(stderr, "%s\n", "testing camera_dup");
  camera *c2 = camera_dup(c1);
  camera_free(c1);
  camera_print(c2);
  c1 = camera_dup(c2);
  fprintf(stderr, "%s\n", "VALGRIND TESTING");
  camera_free(c1);
  camera_free(c2);

}
Esempio n. 3
0
/* camera_init */
static CameraWidget * _camera_init(char const * name)
{
	CameraWidget * camera;
	(void) name;

	if((camera = object_new(sizeof(*camera))) == NULL)
		return NULL;
	camera->window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
	gtk_widget_realize(camera->window);
	if((camera->camera = camera_new(camera->window, NULL, NULL)) == NULL)
	{
		_camera_destroy(camera);
		return NULL;
	}
	return camera;
}
Esempio n. 4
0
void seal_init_graphics() {
    // baisc graphic modules
    GAME->texture_cache = texture_cache_new();
    GAME->sprite_frame_cache = sprite_frame_cache_new();
    GAME->bmfont_cache = bmfont_cache_new();
    GAME->global_camera = camera_new(GAME->config.window_height, GAME->config.window_height);
    GAME->render = render_new();
    GAME->nuk_node = nuk_node_new();
    GAME->lua_handler = lua_handler_new(GAME->lstate);
    
    sprite_init_render(GAME->render);
    nuk_node_ctx_init();
    
    // init the font
    ttf_init_module();
    font = ttf_font_new("res/fonts/SourceCodePro-Regular.ttf", 32);  //TODO: load this in Lua.
    GAME->font = font;
    
    // the bootloader
    seal_load_file("scripts/bootloader.lua");
    seal_load_string("main()");
}
Esempio n. 5
0
void xml_parse_waypoint(const gchar **names, const gchar **values)
{
gint i;
struct camera_pak *camera;

g_assert(xml_model != NULL);

camera = camera_new();

i=0;
while (*(names+i))
  {
  if (g_ascii_strncasecmp(*(names+i), "mode", 4) == 0)
    camera->mode = str_to_float(*(values+i));
  if (g_ascii_strncasecmp(*(names+i), "perspective", 11) == 0)
    camera->perspective = str_to_float(*(values+i));
  if (g_ascii_strncasecmp(*(names+i), "fov", 3) == 0)
    camera->fov = str_to_float(*(values+i));
  if (g_ascii_strncasecmp(*(names+i), "zoom", 4) == 0)
    camera->zoom = str_to_float(*(values+i));

  if (g_ascii_strncasecmp(*(names+i), "x0", 2) == 0)
    camera->x[0] = str_to_float(*(values+i));
  if (g_ascii_strncasecmp(*(names+i), "x1", 2) == 0)
    camera->x[1] = str_to_float(*(values+i));
  if (g_ascii_strncasecmp(*(names+i), "x2", 2) == 0)
    camera->x[2] = str_to_float(*(values+i));

  if (g_ascii_strncasecmp(*(names+i), "o0", 2) == 0)
    camera->o[0] = str_to_float(*(values+i));
  if (g_ascii_strncasecmp(*(names+i), "o1", 2) == 0)
    camera->o[1] = str_to_float(*(values+i));
  if (g_ascii_strncasecmp(*(names+i), "o2", 2) == 0)
    camera->o[2] = str_to_float(*(values+i));

  if (g_ascii_strncasecmp(*(names+i), "v0", 2) == 0)
    camera->v[0] = str_to_float(*(values+i));
  if (g_ascii_strncasecmp(*(names+i), "v1", 2) == 0)
    camera->v[1] = str_to_float(*(values+i));
  if (g_ascii_strncasecmp(*(names+i), "v2", 2) == 0)
    camera->v[2] = str_to_float(*(values+i));

  if (g_ascii_strncasecmp(*(names+i), "e0", 2) == 0)
    camera->e[0] = str_to_float(*(values+i));
  if (g_ascii_strncasecmp(*(names+i), "e1", 2) == 0)
    camera->e[1] = str_to_float(*(values+i));
  if (g_ascii_strncasecmp(*(names+i), "e2", 2) == 0)
    camera->e[2] = str_to_float(*(values+i));

  if (g_ascii_strncasecmp(*(names+i), "q0", 2) == 0)
    camera->q[0] = str_to_float(*(values+i));
  if (g_ascii_strncasecmp(*(names+i), "q1", 2) == 0)
    camera->q[1] = str_to_float(*(values+i));
  if (g_ascii_strncasecmp(*(names+i), "q2", 2) == 0)
    camera->q[2] = str_to_float(*(values+i));
  if (g_ascii_strncasecmp(*(names+i), "q3", 2) == 0)
    camera->q[3] = str_to_float(*(values+i));

  i++;
  }
xml_model->waypoint_list = g_slist_prepend(xml_model->waypoint_list, camera);
}
Esempio n. 6
0
static void
view_init (View *view)
{
  view->lights = NULL;
  view->camera = camera_new ();
}