A..20 19_Hinode_Tuki_2.c

19_Hinode_Tuki_2.c

   1 #include<stdio.h>
   2 #include<glsc3d_3.h>
   3 #define WINDOW_SIZE_X     (800)
   4 #define WINDOW_SIZE_Y     (400)
   5 int main()
   6 {
   7     g_init("Hinode_Tuki", WINDOW_SIZE_X, WINDOW_SIZE_Y);
   8     g_def_scale_2D(0, -4, 4, -2, 2,
   9                    0.0, 0.0,
  10                    WINDOW_SIZE_X, WINDOW_SIZE_Y);
  11 
  12     g_capture_set("");
  13     double dt = 0.005, t,tmax = 5;
  14 
  15     for (int i_time = 0;; i_time++)
  16     {
  17         t = i_time * dt;
  18         g_cls();
  19         g_sel_scale(0);
  20         g_boundary();
  21 
  22         //Sora
  23         g_area_color(0.6, 0.6, 0.6, 1);
  24         g_box_2D(-4,4,-0.5,2,G_NO,G_YES);
  25 
  26         //Tuki
  27         g_area_color(1, 1, 0, 1);
  28         g_circle_2D(2.0, 1.0, 0.2, G_NO, G_YES);
  29         g_area_color(0.6, 0.6, 0.6, 1);
  30         g_circle_2D(1.8, 1.0, 0.2, G_NO, G_YES);
  31 
  32         //Taiyo
  33         g_area_color(1, 0, 0, 1);
  34         g_circle_2D(0.0, tanh(t) - 1, 0.5, G_NO, G_YES);
  35 
  36         //Umi
  37         g_area_color(0.2, 0.6, 1, 1);
  38         g_box_2D(-4,4,-2,-0.5,G_NO,G_YES);
  39 
  40         //Moji
  41         if(t > tmax)
  42         {
  43             g_text_standard(350, 100, "日本一!!");
  44         }
  45 
  46         g_finish();
  47         g_capture();
  48     }
  49     return 0;
  50 }



桂田 祐史