Giraffe verfolgt Spieler.
[hackover2013-badge-firmware.git] / mock / mock / lcd-window.hh
1 #ifndef INCLUDED_BADGE2013_MOCKUP_LCD_WINDOW_HH
2 #define INCLUDED_BADGE2013_MOCKUP_LCD_WINDOW_HH
3
4 #include "badge_worker.hh"
5 #include <ui/display.h>
6
7 #include <glibmm/dispatcher.h>
8 #include <glibmm/thread.h>
9
10 #include <gtkmm/builder.h>
11 #include <gtkmm/dialog.h>
12 #include <gtkmm/drawingarea.h>
13 #include <gtkmm/window.h>
14
15 #include <cstdint>
16 #include <memory>
17
18 namespace badge2013 {
19 class lcd_drawingarea : public Gtk::DrawingArea {
20 public:
21 lcd_drawingarea(BaseObjectType *cobject,
22 Glib::RefPtr<Gtk::Builder> const &glade);
23 virtual ~lcd_drawingarea();
24
25 void push_framebuffer(badge_framebuffer const &fb);
26
27 protected:
28 virtual bool on_draw(Cairo::RefPtr<Cairo::Context> const &cr);
29
30 private:
31 void force_redraw();
32
33 Glib::Dispatcher sig_redraw_;
34 badge_framebuffer framebuffer_;
35 };
36
37
38 class lcd_window : public Gtk::Window {
39 public:
40 lcd_window(BaseObjectType *cobject, Glib::RefPtr<Gtk::Builder> const &glade);
41 virtual ~lcd_window();
42
43 void push_framebuffer(badge_framebuffer const &fb);
44 void request_close();
45
46 protected:
47 virtual void on_show();
48 virtual bool on_key_press_event (GdkEventKey* event);
49 virtual bool on_key_release_event(GdkEventKey* event);
50
51 private:
52 bool on_game_tick();
53
54 bool running_ = false;
55 Glib::Dispatcher sig_close_;
56 badge_worker worker_;
57 lcd_drawingarea *canvas_ = 0;
58 std::uint8_t key_state_ = 0;
59 std::uint8_t ticks_ = 0;
60 };
61 }
62
63 #endif
This page took 0.041438 seconds and 5 git commands to generate.