tui::LayoutCanvas::LayoutCanvas(wxWindow *parent, const wxPoint& pos, 
     const wxSize& size, int* attribList): 
 wxGLCanvas(parent, ID_TPD_CANVAS, pos, size, 0,wxT("LayoutCanvas"), attribList)
{
//   if (!wxGLCanvas::IsDisplaySupported(attribList)) return;
#ifdef __WXGTK__
   //  Here we'll have to check that we've got what we've asked for. It is
   // quite possible that we can't get the requested GL visual. If that is the case
   // we'll have to aboandon the init sequence right here, otherwise Toped will
   // crash.
   x_visual = (XVisualInfo*) m_vi;
   if (NULL == x_visual) return;
#endif
   crossCur = MakeCursor(crosscursor,16, 16);
   //crossCur = DEBUG_NEW wxCursor((const char*)crosscursor,16, 16);
   SetCursor(*crossCur);
   tmp_wnd = false;
   mouse_input = false;
   rubber_band = false;
   restricted_move = false;
   invalid_window = false;
   reperX = reperY = long_cursor = false;
   initializeGL();
   ap_trigger = 10;
   glfInit();
}
Exemple #2
0
bool UILayer::init()
{
    if (!Layer::init())
        return false;

    auto winSize = Director::getInstance()->getWinSize();

    auto menuItem = MenuItemImage::create(
        "Images/Interface/Exit.png",
        "Images/Interface/Exit_selected.png",
        CC_CALLBACK_1(UILayer::ClickExit, this));
    menuItem->setScale(0.3f, 0.3f);

    auto menu = Menu::create(menuItem, NULL);
    menu->setPosition(winSize.width - 40, 12);
    this->addChild(menu);

    auto hpLabel = Label::createWithSystemFont("\0", DEF_FONT, 23);
    hpLabel->setPosition(Vec2(MAX_MAP_SIZE_X / 2, 143));
    this->addChild(hpLabel, 11, HP_LABEL);

    this->addChild(MakeSprite("Images/Interface/interface.png",         Vec2(MAX_MAP_SIZE_X / 2, 100),          Vec2(1.1f, 1.1f),   Vec2(0.5, 0.5)));
    this->addChild(MakeSprite("Images/Interface/HpBar_interface.png",   Vec2(MAX_MAP_SIZE_X / 2 - 204, 141),    Vec2(0.72f, 1.1f),  Vec2(0.0, 0.5)),    10, HP_BAR);

    this->addChild(MakeCooltimeBox(SKILL_Q, Vec2(MAX_MAP_SIZE_X / 2 - 150, 48)));
    this->addChild(MakeCooltimeBox(SKILL_W, Vec2(MAX_MAP_SIZE_X / 2 - 70, 48)));
    this->addChild(MakeCooltimeBox(SKILL_E, Vec2(MAX_MAP_SIZE_X / 2 + 13, 48)));
    this->addChild(MakeCooltimeBox(SKILL_R, Vec2(MAX_MAP_SIZE_X / 2 + 92, 48)));
    
    m_Cursor = MakeCursor(CURSOR_DEFAULT, "Images/Cursor/cursor_default.png", Vec2(1, 1), Vec2(0, 1));
    m_Cursor->setVisible(true);
    this->addChild(m_Cursor, 10);
    this->addChild(MakeCursor(CURSOR_ATTACK, "Images/Cursor/cursor_attack.png",     Vec2(1, 1),         Vec2(0, 1)),        10);
    this->addChild(MakeCursor(CURSOR_TELEPORT, "Images/Cursor/cursor_teleport.png", Vec2(0.2f, 0.08f),  Vec2(0.5f, 0.5f)),  10);
    this->addChild(MakeCursor(CURSOR_SPLASH, "Images/Cursor/cursor_splash.png",     Vec2(1.5f, 1.5f),   Vec2(0.5f, 0.5f)),  10);
    return true;
}
tui::LayoutCanvas::LayoutCanvas(wxWindow *parent, int* attribList): wxGLCanvas(parent,
   ID_TPD_CANVAS, wxDefaultPosition, wxDefaultSize, 0,wxT("LayoutCanvas"), attribList){

   crossCur = MakeCursor(crosscursor,16, 16);
   //crossCur = new wxCursor((const char*)crosscursor,16, 16);
   SetCursor(*crossCur);
   tmp_wnd = false;
   mouse_input = false;
   rubber_band = false;
   restricted_move = false;
   invalid_window = false;
   initializeGL();
   wxCommandEvent eventZOOM(wxEVT_CANVAS_ZOOM);
   eventZOOM.SetInt(ZOOM_EMPTY);
   OnZoom(eventZOOM);
   ap_trigger = 10;
}