int main(int argc, char *argv[]) { glutInit(&argc, argv); options(argc, argv); if (mapmode) { /* read map data */ readDigitalMap(MAPDIR "nara.map"); readMeshData(MAPDIR "nara.mem"); calcAllAltitude(); } mapwindow = openMapWindow(argv[0]); /* initialize 3D map window */ /* 970904 イベントハンドラの設定 */ glutDisplayFunc(drawScene); glutKeyboardFunc(mapKeyFunc); glutSpecialFunc(mapSpecialFunc); /* 特殊キー用 */ glutMouseFunc(mapMouseFunc); glutMotionFunc(mapMotionFunc); readdata(); /* read guide data */ initGuide(); /* initialize the guide */ initIndex(); /* initialize the index */ initTOC(); /* initialize the TOC */ /* prepare graphics objects */ setPartNVec(&compass); setPartNVec(&pencursor); /* texture */ /* 970904 あとで参考にするかもしれない if (!wiremode && !mapmode && texturemode) { tevdef(1, 0, tevprops[0]); tevbind(TV_ENV0, 1); if ((tid = readTexture(texturename, texturemode - 1)) == 0) { perror("cannot read texture data\n"); exit(0); } texbind(TX_TEXTURE_0, tid); } */ calcLookAtPoint(lookAt, FALSE); glutSetWindow(mapwindow); glutPostRedisplay(); /* main loop */ glutMainLoop(); }
void GameSceneUILayer::controlUIMouse() { MouseInfo mouseInput = GET_INPUT_MANAGER()->getMouseInfo(); if (m_MapWinRect.containsPoint(mouseInput.m_MouseEnd[LEFT_CLICK_POINT])) { if (!m_MapWindowOn) { openMapWindow(); } else if (m_MapWindowOn) { closeMapWindow(); } } if (m_CharWinRect.containsPoint(mouseInput.m_MouseEnd[LEFT_CLICK_POINT])) { if (!m_CharWindowOn) { openCharWindow(); } else if (m_CharWindowOn) { closeCharWindow(); } } if (mouseInput.m_MouseState == MS_RIGHT_UP) { if (m_MenuWindowOn) { closeGameMenu(); } else if (m_MapWindowOn) { closeMapWindow(); } else if (m_CharWindowOn) { closeCharWindow(); } } }
void GameSceneUILayer::controlUIKeyboard() { KeyState mapKey1 = GET_INPUT_MANAGER()->getKeyState(KC_MAP); KeyState mapKey2 = GET_INPUT_MANAGER()->getKeyState(KC_TAB); KeyState escKey = GET_INPUT_MANAGER()->getKeyState(KC_ESC); KeyState charKey = GET_INPUT_MANAGER()->getKeyState(KC_CHARACTER); KeyState enterKey = GET_INPUT_MANAGER()->getKeyState(KC_RETURN); if (escKey == KS_PRESS) { GET_SOUND_MANAGER()->createSound(SoundManager::MENU, false); if (m_MenuWindowOn) { closeGameMenu(); } else { if (m_MapWindowOn) { closeMapWindow(); } else if (m_CharWindowOn) { closeCharWindow(); } else { openGameMenu(); } } } if (mapKey1 == KS_PRESS || mapKey2 == KS_PRESS) { GET_SOUND_MANAGER()->createSound(SoundManager::MENU, false); if (!m_MenuWindowOn) { if (m_MapWindowOn) { closeMapWindow(); } else { openMapWindow(); } } } if (charKey == KS_PRESS) { GET_SOUND_MANAGER()->createSound(SoundManager::MENU, false); if (!m_MenuWindowOn) { if (m_CharWindowOn) { closeCharWindow(); } else { openCharWindow(); } } } }