/* ------------------------------------------- ・Draw() : 描画処理処理関数 描画はスプライトを使用 -------------------------------------------- */ void CSceneTitle::Draw() { /* ----- 各表示矩形を設定 ----- */ RECT bg_rc = {0, 0, 640, 480}, logo_rc = {0, 0, 360, 240}, cirno_rc = {0, 0, 424, 424}, start_rc = {0, 0, 136, 48}, option_rc = {0, 0, 136, 48}, end_rc = {0, 0, 136, 48}, cursor_rc = {0, 0, 64, 64}; /* ----- 各表示位置を設定 ----- */ D3DXVECTOR3 center(0, 0, 0); D3DXVECTOR3 bg_pos(0, 0, 0), logo_pos(10, 50, 0), cirno_pos(216, 56, 0), start_pos(107, 294, 0), option_pos(107, 344, 0), end_pos(107, 394, 0), cursor_pos((float)m_Cursor.x, (float)m_Cursor.y, 0); CDxGraphic::m_pD3DXSprite->Begin( D3DXSPRITE_ALPHABLEND ); CDxGraphic::m_pD3DXSprite->Draw( CTextureManager::GetTexture(_T("img\\Title_BG.png")), &bg_rc, ¢er, &bg_pos, 0xFFFFFFFF ); // タイトル背景 CDxGraphic::m_pD3DXSprite->Draw( CTextureManager::GetTexture(_T("img\\Title_Cirno.dds")), &cirno_rc, ¢er, &cirno_pos, 0xFFFFFFFF ); // チルノ CDxGraphic::m_pD3DXSprite->Draw( CTextureManager::GetTexture(_T("img\\Title_Logo.dds")), &logo_rc, ¢er, &logo_pos, 0xFFFFFFFF ); // タイトルロゴ CDxGraphic::m_pD3DXSprite->Draw( CTextureManager::GetTexture(_T("img\\Title_StartPanel.dds")), &start_rc, ¢er, &start_pos, 0xFFFFFFFF ); // すたーとパネル CDxGraphic::m_pD3DXSprite->Draw( CTextureManager::GetTexture(_T("img\\Title_OptionPanel.dds")), &option_rc, ¢er, &option_pos, 0xFFFFFFFF ); // おぷしょんパネル CDxGraphic::m_pD3DXSprite->Draw( CTextureManager::GetTexture(_T("img\\Title_EndPanel.dds")), &end_rc, ¢er, &end_pos, 0xFFFFFFFF ); // おわるパネル CDxGraphic::m_pD3DXSprite->Draw( CTextureManager::GetTexture(_T("img\\Snow_S.dds")), &cursor_rc, ¢er, &cursor_pos, 0xFFFFFFFF ); // 雪カーソル CDxGraphic::m_pD3DXSprite->End(); }
bool Slider::CursorOnSlideIcon (const Point& cursor) { bool ret = false; glm::vec2 icon_center; // slide switch center position int radius = 0; if (orientation() == Horizontal) { radius = slide_icon_.size().width() / 2; icon_center.x = radius + get_slider_position(); icon_center.y = size().height() / 2; } else { radius = slide_icon_.size().height() / 2; icon_center.x = size().width() / 2; icon_center.y = radius + get_slider_position(); } glm::vec2 cursor_pos(cursor.x(), cursor.y()); float distance = glm::distance(icon_center, cursor_pos); if (orientation() == Horizontal && distance <= radius) { ret = true; } else if (orientation() == Vertical && distance <= radius) { ret = true; } else { ret = false; } return ret; }
/* ThingDirCanvas::onMouseEvent * Called when a mouse event happens in the canvas *******************************************************************/ void ThingDirCanvas::onMouseEvent(wxMouseEvent& e) { // Motion if (e.Moving()) { if (theApp->runTimer() > last_check + 15) { // Get cursor position in canvas coordinates double x = -1.2 + ((double)e.GetX() / (double)GetSize().x) * 2.4; double y = -1.2 + ((double)e.GetY() / (double)GetSize().y) * 2.4; fpoint2_t cursor_pos(x, y); // Find closest dir point to cursor point_hl = -1; double min_dist = 0.3; for (unsigned a = 0; a < dir_points.size(); a++) { double dist = MathStuff::distance(cursor_pos, dir_points[a]); if (dist < min_dist) { point_hl = a; min_dist = dist; } } last_check = theApp->runTimer(); } } // Leaving else if (e.Leaving()) point_hl = -1; // Left click else if (e.LeftDown()) { if (point_hl >= 0) { point_sel = point_hl; switch (point_sel) { case 6: angle = 0; break; case 7: angle = 45; break; case 0: angle = 90; break; case 1: angle = 135; break; case 2: angle = 180; break; case 3: angle = 225; break; case 4: angle = 270; break; case 5: angle = 315; break; default: angle = 0; break; } } } e.Skip(); }
void display(t_all *g_all) { int i; i = 0; if (too_big(g_all, g_all->sel)) my_putstr("Please increase your window's size", g_all->sel->ttyfd); else { g_all->dis->pos_column = 0; g_all->dis->biggest = 0; g_all->dis->line = -1; while (i < g_all->sel->max_elem) { if (g_all->sel->state[i] != 4) { cursor_pos(g_all->sel, g_all->dis, i); activate_ent(g_all->sel->state[i], g_all->sel); my_putstr(g_all->sel->arg[i], g_all->sel->ttyfd); } i += 1; } } }