]> git.llucax.com Git - z.facultad/75.42/plaqui.git/blob - Client/src/item_tank.cpp
daeb4e7ce9eb585c165b0a24fcb922ee3515c22b
[z.facultad/75.42/plaqui.git] / Client / src / item_tank.cpp
1
2 #include "item_tank.h"
3 #include <sstream>
4
5 ViewTank::ViewTank(Glib::ustring _name, int orientacion):ViewItem(_name)
6 {
7         switch (orientacion) {
8                 case 0:
9                         image.set(PACKAGE_DATA_DIR"/plaqui-client/pixmaps/tanque_e.png");
10                         in_x = 5;
11                         in_y = 16;
12                         out_x = 64-16;
13                         out_y = 64;
14                         offset_x = 0;
15                         offset_y = 0;
16                         item_offset_x = 0;
17                         item_offset_y = 0;
18                 break;
19                 case 1:
20                         image.set(PACKAGE_DATA_DIR"/plaqui-client/pixmaps/tanque_o.png");
21                         in_x = 64-5;
22                         in_y = 16;
23                         out_x = 16;
24                         out_y = 64;
25                         offset_x = 0;
26                         offset_y = 0;
27                         item_offset_x = 0;
28                         item_offset_y = 0;
29         }
30         image.show();
31         set_size_request();
32 }
33
34 ViewTank::~ViewTank()
35 {
36 }
37
38 std::string ViewTank::get_extra()
39 {
40         std::stringstream ss;
41         std::string s;
42         ss << extra;
43         ss >> s;
44         return s;
45 }
46
47 bool ViewTank::on_image_expose_event(GdkEventExpose *e)
48 {
49         Glib::RefPtr<Gdk::Colormap> colormap = Gtk::Widget::get_default_colormap();
50         colormap->alloc_color(color);
51         gc->set_foreground(color);
52         gc->set_background(color);
53         gc->set_line_attributes(6, Gdk::LINE_SOLID, Gdk::CAP_NOT_LAST, Gdk::JOIN_MITER);
54         int w,h;
55         w = image.get_width();
56         h = image.get_height();
57         // TODO : hacer que dibuje arcos en el sentido del codo!
58         if (actual_flow == 0) return true;
59         image.get_window()->draw_arc(gc, 1, w/2-7, h/2-7, 14, 14, 0, 360*64);
60         return true;
61 }