1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
|
#include "AppHdr.h"
#ifdef USE_TILE_LOCAL
#include "tilereg-stat.h"
#include "command.h"
#include "libutil.h"
#include "macro.h"
#include "tiles-build-specific.h"
StatRegion::StatRegion(FontWrapper *font_arg) : TextRegion(font_arg)
{
}
int StatRegion::handle_mouse(wm_mouse_event &event)
{
if (mouse_control::current_mode() != MOUSE_MODE_COMMAND)
return 0;
if (!inside(event.px, event.py))
return 0;
if (event.event != wm_mouse_event::PRESS || event.button != wm_mouse_event::LEFT)
return 0;
#ifdef __ANDROID__
if (tiles.is_using_small_layout())
return command_to_key(CMD_TOGGLE_TAB_ICONS);
#endif
// clicking on stats should show all the stats
return encode_command_as_key(CMD_RESISTS_SCREEN);
}
bool StatRegion::update_tip_text(string& tip)
{
if (mouse_control::current_mode() != MOUSE_MODE_COMMAND)
return false;
#ifdef __ANDROID__
if (tiles.is_using_small_layout())
{
tip = "[L-Click] Toggle tab icons";
return true;
}
#endif
tip = "[L-Click] Show player information";
return true;
}
void StatRegion::_clear_buffers()
{
m_shape_buf.clear();
}
void StatRegion::render()
{
if (tiles.is_using_small_layout())
{
_clear_buffers();
// black-out part of screen that stats are written on to
// - double up area to cover behind where tabs are drawn
m_shape_buf.add(sx,sy,ex+(ex-sx),ey,VColour(0,0,0,255));
m_shape_buf.draw();
}
TextRegion::render();
}
void StatRegion::clear()
{
_clear_buffers();
TextRegion::clear();
}
#endif
|