Esempio n. 1
0
void DrawColor(KI col)
{
#ifdef WIN
  HPEN hpenT;
#endif
#ifdef MACG
  RGBColor kv;
#endif

  if (gi.fFile) {
#ifdef PS
    if (gs.fPS) {
      if (gi.kiCur != col) {
        PsStrokeForce();      /* Render existing path with current color */
        fprintf(gi.file, "%.2f %.2f %.2f c\n",
          (real)RGBR(rgbbmp[col])/255.0, (real)RGBG(rgbbmp[col])/255.0,
          (real)RGBB(rgbbmp[col])/255.0);
      }
    }
#endif
#ifdef META
    if (gs.fMeta)
      gi.kiLineDes = col;
#endif
  }
#ifdef X11
  else
    XSetForeground(gi.disp, gi.gc, rgbind[col]);
#endif
#ifdef WIN
  else {
    if (gi.kiCur != col) {
Esempio n. 2
0
void game_mesh::draw_box(void)
{
  BOX *p_box = object_box_get();
  if(p_box) {
    mesh_material::set_default();
    p_box->draw(NULL,RGBB(0,255,0));
  }
}
Esempio n. 3
0
void graph3d::mouse_cursor_draw(void)
{
  GPIPE *p_gpipe = gpipe_get();
  
  int sx, sy, max_x, max_y;  
  p_gpipe->view_get(&sx, &sy, &max_x, &max_y);
  
  int mx, my;
  SDL_GetMouseState(&mx,&my);
  
  mesh_material::set_default();
  
  switch(mouse_cursor_type) {
    case MOUSE_CURSOR_NORMAL:
      draw_cursor_normal(mx-sx, my-sy, 0, 0, max_x, max_y);
      break;
    case MOUSE_CURSOR_RECTANGLE_SELECT:
      draw_cursor_rect_select(mx-sx, my-sx, RGBB(255,0,0));
      break;
    case MOUSE_CURSOR_RECTANGLE_SELECTING:
      draw_cursor_normal(mx-sx, my-sy, 0, 0, max_x, max_y, RGBB(255,0,0));
      break;
    case MOUSE_CURSOR_SCENE_MOVE:
      draw_cursor_rect_select(mx-sx, my-sx, RGBB(0,255,0));
      break;
    case MOUSE_CURSOR_SCENE_MOVING:
      //draw_cursor_normal(mx-sx, my-sy, 0, 0, max_x, max_y, RGBB(0,255,0));
      draw_cursor_rect_select(mx-sx, my-sx, RGBB(0,255,0));
      break;
    case MOUSE_CURSOR_SCENE_ROTATE:
      draw_cursor_rect_select(mx-sx, my-sx, RGBB(255,255,0));
      break;
    case MOUSE_CURSOR_SCENE_ROTATING:
      //draw_cursor_normal(mx-sx, my-sy, 0, 0, max_x, max_y, RGBB(255,255,0));
      draw_cursor_rect_select(mx-sx, my-sx, RGBB(255,255,0));
      break;
    default:
      draw_cursor_normal(mx-sx, my-sy, 0, 0, max_x, max_y);
      break;
  }
}
Esempio n. 4
0
AGE_MAIN * initialize(void)
{
  AGE_MAIN *p_age = new AGE_MAIN;
  
  GRAPH3D *p_grf = p_age->graph_sdl_set(1024, 768);
  
  SCENE *p_scene = p_age->scene_new();
  p_scene->render_state_set(TRUE);

  //log_open("/home/komat/b1log.txt");
  
  //GAME_MESH *p_mesh = p_scene->mesh_new();
  //MESH_MATERIAL *p_mat = p_scene->material_new();
  
  // TODO -> material_load() ->
  
  // TODO
  // Loading mesh / mesh list
  // Set material list for meshes during loading
  
  //p_scene->load(NULL, "/home/komat/Projekty/Graph/test.b2m");
  //p_scene->load(NULL, "/home/komat/Projekty/Graph/Scenes/level1.bpr");
  //p_scene->load(NULL, "/home/komat/Projekty/test.3ds",SCENE_3DS);
  //p_scene->load(NULL, "/home/komat/Projekty/komat.3ds",SCENE_3DS);
  //p_scene->load(NULL, "/home/komat/Projekty/redshit.3ds",SCENE_3DS);
  //p_scene->load(NULL, "/home/komat/Projekty/test.b2m");
  //p_scene->load(NULL, "/home/komat/Projekty/auto.b2m");
  //p_scene->save(NULL, "/home/komat/Projekty/auto-1.b2m");
  //p_scene->load(NULL, "/home/komat/Projekty/auto-1.b2m");
  //p_scene->load(NULL, "/home/komat/tmp310/apollo13.3ds",SCENE_3DS);
  //p_scene->texture_dir_add("/home/komat/Projekty/Graph/Textures");
  //p_scene->texture_reload();
    
  CAMERA_POLAR *p_camera = (CAMERA_POLAR *)camera_control_get(p_age);
  p_scene->camera_active_set(p_camera);
  
  /*
  GAME_MESH *p_mesh = p_scene->mesh_get("bedna8.b2m");
  p_mesh->translate_set(0.0f,0.0f,5.0f);
  */
 
  p_age->callback_set(callback);

  INPUT *p_input = p_age->input_get();
  
  static INPUT_EVENT events[] = 
  {
    INPUT_EVENT(KEY_STATE(K_M), (INPUT_EVENT_FUNC)scene_move),
    INPUT_EVENT(KEY_STATE(K_R), (INPUT_EVENT_FUNC)scene_rotate),
    INPUT_EVENT(KEY_STATE(K_R), (INPUT_EVENT_FUNC)scene_reset),
    INPUT_EVENT(KEY_STATE(K_A), (INPUT_EVENT_FUNC)scene_test)
  };
  
  p_input->events_add(events, sizeof(events)/sizeof(events[0]));
  
  p_grf->config_draw_grid(FALSE);
  p_grf->config_draw_mouse_cursor(TRUE);
  //p_grf->config_draw_boxes(TRUE);
  p_grf->config_draw_console(TRUE);
  p_grf->config_draw_wired(TRUE);
  //p_grf->config_normals_draw(TRUE);
  //p_grf->config_opengl_lighting(TRUE);
  p_grf->config_draw_all_objects(TRUE);
  p_grf->config_draw_pivots(TRUE);
  
  p_grf->console_font_color_set(RGBB(0,0xff,0));
  p_grf->console_origin_set(0,10);
  p_grf->console_print("Zdar ty jelito 1!");
  p_grf->console_print("Zdar ty jelito 2!");
  p_grf->console_print("Zdar ty jelito 3!");
    
  
  return(p_age);
}