src/Player.cc
changeset 315 fe9da2d5355e
parent 313 2562466a946d
child 322 f94a5c192097
equal deleted inserted replaced
314:7276e43d19c3 315:fe9da2d5355e
   383                 g->get_gc()
   383                 g->get_gc()
   384         );
   384         );
   385     }
   385     }
   386 }
   386 }
   387 
   387 
   388 void LocalPlayer::draw_player_info(Graphics *g) {
       
   389     CL_GraphicContext *gc = g->get_gc();
       
   390     
       
   391     int box_top = GRAPHICS_RESOLUTION_HEIGHT - 100;
       
   392     int box_left = 0;
       
   393     int box_right = GRAPHICS_RESOLUTION_WIDTH;
       
   394     int box_bottom = GRAPHICS_RESOLUTION_HEIGHT;
       
   395     int life_bar_length = 3; // *100
       
   396     
       
   397     // draw status info at bottom of display
       
   398     gc->fill_rect(
       
   399         CL_Rect(
       
   400             box_left, 
       
   401             box_top, 
       
   402             box_right, 
       
   403             box_bottom
       
   404         ),
       
   405         CL_Gradient(
       
   406             CL_Color(123, 43, 1, 10),
       
   407             CL_Color(22, 234, 111, 100),
       
   408             CL_Color(1, 231, 222, 200),
       
   409             CL_Color(190, 23, 240, 150)
       
   410         )
       
   411     );
       
   412 
       
   413     gc->draw_rect(
       
   414         CL_Rect(
       
   415             box_left + 9,
       
   416             box_top + 9,
       
   417             box_left + 11 + 100 * life_bar_length,
       
   418             box_top + 31
       
   419         ),
       
   420         CL_Color(190, 23, 20)
       
   421     );
       
   422 
       
   423     gc->fill_rect(
       
   424         CL_Rect(
       
   425             box_left + 10,
       
   426             box_top + 10,
       
   427             box_left + 10 + (int) (getHealthPercent() * life_bar_length),
       
   428             box_top + 30
       
   429         ),
       
   430         CL_Gradient(
       
   431             CL_Color(23, 143, 1),
       
   432             CL_Color(222, 34, 111),
       
   433             CL_Color(122, 231, 222),
       
   434             CL_Color(19, 23, 240)
       
   435         )
       
   436     );
       
   437 }