void AnimationMainMenu::OnInitDialog() { // position the GUI to the left side of the screen SetPosition(Vision::Video.GetXRes() - GetSize().x,0); SetSize(GetSize().x, (float)Vision::Video.GetYRes()); // find the entities in the scene for (int i = 0; i < ENTITY_COUNT; i++) { char szKey[64]; sprintf(szKey, "Soldier_%i", i); m_pSoldiers[i] = Vision::Game.SearchEntity(szKey); VASSERT(m_pSoldiers[i]); } // sub menus m_pSubMenu = static_cast<VDialogSubCtrl*>(Items().FindItem(VGUIManager::GetID("SUBMENU"))); m_spSubMenuDialog = GetMenuManager()->CreateDialogInstance("CharacterLOD\\Dialogs\\SubMenu.xml", GetContext(), this); VASSERT(m_pSubMenu && m_spSubMenuDialog); // skeletal anim m_pLODSelectionList = static_cast<VListControl*>(m_spSubMenuDialog->Items().FindItem(VGUIManager::GetID("LOD_SELECTION"))); m_pCheckBoxStopPlay = static_cast<VCheckBox*>(m_spSubMenuDialog->Items().FindItem(VGUIManager::GetID("STOP_PLAY"))); VASSERT(m_pLODSelectionList && m_pCheckBoxStopPlay); // fill the list control (put the enum in the data member): VListControlItem *pItem; ADD_MODE(VLOD_HIGH, "High Quality", "Use characters with high polygon count"); ADD_MODE(VLOD_MEDIUM, "Medium Quality", "Use characters with medium polygon count"); ADD_MODE(VLOD_LOW, "Low Quality", "Use characters with low polygon count"); ADD_MODE(VLOD_ULTRALOW, "UltraLow Quality", "Use characters with ultra low polygon count"); ADD_MODE(VLOD_AUTO, "Use AutoLOD", "Choose LOD-Level by distance"); m_pSubMenu->SetDialog(m_spSubMenuDialog); // set the initial mode SetLODLevel(VLOD_AUTO); }
void AnimationMainMenu::OnInitDialog() { // position the GUI to the right side of the screen SetPosition(Vision::Video.GetXRes() - GetSize().x,0); SetSize(GetSize().x, (float)Vision::Video.GetYRes()); // find the entities in the scene m_pSkeletalCharacter = (SimpleSkeletalAnimatedObject_cl *)Vision::Game.SearchEntity("SkeletalAnimEntity"); m_pVertexAnimCharacter = (SimpleVertexAnimatedObject_cl *)Vision::Game.SearchEntity("VertexAnimEntity"); VASSERT(m_pSkeletalCharacter && m_pVertexAnimCharacter); // sub menues m_pSubMenu = (VDialogSubCtrl *)Items().FindItem(VGUIManager::GetID("SUBMENU")); m_spSubMenu_Skeletal = GetMenuManager()->CreateDialogInstance("BasicAnimation\\SubMenu_Skeletal.xml", GetContext(), this); m_spSubMenu_Vertex = GetMenuManager()->CreateDialogInstance("BasicAnimation\\SubMenu_Vertex.xml", GetContext(), this); VASSERT(m_pSubMenu && m_spSubMenu_Skeletal && m_spSubMenu_Vertex); m_pCheckBoxSkeletalAnim = (VCheckBox *)Items().FindItem(VGUIManager::GetID("SKELETALANIM")); m_pCheckBoxVertexAnim = (VCheckBox *)Items().FindItem(VGUIManager::GetID("VERTEXANIM")); VASSERT(m_pCheckBoxSkeletalAnim); VASSERT(m_pCheckBoxVertexAnim); m_pCheckBoxSkeletalAnim->SetChecked(true); // vertex anim m_pCheckBoxPlayVertexAnim = (VCheckBox *)m_spSubMenu_Vertex->Items().FindItem(VGUIManager::GetID("PLAY_VERTEXANIM")); VASSERT(m_pCheckBoxPlayVertexAnim); // skeletal anim m_pSkeletalModeList = (VListControl *)m_spSubMenu_Skeletal->Items().FindItem(VGUIManager::GetID("SKELETAL_MODE")); VASSERT(m_pSkeletalModeList); VListControlItem *pItem; // fill the list control (put the enum in the data member): ADD_MODE(MODE_SINGLEANIM, "Single animation", "Plays a single animation"); ADD_MODE(MODE_BLENDTWOANIMS, "Blend two animations", "Blends two animations"); ADD_MODE(MODE_LISTENTOEVENTS, "Listen to events", "Demonstrates event callbacks"); ADD_MODE(MODE_SETANIMATIONTIME, "Set animation time", "Shows manual animation time setting"); ADD_MODE(MODE_LAYERTWOANIMATIONS,"Layer two animations","Layers one animation on top of the other"); ADD_MODE(MODE_FORWARDKINEMATICS,"Forward kinematics", "Inserts a bone modifier node\ninto the animation tree"); ADD_MODE(MODE_LOOKAT, "Look-at", "Uses forward kinematics for simple lookat"); // skeletal mode specific: m_pCheckBoxSkelPlay = (VCheckBox *)m_spSubMenu_Skeletal->Items().FindItem(VGUIManager::GetID("SKEL_PLAYANIM")); m_pCheckBoxSkelBlend = (VCheckBox *)m_spSubMenu_Skeletal->Items().FindItem(VGUIManager::GetID("SKEL_BLEND_TOGGLE")); m_pSliderSetAnimTime = (VSliderControl *)m_spSubMenu_Skeletal->Items().FindItem(VGUIManager::GetID("SKEL_ANIM_TIME")); m_pSetAnimTimeLabel = (VTextLabel *)m_spSubMenu_Skeletal->Items().FindItem(VGUIManager::GetID("SKEL_ANIM_TIME_LABEL")); m_pSliderFKinYaw = (VSliderControl *)m_spSubMenu_Skeletal->Items().FindItem(VGUIManager::GetID("SKEL_FKIN_YAW")); m_pFKinLabel = (VTextLabel *)m_spSubMenu_Skeletal->Items().FindItem(VGUIManager::GetID("SKEL_FKIN_LABEL")); m_pSliderLayered = (VSliderControl *)m_spSubMenu_Skeletal->Items().FindItem(VGUIManager::GetID("SKEL_LAYERANIMS")); m_pLayeredLabel = (VTextLabel *)m_spSubMenu_Skeletal->Items().FindItem(VGUIManager::GetID("SKEL_LAYERANIMS_LABEL")); VASSERT(m_pCheckBoxSkelPlay); VASSERT(m_pCheckBoxSkelBlend); VASSERT(m_pSliderSetAnimTime); VASSERT(m_pSetAnimTimeLabel); VASSERT(m_pSliderFKinYaw); VASSERT(m_pFKinLabel); VASSERT(m_pSliderLayered); VASSERT(m_pLayeredLabel); // set the initial mode SetSkeletalMode(SimpleSkeletalAnimatedObject_cl::MODE_SINGLEANIM); }
bool SDLWindow::initializeFramework() { arx_assert_msg(mainWindow == NULL, "SDL only supports one window"); arx_assert(displayModes.empty()); const char * headerVersion = ARX_STR(SDL_MAJOR_VERSION) "." ARX_STR(SDL_MINOR_VERSION) "." ARX_STR(SDL_PATCHLEVEL); CrashHandler::setVariable("SDL version (headers)", headerVersion); if(SDL_Init(SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE) < 0) { LogError << "Failed to initialize SDL: " << SDL_GetError(); return false; } const SDL_version * ver = SDL_Linked_Version(); std::ostringstream runtimeVersion; runtimeVersion << int(ver->major) << '.' << int(ver->minor) << '.' << int(ver->patch); CrashHandler::setVariable("SDL version", runtimeVersion.str()); LogInfo << "Using SDL " << runtimeVersion.str(); const SDL_VideoInfo * vid = SDL_GetVideoInfo(); desktopMode.resolution.x = vid->current_w; desktopMode.resolution.y = vid->current_h; desktopMode.depth = vid->vfmt->BitsPerPixel; u32 flags = SDL_FULLSCREEN | SDL_ANYFORMAT | SDL_OPENGL | SDL_HWSURFACE; SDL_Rect ** modes = SDL_ListModes(NULL, flags); if(modes == (SDL_Rect **)(-1)) { // Any mode is supported, add some standard modes. #define ADD_MODE(x, y) \ if(desktopMode.resolution != Vec2i(x, y)) { \ displayModes.push_back(DisplayMode(Vec2i(x, y), desktopMode.depth)); \ } // 4:3 ADD_MODE(640, 480) // VGA ADD_MODE(800, 600) // SVGA ADD_MODE(1024, 768) // XGA ADD_MODE(1280, 960) // SXGA- ADD_MODE(1600, 1200) // UXGA // 5:4 ADD_MODE(1280, 1024) // SXGA // 16:9 ADD_MODE(1280, 720) // 720p ADD_MODE(1600, 900) // 900p ADD_MODE(1920, 1080) // 1080p ADD_MODE(2048, 1152) // 2K ADD_MODE(4096, 2304) // 4K // 16:10 ADD_MODE(1024, 640) // laptops ADD_MODE(1280, 800) // WXGA ADD_MODE(1440, 900) // WXGA+ ADD_MODE(1920, 1200) // WUXGA #undef ADD_MODE displayModes.push_back(desktopMode); } else if(modes) { for(; *modes; modes++) { DisplayMode mode(Vec2i((*modes)->w, (*modes)->h), desktopMode.depth); displayModes.push_back(mode); } } else { return false; } std::sort(displayModes.begin(), displayModes.end()); mainWindow = this; return true; }