void CGui::InitGui() { mGui = app->mGui; gcom->mGui = mGui; Check::pGUI = mGui; SliderValue::pGUI = mGui; Check::bGI = &bGI; SliderValue::bGI = &bGI; popup->mGui = mGui; popup->mPlatform = app->mPlatform; if (!mGui) return; Ogre::Timer ti; int i; // new widgets FactoryManager::getInstance().registerFactory<MultiList2>("Widget"); FactoryManager::getInstance().registerFactory<Slider>("Widget"); // load app->vwGui = LayoutManager::getInstance().loadLayout("Game.layout"); // wnds app->mWndMain = fWnd("MainMenuWnd"); app->mWndGame = fWnd("GameWnd"); app->mWndReplays = fWnd("ReplaysWnd"); app->mWndHelp = fWnd("HelpWnd"); app->mWndOpts = fWnd("OptionsWnd"); app->mWndChampStage = fWnd("WndChampStage"); app->mWndChampStage->setVisible(false); app->mWndChampEnd = fWnd("WndChampEnd"); app->mWndChampEnd->setVisible(false); app->mWndChallStage = fWnd("WndChallStage"); app->mWndChallStage->setVisible(false); app->mWndChallEnd = fWnd("WndChallEnd"); app->mWndChallEnd->setVisible(false); app->mWndNetEnd = fWnd("WndNetEnd"); app->mWndNetEnd->setVisible(false); app->mWndTweak = fWnd("WndTweak"); app->mWndTweak->setVisible(false); app->mWndTweak->setPosition(0,40); // for find defines Btn btn, bchk; Cmb cmb; Slider* sl; SV* sv; Ck* ck; // Tabs Tab tab,sub; fTabW("TabWndGame"); app->mWndTabsGame = tab; fTabW("TabWndReplays"); app->mWndTabsRpl = tab; fTabW("TabWndHelp"); app->mWndTabsHelp = tab; fTabW("TabWndOptions"); app->mWndTabsOpts = tab; // get sub tabs vSubTabsGame.clear(); for (i=0; i < app->mWndTabsGame->getItemCount(); ++i) { // todo: startsWith("SubTab").. sub = (Tab)app->mWndTabsGame->getItemAt(i)->findWidget( i==TAB_Champs ? "ChampType" : (i==TAB_Multi ? "tabsNet" : "tabPlayer") ); vSubTabsGame.push_back(sub); // 0 for not found } vSubTabsOpts.clear(); for (i=0; i < app->mWndTabsOpts->getItemCount(); ++i) { sub = (Tab)app->mWndTabsOpts->getItemAt(i)->findWidget( i==TABo_Input ? "InputTab" : "SubTab"); vSubTabsOpts.push_back(sub); } if (pSet->inMenu > MNU_Single && pSet->inMenu <= MNU_Challenge) app->mWndTabsGame->setIndexSelected(TAB_Champs); app->mWndRpl = fWnd("RplWnd"); /// Gui common init --- gcom->InitMainMenu(); gcom->GuiInitTooltip(); gcom->GuiInitLang(); gcom->GuiInitGraphics(); gcom->InitGuiScreenRes(); loadReadme = true; toggleGui(false); app->updMouse(); gcom->bnQuit->setVisible(app->isFocGui); /// Sliders //------------------------------------------------------------------------ // Hud view sizes ---- sv= &svSizeGaug; sv->Init("SizeGaug", &pSet->size_gauges, 0.1f, 0.3f, 1.f, 3,4); sv->DefaultF(0.19f); Sev(HudSize); sv= &svTypeGaug; sv->Init("TypeGaug", &pSet->gauges_type, 0, 5); sv->DefaultI(5); Sev(HudCreate); //sv= &svLayoutGaug; sv->Init("LayoutGaug", &pSet->gauges_layout, 0, 2); sv->DefaultI(1); Sev(HudCreate); sv= &svSizeMinimap; sv->Init("SizeMinimap", &pSet->size_minimap, 0.05f, 0.3f, 1.f, 3,4); sv->DefaultF(0.165f); Sev(HudSize); sv= &svZoomMinimap; sv->Init("ZoomMinimap", &pSet->zoom_minimap, 0.9f, 4.f, 1.f, 2,4); sv->DefaultF(1.6f); Sev(HudSize); sv= &svSizeArrow; sv->Init("SizeArrow", &pSet->size_arrow, 0.1f, 0.5f, 1.f, 3,4); sv->DefaultF(0.26f); Sev(SizeArrow); Slv(CountdownTime, pSet->gui.pre_time / 0.5f /10.f); sl->mfDefault = 4.f /10.f; // graphs valGraphsType = fTxt("GraphsTypeVal"); Cmb(cmb, "CmbGraphsType", comboGraphs); cmbGraphs = cmb; if (cmb) { cmb->removeAllItems(); for (i=0; i < Gh_ALL; ++i) cmb->addItem(csGraphNames[i]); cmb->setIndexSelected(pSet->graphs_type); } valGraphsType->setCaption(toStr(pSet->graphs_type)); // Options ---- sv= &svParticles; sv->Init("Particles", &pSet->particles_len, 0.f, 4.f, 2.f); sv->DefaultF(1.5f); sv= &svTrails; sv->Init("Trails", &pSet->trails_len, 0.f, 4.f, 2.f); sv->DefaultF(3.f); // reflection sv= &svReflSkip; sv->Init("ReflSkip", &pSet->refl_skip, 0,1000, 2.f); sv->DefaultI(0); sv= &svReflFaces; sv->Init("ReflFaces", &pSet->refl_faces, 1,6); sv->DefaultI(1); sv= &svReflSize; for (i=0; i < ciShadowSizesNum; ++i) sv->strMap[i] = toStr(ciShadowSizesA[i]); sv->Init("ReflSize", &pSet->refl_size, 0,ciShadowSizesNum-1); sv->DefaultI(1.5f); sv= &svReflDist; sv->Init("ReflDist", &pSet->refl_dist, 20.f,1500.f, 2.f, 0,4, 1.f," m"); Sev(ReflDist); sv->DefaultF(300.f); sv= &svReflMode; sv->strMap[0] = TR("#{ReflMode_static}"); sv->strMap[1] = TR("#{ReflMode_single}"); sv->strMap[2] = TR("#{ReflMode_full}"); sv->Init("ReflMode", &pSet->refl_mode, 0,2); Sev(ReflMode); sv->DefaultI(1); // Sound sv= &svVolMaster; sv->Init("VolMaster", &pSet->vol_master, 0.f, 1.6f); sv->DefaultF(0.80f); Sev(VolMaster); sv= &svVolEngine; sv->Init("VolEngine", &pSet->vol_engine, 0.f, 1.4f); sv->DefaultF(0.56f); sv= &svVolTires; sv->Init("VolTires", &pSet->vol_tires, 0.f, 1.4f); sv->DefaultF(0.80f); sv= &svVolSusp; sv->Init("VolSusp", &pSet->vol_susp, 0.f, 1.4f); sv->DefaultF(0.714f); sv= &svVolEnv; sv->Init("VolEnv", &pSet->vol_env, 0.f, 1.4f); sv->DefaultF(0.928f); sv= &svVolFlSplash; sv->Init("VolFlSplash", &pSet->vol_fl_splash, 0.f, 1.4f); sv->DefaultF(0.80f); sv= &svVolFlCont; sv->Init("VolFlCont", &pSet->vol_fl_cont, 0.f, 1.4f); sv->DefaultF(0.878f); sv= &svVolCarCrash; sv->Init("VolCarCrash", &pSet->vol_car_crash, 0.f, 1.4f); sv->DefaultF(0.703f); sv= &svVolCarScrap; sv->Init("VolCarScrap", &pSet->vol_car_scrap, 0.f, 1.4f); sv->DefaultF(1.00f); // car color float f; // temp sv= &svCarClrH; sv->Init("CarClrH", &f, 0.f,1.f); Sev(CarClr); sv= &svCarClrS; sv->Init("CarClrS", &f, 0.f,1.f); Sev(CarClr); sv= &svCarClrV; sv->Init("CarClrV", &f, 0.f,1.f); Sev(CarClr); sv= &svCarClrGloss; sv->Init("CarClrGloss", &f, 0.f,1.f, 1.6f); Sev(CarClr); sv= &svCarClrRefl; sv->Init("CarClrRefl", &f, 0.f,1.4f); Sev(CarClr); UpdCarClrSld(); /// Checks //------------------------------------------------------------------------ ck= &ckReverse; ck->Init("ReverseOn", &pSet->gui.trackreverse); Cev(Reverse); // Options ---- ck= &ckParticles; ck->Init("ParticlesOn", &pSet->particles); Cev(ParTrl); ck= &ckTrails; ck->Init("TrailsOn", &pSet->trails); Cev(ParTrl); // Hud ---- ck= &ckDigits; ck->Init("Digits", &pSet->show_digits); Cev(HudShow); ck= &ckGauges; ck->Init("Gauges", &pSet->show_gauges); Cev(HudShow); ck= &ckArrow; ck->Init("Arrow", &pSet->check_arrow); Cev(Arrow); ck= &ckBeam; ck->Init("ChkBeam", &pSet->check_beam); Cev(Beam); // minimap ck= &ckMinimap; ck->Init("Minimap", &pSet->trackmap); Cev(Minimap); ck= &ckMiniZoom; ck->Init("MiniZoom", &pSet->mini_zoomed); Cev(MiniUpd); ck= &ckMiniRot; ck->Init("MiniRot", &pSet->mini_rotated); ck= &ckMiniTer; ck->Init("MiniTer", &pSet->mini_terrain); Cev(MiniUpd); ck= &ckMiniBorder; ck->Init("MiniBorder", &pSet->mini_border); Cev(MiniUpd); // camera ck= &ckCamInfo; ck->Init("CamInfo", &pSet->show_cam); Cev(HudShow); ck= &ckCamTilt; ck->Init("CamTilt", &pSet->cam_tilt); ck= &ckCamLoop; ck->Init("CamLoop", &pSet->cam_loop_chng); ck= &ckCamBnc; ck->Init("CamBounce", &pSet->cam_bounce); sv= &svCamBnc; sv->Init("CamBnc", &pSet->cam_bnc_mul, 0.f, 2.f); sv= &svFov; sv->Init("Fov", &pSet->fov_min, 50.f, 180.f, 1.f, 1,4); sv->DefaultF(90.f); sv= &svFovMax; sv->Init("FovMax", &pSet->fov_max, 50.f, 180.f, 1.f, 1,4); sv->DefaultF(120.f); sv= &svFovSm; sv->Init("FovSm", &pSet->fov_smooth, 0.f, 15.f, 1.5f); sv->DefaultF(5.f); // times, opp ck= &ckTimes; ck->Init("Times", &pSet->show_times); Cev(HudShow); ck= &ckOpponents; ck->Init("Opponents", &pSet->show_opponents); Cev(HudShow); ck= &ckOppSort; ck->Init("OppSort", &pSet->opplist_sort); // dbg,other ck= &ckFps; ck->Init("Fps", &pSet->show_fps); app->bckFps->setVisible(pSet->show_fps); ck= &ckWireframe; ck->Init("Wireframe", &app->mbWireFrame); Cev(Wireframe); ck= &ckProfilerTxt; ck->Init("ProfilerTxt", &pSet->profilerTxt); ck= &ckBulletDebug; ck->Init("BulletDebug", &pSet->bltDebug); ck= &ckBltProfTxt; ck->Init("BltProfTxt", &pSet->bltProfilerTxt); ck= &ckCarDbgBars; ck->Init("CarDbgBars", &pSet->car_dbgbars); Cev(HudShow); ck= &ckCarDbgTxt; ck->Init("CarDbgTxt", &pSet->car_dbgtxt); Cev(HudShow); ck= &ckCarDbgSurf; ck->Init("CarDbgSurf", &pSet->car_dbgsurf); Cev(HudShow); ck= &ckTireVis; ck->Init("CarTireVis", &pSet->car_tirevis); Cev(HudCreate); ck= &ckGraphs; ck->Init("Graphs", &pSet->show_graphs); Cev(Graphs); sv= &svDbgTxtClr; sv->Init("DbgTxtClr", &pSet->car_dbgtxtclr, 0, 1); sv= &svDbgTxtCnt; sv->Init("DbgTxtCnt", &pSet->car_dbgtxtcnt, 0, 8); // car setup todo: for each player .. Chk("CarABS", chkAbs, pSet->abs[0]); bchAbs = bchk; Chk("CarTCS", chkTcs, pSet->tcs[0]); bchTcs = bchk; ck= &ckCarGear; ck->Init("CarGear", &pSet->autoshift); Cev(Gear); ck= &ckCarRear; ck->Init("CarRear", &pSet->autorear); Cev(Gear); ck= &ckCarRearInv; ck->Init("CarRearThrInv",&pSet->rear_inv); Cev(Gear); TabPtr tTires = fTab("tabCarTires"); Tev(tTires, TireSet); sv= &svSSSEffect; sv->Init("SSSEffect", &f, 0.f, 1.f); sv= &svSSSVelFactor; sv->Init("SSSVelFactor", &f, 0.f, 2.f); sv= &svSteerRangeSurf; sv->Init("SteerRangeSurf", &f, 0.3f, 1.3f); sv= &svSteerRangeSim; sv->Init("SteerRangeSim", &f, 0.3f, 1.3f); Btn("SSSReset", btnSSSReset); Btn("SteerReset", btnSteerReset); SldUpd_TireSet(); // game ------------------------------------------------------------ ck= &ckVegetCollis; ck->Init("VegetCollis", &pSet->gui.collis_veget); ck= &ckCarCollis; ck->Init("CarCollis", &pSet->gui.collis_cars); ck= &ckRoadWCollis; ck->Init("RoadWCollis", &pSet->gui.collis_roadw); ck= &ckDynamicObjs; ck->Init("DynamicObjects", &pSet->gui.dyn_objects); Cmb(cmb, "CmbBoost", comboBoost); cmbBoost = cmb; cmb->removeAllItems(); cmb->addItem(TR("#{Never}")); cmb->addItem(TR("#{FuelLap}")); cmb->addItem(TR("#{FuelTime}")); cmb->addItem(TR("#{Always}")); cmb->setIndexSelected(pSet->gui.boost_type); Cmb(cmb, "CmbFlip", comboFlip); cmbFlip = cmb; cmb->removeAllItems(); cmb->addItem(TR("#{Never}")); cmb->addItem(TR("#{FuelBoost}")); cmb->addItem(TR("#{Always}")); cmb->setIndexSelected(pSet->gui.flip_type); Cmb(cmb, "CmbDamage", comboDamage); cmbDamage = cmb; cmb->removeAllItems(); cmb->addItem(TR("#{None}")); cmb->addItem(TR("#{Reduced}")); cmb->addItem(TR("#{Normal}")); cmb->setIndexSelected(pSet->gui.damage_type); Cmb(cmb, "CmbRewind", comboRewind); cmbRewind = cmb; cmb->removeAllItems(); cmb->addItem(TR("#{None}")); cmb->addItem(TR("#{Always}")); //cmb->addItem(TR("#{FuelLap}")); cmb->addItem(TR("#{FuelTime}")); cmb->setIndexSelected(pSet->gui.rewind_type); sv= &svDamageDec; sv->Init("DamageDec", &pSet->gui.damage_dec, 0.f, 100.f, 1.f, 0,1, 1.f, " %"); sv= &svBmin; sv->Init("Bmin", &pSet->gui.boost_min, 0.f, 10.f,1.f, 1,3); sv->DefaultF(2.f); sv= &svBmax; sv->Init("Bmax", &pSet->gui.boost_max, 2.f, 20.f,1.f, 1,3); sv->DefaultF(6.f); sv= &svBpow; sv->Init("Bpow", &pSet->gui.boost_power, 0.f, 2.5f,1.f, 1,3); sv->DefaultF(1.f); sv= &svBperKm; sv->Init("BperKm", &pSet->gui.boost_per_km, 0.f, 4.f, 1.f, 1,3); sv->DefaultF(1.f); sv= &svBaddSec; sv->Init("BaddSec", &pSet->gui.boost_add_sec, 0.f, 1.f, 1.f, 2,4); sv->DefaultF(0.1f); // split Btn("btnPlayers1", btnNumPlayers); Btn("btnPlayers2", btnNumPlayers); Btn("btnPlayers3", btnNumPlayers); Btn("btnPlayers4", btnNumPlayers); ck= &ckSplitVert; ck->Init("chkSplitVertically", &pSet->split_vertically); Chk("chkStartOrderRev", chkStartOrd, pSet->gui.start_order); valLocPlayers = fTxt("valLocPlayers"); if (valLocPlayers) valLocPlayers->setCaption(toStr(pSet->gui.local_players)); // sim mode radio Btn("SimModeEasy", radSimEasy); bRsimEasy = btn; btn->setStateSelected(pSet->gui.sim_mode == "easy"); Btn("SimModeNorm", radSimNorm); bRsimNorm = btn; btn->setStateSelected(pSet->gui.sim_mode == "normal"); Btn("SimModeHard", radSimHard); bRsimHard = btn; btn->setStateSelected(pSet->gui.sim_mode == "hard"); // kmh/mph radio Btn("kmh", radKmh); bRkmh = btn; bRkmh->setStateSelected(!pSet->show_mph); Btn("mph", radMph); bRmph = btn; bRmph->setStateSelected( pSet->show_mph); // startup ck= &ckStartInMain; ck->Init("StartInMain", &pSet->startInMain); ck= &ckAutoStart; ck->Init("AutoStart", &pSet->autostart); ck= &ckEscQuits; ck->Init("EscQuits", &pSet->escquit); ck= &ckOgreDialog; ck->Init("OgreDialog", &pSet->ogre_dialog); ck= &ckMouseCapture;ck->Init("MouseCapture",&pSet->mouse_capture); ck= &ckBltLines; ck->Init("BltLines", &pSet->bltLines); ck= &ckShowPics; ck->Init("ShowPictures",&pSet->loadingbackground); Chk("MultiThread", chkMultiThread, pSet->multi_thr > 0); ck= &ckDevKeys; ck->Init("DevKeys", &pSet->dev_keys); // effects ck= &ckAllEffects; ck->Init("AllEffects", &pSet->all_effects); Cev(AllEffects); ck= &ckBoostFOV; ck->Init("BoostFOV", &pSet->boost_fov); ck= &ckBloom; ck->Init("Bloom", &pSet->bloom); Cev(EffUpd); sv= &svBloomInt; sv->Init("BloomInt", &pSet->bloom_int); sv->DefaultF(0.13f); sv= &svBloomOrig; sv->Init("BloomOrig", &pSet->bloom_orig); sv->DefaultF(0.91f); ck= &ckBlur; ck->Init("MotionBlur", &pSet->blur); Cev(EffUpdShd); sv= &svBlurIntens; sv->Init("BlurIntens", &pSet->blur_int); sv->DefaultF(0.4f); ck= &ckSSAO; ck->Init("SSAO", &pSet->ssao); Cev(EffUpdShd); ck= &ckSoftPar; ck->Init("SoftParticles",&pSet->softparticles); Cev(EffUpdShd); ck= &ckGodRays; ck->Init("GodRays", &pSet->godrays); Cev(EffUpdShd); ck= &ckDoF; ck->Init("DepthOfField",&pSet->dof); Cev(EffUpdShd); sv= &svDofFocus; sv->Init("DofFocus", &pSet->dof_focus, 0.f, 2000.f, 2.f, 0,3); sv->DefaultF(100.f); sv= &svDofFar; sv->Init("DofFar", &pSet->dof_far, 0.f, 2000.f, 2.f, 0,4); sv->DefaultF(1000.f); // hdr ck= &ckHDR; ck->Init("HDR", &pSet->hdr); Cev(EffUpd); sv= &svHDRParam1; sv->Init("HDRParam1", &pSet->hdrParam1); sv->DefaultF(0.62f); sv= &svHDRParam2; sv->Init("HDRParam2", &pSet->hdrParam2, 0.f, 1.f, 2.f); sv->DefaultF(0.10f); sv= &svHDRParam3; sv->Init("HDRParam3", &pSet->hdrParam3); sv->DefaultF(0.79f); sv= &svHDRAdaptScale; sv->Init("HDRAdaptScale", &pSet->hdrAdaptationScale, 0.f, 1.f, 2.f); sv->DefaultF(0.10f); sv= &svHDRBloomInt; sv->Init("HDRBloomInt", &pSet->hdrBloomint); sv->DefaultF(0.81f); sv= &svHDRBloomOrig; sv->Init("HDRBloomOrig", &pSet->hdrBloomorig); sv->DefaultF(0.34f); sv= &svHDRVignRadius; sv->Init("HDRVignRadius", &pSet->vignRadius, 0.f, 10.f); sv->DefaultF(2.85f); sv= &svHDRVignDark; sv->Init("HDRVignDark", &pSet->vignDarkness); sv->DefaultF(0.34f); // replays ------------------------------------------------------------ Btn("RplLoad", btnRplLoad); Btn("RplSave", btnRplSave); Btn("RplDelete", btnRplDelete); Btn("RplRename", btnRplRename); // settings ck= &ckRplAutoRec; ck->Init("RplChkAutoRec", &app->bRplRec); ck= &ckRplBestOnly; ck->Init("RplChkBestOnly", &pSet->rpl_bestonly); ck= &ckRplGhost; ck->Init("RplChkGhost", &pSet->rpl_ghost); ck= &ckRplParticles; ck->Init("RplChkParticles", &pSet->rpl_ghostpar); ck= &ckRplRewind; ck->Init("RplChkRewind", &pSet->rpl_ghostrewind); ck= &ckRplGhostOther; ck->Init("RplChkGhostOther",&pSet->rpl_ghostother); ck= &ckRplTrackGhost; ck->Init("RplChkTrackGhost",&pSet->rpl_trackghost); Slv(RplNumViewports, (pSet->rpl_numViews-1) / 3.f); // radios, filter ck= &ckRplGhosts; ck->Init("RplBtnGhosts", &pSet->rpl_listghosts); Cev(RplGhosts); Btn("RplBtnAll", btnRplAll); rbRplAll = btn; Btn("RplBtnCur", btnRplCur); rbRplCur = btn; btn = pSet->rpl_listview == 0 ? rbRplAll : rbRplCur; if (btn) btn->setStateSelected(true); if (app->mWndRpl) { // replay controls Btn("RplToStart", btnRplToStart); Btn("RplToEnd", btnRplToEnd) Btn("RplPlay", btnRplPlay); btRplPl = btn; btn = fBtn("RplBack"); btn->eventMouseButtonPressed += newDelegate(this, &CGui::btnRplBackDn); btn->eventMouseButtonReleased += newDelegate(this, &CGui::btnRplBackUp); btn = fBtn("RplForward"); btn->eventMouseButtonPressed += newDelegate(this, &CGui::btnRplFwdDn); btn->eventMouseButtonReleased += newDelegate(this, &CGui::btnRplFwdUp); // info slRplPos = (Slider*)app->mWndRpl->findWidget("RplSlider"); if (slRplPos) slRplPos->eventValueChanged += newDelegate(this, &CGui::slRplPosEv); valRplPerc = fTxt("RplPercent"); valRplCur = fTxt("RplTimeCur"); valRplLen = fTxt("RplTimeLen"); } // text desc, stats valRplName = fTxt("RplName"); valRplName2 = fTxt("RplName2"); valRplInfo = fTxt("RplInfo"); valRplInfo2 = fTxt("RplInfo2"); edRplName = fEd("RplNameEdit"); //edRplDesc = fEd("RplDesc"); rplList = fLi("RplList"); Lev(rplList, RplChng); updReplaysList(); /// Car //------------------------------------------------------------ const int clrBtn = 30; Real hsv[clrBtn][5] = { // color buttons hue,sat,val, gloss,refl {0.05,0.64,0.27, 0.10,0.9}, {0.00,0.97,0.90, 0.3, 1.2}, // cherry, red {0.91,1.00,1.00, 0.5, 1.0}, {0.86,1.00,0.97, 0.8, 0.6}, // orange, yellow {0.75,0.95,0.90, 1.0, 0.4}, {0.70,1.00,0.70, 0.03,1.3}, // lime, green {0.54,0.88,0.60, 0.7, 0.85},{0.51,0.90,0.50, 0.1, 0.7}, // cyan {0.41,0.34,0.30, 0.01,0.3}, {0.43,0.58,0.23, 0.1, 1.0}, // dark-cyan //{0.45,0.54,0.37, 0.5,1.0}, {0.37,0.78,0.21, 0.34,0.5}, {0.35,0.70,0.40, 0.5, 1.0}, {0.38,0.97,0.52, 0.5, 1.0}, // dark-blue {0.44,0.90,0.71, 1.0, 1.1}, {0.47,0.80,0.80, 0.2, 0.9}, // sky-blue {0.50,0.33,0.90, 0.9, 1.0}, {0.42,0.20,0.94, 0.5, 0.4}, // sky-white {0.63,0.21,0.62, 0.1, 1.2}, {0.80,0.52,0.32, 0.1, 0.6}, {0.62,0.74,0.12, 0.8, 0.7}, // olive- {0.28,0.00,0.12, 0.09,0.0}, {0.28,0.00,0.07, 0.14,0.84}, // black {0.83,0.00,0.20, 0.0, 0.8}, {0.41,0.00,0.86, 0.15,0.37}, // silver,white {0.83,0.31,0.31, 0.0, 0.6}, {0.91,0.40,0.37, 0.0, 1.0}, {0.20,0.40,0.37, 0.05,1.0}, // orng-white- {0.24,0.90,0.26, 0.04,0.8}, {0.28,0.57,0.17, 0.3, 1.0}, {0.27,0.38,0.23, 0.03,0.6}, // dark violet }; for (i=0; i < clrBtn; ++i) { Img img = fImg("carClr"+toStr(i)); Real h = hsv[i][0], s = hsv[i][1], v = hsv[i][2], g = hsv[i][3], r = hsv[i][4]; ColourValue c; c.setHSB(1.f-h, s, v); img->setColour(Colour(c.r,c.g,c.b)); img->eventMouseButtonClick += newDelegate(this, &CGui::imgBtnCarClr); img->setUserString("s", toStr(s)); img->setUserString("h", toStr(h)); img->setUserString("v", toStr(v)); img->setUserString("g", toStr(g)); img->setUserString("r", toStr(r)); } Btn("CarClrRandom", btnCarClrRandom); sv= &svNumLaps; sv->Init("NumLaps", &pSet->gui.num_laps, 1,10, 1.3f); sv->DefaultI(2); txCarStatsTxt = fTxt("CarStatsTxt"); txCarSpeed = fTxt("CarSpeed"); txCarStatsVals = fTxt("CarStatsVals"); txCarType = fTxt("CarType"); txCarAuthor = fTxt("CarAuthor"); txTrackAuthor = fTxt("TrackAuthor"); TabPtr tPlr = fTab("tabPlayer"); Tev(tPlr, Player); Btn("btnPlayers1", btnNumPlayers); Btn("btnPlayers2", btnNumPlayers); Btn("btnPlayers3", btnNumPlayers); Btn("btnPlayers4", btnNumPlayers); ck= &ckSplitVert; ck->Init("chkSplitVertically", &pSet->split_vertically); /// Multiplayer //------------------------------------------------------------------------ tabsNet = fTab("tabsNet"); //TabItem* t1 = tabsNet->getItemAt(0); //t1->setEnabled(0); //int num = tabsNet ? tabsNet->getItemCount() : 0; //tabsNet->setIndexSelected( (tabsNet->getIndexSelected() - 1 + num) % num ); // server, games listServers = fMli("MListServers"); int c=0; Mli ml = listServers; ml->addColumn("#C0FFC0"+TR("#{Game name}"), 160); ++c; ml->addColumn("#50FF50"+TR("#{Track}"), 120); ++c; ml->addColumn("#80FFC0"+TR("#{Laps}"), 60); ++c; ml->addColumn("#FFFF00"+TR("#{Players}"), 60); ++c; ml->addColumn("#80FFFF"+TR("#{Collis.}"), 70); ++c; ml->addColumn("#A0D0FF"+TR("#{Simulation}"), 80); ++c; ml->addColumn("#A0D0FF"+TR("#{Boost}"), 90); ++c; ml->addColumn("#FF6060"+TR("#{Locked}"), 60); iColLock = c; ++c; ml->addColumn("#FF9000"+TR("#{NetHost}"), 140); iColHost = c; ++c; ml->addColumn("#FFB000"+TR("#{NetPort}"), 80); iColPort = c; ++c; Btn("btnNetRefresh",evBtnNetRefresh); btnNetRefresh = btn; Btn("btnNetJoin", evBtnNetJoin); btnNetJoin = btn; Btn("btnNetCreate", evBtnNetCreate); btnNetCreate = btn; Btn("btnNetDirect", evBtnNetDirect); btnNetDirect = btn; // game, players Edt(edNetGameName, "edNetGameName", evEdNetGameName); edNetGameName->setCaption(pSet->netGameName); valNetPassword = fTxt("valNetPassword"); Edt(edNetPassword, "edNetPassword", evEdNetPassword); listPlayers = fMli("MListPlayers"); ml = listPlayers; ml->addColumn("#80C0FF"+TR("#{Player}"), 140); ml->addColumn("#F08080"+TR("#{Car}"), 60); ml->addColumn("#C0C060"+TR("#{Peers}"), 60); ml->addColumn("#60F0F0"+TR("#{Ping}"), 60); ml->addColumn("#40F040"+TR("#{NetReady}"), 60); Btn("btnNetReady", evBtnNetReady); btnNetReady = btn; Btn("btnNetLeave", evBtnNetLeave); btnNetLeave = btn; // panels to hide tabs panNetServer = fWP("panelNetServer"); panNetServer->setVisible(false); panNetGame = fWP("panelNetGame"); panNetGame->setVisible(true); // chat edNetChat = fEd("edNetChat"); // chat area edNetChatMsg = fEd("edNetChatMsg"); // user text // track,game text valNetGameInfo = fTxt("valNetGameInfo"); // settings Edt(edNetNick, "edNetNick", evEdNetNick); edNetNick->setCaption( pSet->nickname); Edt(edNetServerIP, "edNetServerIP", evEdNetServerIP); edNetServerIP->setCaption( pSet->master_server_address); Edt(edNetServerPort,"edNetServerPort", evEdNetServerPort); edNetServerPort->setCaption(toStr(pSet->master_server_port)); Edt(edNetLocalPort, "edNetLocalPort", evEdNetLocalPort); edNetLocalPort->setCaption( toStr(pSet->local_port)); // quick help text ---- Ed edHelp = fEd("QuickHelpText"); String s = TR("#{QuickHelpText}"); s = StringUtil::replaceAll(s, "@", "\n"); edHelp->setCaption(s); // user dir Ed edUserDir = fEd("EdUserDir"); edUserDir->setCaption(PATHMANAGER::UserConfigDir()); /// graphs ---- sv= &svTC_r; sv->Init("TC_r", &pSet->tc_r, 0.5f, 2.f, 1.5f, 1,4); sv->DefaultF(1.f); sv= &svTC_xr; sv->Init("TC_xr", &pSet->tc_xr, 0.f, 5.f, 1.5f, 1,4); sv->DefaultF(1.f); sv= &svTE_yf; sv->Init("TE_yf", &pSet->te_yf, 5000.f, 10000.f, 1.f, 0,4); sv->DefaultF(7000.f); sv= &svTE_xfx; sv->Init("TE_xfx", &pSet->te_xfx, 4.f, 42.f, 2.f, 1,4); sv->DefaultF(12.f); sv= &svTE_xfy; sv->Init("TE_xfy", &pSet->te_xfy, 90.f, 560.f, 2.f, 0,3); sv->DefaultF(160.f); sv= &svTE_xpow; sv->Init("TE_xpow", &pSet->te_xf_pow, 1.f, 2.f, 1.f, 1,3); sv->DefaultF(1.f); /// tweak car //------------------------------------------------------------ for (i=0; i < ciEdCar; ++i) edCar[i] = fEd("EdCar"+toStr(i)); edPerfTest = fEd("TweakPerfTest"); tabEdCar = fTab("TabEdCar"); Tev(tabEdCar, CarEdChng); tabEdCar->setIndexSelected(pSet->car_ed_tab); tabTweak = fTab("TabTweak"); /**/tabTweak->setIndexSelected(1); txtTweakPath = fTxt("TweakPath"); Btn("TweakCarSave", btnTweakCarSave); edTweakCol = fEd("TweakEditCol"); txtTweakPathCol = fTxt("TweakPathCol"); Btn("TweakColSave", btnTweakColSave); /// tweak tires ---- Btn("TweakTireSave", btnTweakTireSave); txtTweakTire = fTxt("TweakTireTxtSaved"); Edt(edTweakTireSet, "TweakTireSet", editTweakTireSet); liTwkTiresUser = fLi("TweakTiresUser"); Lev(liTwkTiresUser, TwkTiresUser); liTwkTiresOrig = fLi("TweakTiresOrig"); Lev(liTwkTiresOrig, TwkTiresOrig); Btn("TweakTireLoad", btnTweakTireLoad); Btn("TweakTireLoadRef", btnTweakTireLoadRef); /// tweak surfaces ---- liTwkSurfaces = fLi("TweakSurfaces"); Lev(liTwkSurfaces, TwkSurfaces); //<Widget type="ComboBox" name="TweakSurface"> Btn("TweakSurfPickWh", btnTwkSurfPick); sv= &svSuFrict; sv->Init("SuFrict", &f, 0.f, 1.5f, 1.0f, 2,4); sv->DefaultF(0.65f); sv= &svSuFrictX; sv->Init("SuFrictX", &f, 0.f, 1.5f, 1.0f, 2,4); sv->DefaultF(1.f); sv= &svSuFrictY; sv->Init("SuFrictY", &f, 0.f, 1.5f, 1.0f, 2,4); sv->DefaultF(1.f); sv= &svSuBumpWave; sv->Init("SuBumpWave", &f, 0.f, 50.f, 1.2f, 1,4); sv->DefaultF(20.f); sv= &svSuBumpAmp; sv->Init("SuBumpAmp", &f, 0.f, 0.4f, 1.0f, 2,4); sv->DefaultF(0.15f); sv= &svSuBumpWave2; sv->Init("SuBumpWave2", &f, 0.f, 50.f, 1.2f, 1,4); sv->DefaultF(20.f); sv= &svSuBumpAmp2; sv->Init("SuBumpAmp2", &f, 0.f, 0.4f, 1.0f, 2,4); sv->DefaultF(0.15f); sv= &svSuRollDrag; sv->Init("SuRollDrag", &f, 0.f, 200.f, 2.f, 0,3); sv->DefaultF(60.f); sv= &svSuRollRes; sv->Init("SuRollRes", &f, 0.f, 200.f, 2.f, 0,3); sv->DefaultF(1.f); //TODO: <Widget type="Button" name="TweakSurfSave"> Cmb(cmb, "CmbSuTire", comboSurfTire); cmbSurfTire = cmb; Cmb(cmb, "CmbSuType", comboSurfType); cmbSurfType = cmb; cmb->removeAllItems(); for (i=0; i < TRACKSURFACE::NumTypes; ++i) cmb->addItem(csTRKsurf[i]); /// input tab ------- InitInputGui(); /// cars list //------------------------------------------------------------------------ Tbi carTab = fTbi("TabCar"); Mli2 li = carTab->createWidget<MultiList2>("MultiListBox",16,48,200,110, Align::Left | Align::VStretch); li->setColour(Colour(0.7,0.85,1.0)); li->removeAllColumns(); int n=0; li->addColumn("#FF8888"+TR("#{Car}"), colCar[n++]); li->addColumn("#FFC080"+TR("#{CarSpeed}"), colCar[n++]); li->addColumn("#B0B8C0"+TR("#{CarYear}"), colCar[n++]); li->addColumn("#C0C0E0"+TR("#{CarType}"), colCar[n++]); li->addColumn(" ", colCar[n++]); carList = li; FillCarList(); //once li->mSortColumnIndex = pSet->cars_sort; li->mSortUp = pSet->cars_sortup; Lev(carList, CarChng); CarListUpd(false); //upd sListCar = pSet->gui.car[0]; imgCar = fImg("CarImg"); carDesc = fEd("CarDesc"); listCarChng(carList,0); /// tracks list, text, chg btn //------------------------------------------------------------------------ gcom->trkDesc[0] = fEd("TrackDesc"); gcom->sListTrack = pSet->gui.track; gcom->GuiInitTrack(); Ed ed; Edt(ed,"RplFind",edRplFind); // netw Tbi trkTab = fTbi("TabTrack"); trkTab->setColour(Colour(0.8f,0.96f,1.f)); const IntCoord& tc = trkTab->getCoord(); WP wp = trkTab->createWidget<Widget>( "PanelSkin", 0,0,tc.width*0.66f,tc.height, Align::Default/*, "Popup", "panelNetTrack"*/); wp->setColour(Colour(0.8f,0.96f,1.f)); wp->setAlpha(0.8f); wp->setVisible(false); panNetTrack = wp; //<UserString key="RelativeTo" value="OptionsWnd"/> // new game for (i=1; i<=3; ++i) { Btn("NewGame"+toStr(i), btnNewGame); if (i==2) btNewGameCar = btn; } // championships //------------------------------------------------------------------------ // track stats 2nd set gcom->trkDesc[1] = fEd("TrackDesc2"); valTrkNet = fTxt("TrackText"); // preview images gcom->imgPrv[1] = fImg("TrackImg2"); gcom->imgPrv[1]->setImageTexture("PrvView"); gcom->imgTer[1] = fImg("TrkTerImg2"); gcom->imgTer[1]->setImageTexture("PrvTer"); gcom->imgMini[1] = fImg("TrackMap2"); gcom->imgMini[1]->setImageTexture("PrvRoad"); gcom->initMiniPos(1); // track stats text int st = gcom->StTrk; for (i=0; i < st; ++i) gcom->stTrk[1][i] = fTxt("2st"+toStr(i)); for (i=0; i < 4; ++i) gcom->imStTrk[1][i] = fImg("2ist"+toStr(i)); for (i=0; i < gcom->InfTrk; ++i) { gcom->infTrk[1][i] = fTxt("2ti"+toStr(i)); gcom->imInfTrk[1][i] = fImg("2iti"+toStr(i)); } edChInfo = fEd("ChampInfo"); if (edChInfo) edChInfo->setVisible(pSet->champ_info); Btn("btnChampInfo",btnChampInfo); panCh = fWP("panCh"); txtCh = fTxt("txtChDetail"); valCh = fTxt("valChDetail"); for (i=0; i<3; ++i) { String s = toStr(i); txtChP[i] = fTxt("txtChP"+s); valChP[i] = fTxt("valChP"+s); } edChDesc = fEd("ChampDescr"); // Champs list ------------- Tbi trktab = fTbi("TabChamps"); li = trktab->createWidget<MultiList2>("MultiListBox",0,0,400,300, Align::Left | Align::VStretch); Lev(li, ChampChng); li->setVisible(false); li->removeAllColumns(); c=0; li->addColumn("#80A080N", colCh[c++]); li->addColumn(TR("#40F040#{Name}"), colCh[c++]); li->addColumn(TR("#F0F040#{Difficulty}"), colCh[c++]); li->addColumn(TR("#80F0C0#{Stages}"), colCh[c++]); li->addColumn(TR("#80E0FF#{Time} #{TimeMS}"), colCh[c++]); li->addColumn(TR("#D0C0FF#{Progress}"), colCh[c++]); li->addColumn(TR("#F0E0F0#{Score}"), colCh[c++]); li->addColumn(" ", colCh[c++]); liChamps = li; // Challs list ------------- li = trktab->createWidget<MultiList2>("MultiListBox",0,0,400,300, Align::Left | Align::VStretch); Lev(li, ChallChng); li->setVisible(false); li->removeAllColumns(); c=0; li->addColumn("#80A080N", colChL[c++]); li->addColumn(TR("#60F060#{Name}"), colChL[c++]); li->addColumn(TR("#F0D040#{Difficulty}"), colChL[c++]); li->addColumn(TR("#F09090#{Cars}"), colChL[c++]); li->addColumn(TR("#80F0C0#{Stages}"), colChL[c++]); li->addColumn(TR("#80E0FF#{Time} m"), colChL[c++]); li->addColumn(TR("#D0C0FF#{Progress}"), colChL[c++]); li->addColumn(TR("#F0F8FF#{Prize}"), colChL[c++]); li->addColumn(TR("#F0D0F0#{Score}"), colChL[c++]); li->addColumn(" ", colChL[c++]); liChalls = li; // Stages list ------------- trktab = (TabItem*)app->mWndGame->findWidget("TabStages"); li = trktab->createWidget<MultiList2>("MultiListBox",0,0,400,300, Align::Left | Align::VStretch); li->setColour(Colour(0.7,0.73,0.76)); Lev(li, StageChng); li->setVisible(false); li->removeAllColumns(); c=0; li->addColumn("#80A080N", colSt[c++]); li->addColumn(TR("#50F050#{Track}"), colSt[c++]); li->addColumn(TR("#80FF80#{Scenery}"), colSt[c++]); li->addColumn(TR("#F0F040#{Difficulty}"), colSt[c++]); li->addColumn(TR("#60E0A0#{Laps}"), colSt[c++]); li->addColumn(TR("#80E0FF#{Time} #{TimeMS}"), colSt[c++]); li->addColumn(TR("#F0E0F0#{Score}"), colSt[c++]); li->addColumn(" ", colSt[c++]); liStages = li; updChampListDim(); ChampsListUpdate(); listChampChng(liChamps, liChamps->getIndexSelected()); ChallsListUpdate(); listChallChng(liChalls, liChalls->getIndexSelected()); // tabs tabTut = fTab("TutType"); Tev(tabTut, TutType); tabTut->setIndexSelected(pSet->tut_type); tabChamp = fTab("ChampType"); Tev(tabChamp, ChampType); tabChamp->setIndexSelected(pSet->champ_type); tabChall = fTab("ChallType"); Tev(tabChall, ChallType); tabChall->setIndexSelected(pSet->chall_type); imgTut = fImg("imgTut"); imgChamp = fImg("imgChamp"); imgChall = fImg("imgChall"); Btn("btnTutStart", btnChampStart); btStTut = btn; Btn("btnChampStart",btnChampStart); btStChamp = btn; Btn("btnChallStart",btnChallStart); btStChall = btn; Btn("btnChRestart", btnChRestart); btChRestart = btn; // ch other ck= &ckChampRev; ck->Init("ChampRev", &pSet->gui.champ_rev); Cev(ChampRev); Btn("btnChampStageBack", btnChampStageBack); Btn("btnChampStageStart",btnChampStageStart); btChampStage = btn; Btn("btnChampEndClose", btnChampEndClose); Btn("btnChallStageBack", btnChallStageBack); Btn("btnChallStageStart",btnChallStageStart); btChallStage = btn; Btn("btnChallEndClose", btnChallEndClose); Btn("btnStageNext", btnStageNext); Btn("btnStagePrev", btnStagePrev); valStageNum = fTxt("StageNum"); edChampStage = fEd("ChampStageText"); edChampEnd = fEd("ChampEndText"); edChallStage = fEd("ChallStageText"); edChallEnd = fEd("ChallEndText"); // stage prv imgChampStage = fImg("ChampStageImg"); imgChampStage->setImageTexture("PrvStCh"); imgChallStage = fImg("ChallStageImg"); imgChallStage->setImageTexture("PrvStCh"); imgChampEndCup = fImg("ChampEndImgCup"); txChampEndF = fTxt("ChampEndFinished"); imgChallFail = fImg("ChallEndImgFail"); txChallEndF = fTxt("ChallEndFinished"); imgChallCup = fImg("ChallEndImgCup"); txChallEndC = fTxt("ChallEndCongrats"); UpdChampTabVis(); // netw end list ------ Btn("btnNetEndClose", btnNetEndClose); li = app->mWndNetEnd->createWidget<MultiList2>("MultiListBox",4,42,632,360, Align::Left | Align::VStretch); li->setInheritsAlpha(false); li->setColour(Colour(0.8,0.9,1,1)); li->removeAllColumns(); li->addColumn("", 40); //N li->addColumn(TR("#{TBPlace}"), 60); li->addColumn(TR("#{NetNickname}"), 180); li->addColumn(TR("#{TBTime}"), 120); li->addColumn(TR("#{TBBest}"), 120); li->addColumn(TR("#{TBLap}"), 60); liNetEnd = li; bGI = true; // gui inited, gui events can now save vals LogO(String("::: Time Init Gui: ") + fToStr(ti.getMilliseconds(),0,3) + " ms"); }
void CGui::InitGui() { mGui = app->mGui; gcom->mGui = mGui; SliderValue::pGUI = mGui; SliderValue::bGI = &bGI; Check::pGUI = mGui; Check::bGI = &bGI; if (!mGui) return; Ogre::Timer ti; // new widgets FactoryManager::getInstance().registerFactory<MultiList2>("Widget"); FactoryManager::getInstance().registerFactory<Slider>("Widget"); // load app->vwGui = LayoutManager::getInstance().loadLayout("Editor.layout"); // wnds app->mWndMain = fWnd("MainMenuWnd"); app->mWndTrack = fWnd("TrackWnd"); app->mWndEdit = fWnd("EditorWnd"); app->mWndOpts = fWnd("OptionsWnd"); app->mWndHelp = fWnd("HelpWnd"); app->mWndPick = fWnd("PickWnd"); app->mWndCam = fWnd("CamWnd"); app->mWndCam->setPosition(0,64); app->mWndStart = fWnd("StartWnd"); app->mWndStart->setPosition(0,64); app->mWndBrush = fWnd("BrushWnd"); app->mWndBrush->setPosition(0,64); app->mWndRoadCur = fWnd("RoadCur"); app->mWndRoadCur->setPosition(0,40); app->mWndRoadStats = fWnd("RoadStats"); app->mWndRoadStats->setPosition(0,338); app->mWndFluids = fWnd("FluidsWnd"); app->mWndFluids->setPosition(0,64); app->mWndObjects= fWnd("ObjectsWnd"); app->mWndObjects->setPosition(0,64); app->mWndRivers = fWnd("RiversWnd"); app->mWndRivers->setPosition(0,64); // for find defines Btn btn, bchk; Sl* sl; SV* sv; Ck* ck; // Tabs TabPtr tab,sub; fTabW("TabWndTrack"); app->mWndTabsTrack = tab; fTabW("TabWndEdit"); app->mWndTabsEdit = tab; fTabW("TabWndOpts"); app->mWndTabsOpts = tab; fTabW("TabWndHelp"); app->mWndTabsHelp = tab; // get sub tabs vSubTabsTrack.clear(); for (size_t i=0; i < app->mWndTabsTrack->getItemCount(); ++i) { sub = (TabPtr)app->mWndTabsTrack->getItemAt(i)->findWidget("SubTab"); vSubTabsTrack.push_back(sub); } vSubTabsEdit.clear(); for (size_t i=0; i < app->mWndTabsEdit->getItemCount(); ++i) { sub = (TabPtr)app->mWndTabsEdit->getItemAt(i)->findWidget("SubTab"); vSubTabsEdit.push_back(sub); // 0 for not found } vSubTabsHelp.clear(); for (size_t i=0; i < app->mWndTabsHelp->getItemCount(); ++i) { sub = (TabPtr)app->mWndTabsHelp->getItemAt(i)->findWidget("SubTab"); vSubTabsHelp.push_back(sub); } vSubTabsOpts.clear(); for (size_t i=0; i < app->mWndTabsOpts->getItemCount(); ++i) { sub = (TabPtr)app->mWndTabsOpts->getItemAt(i)->findWidget("SubTab"); vSubTabsOpts.push_back(sub); } /// Gui common init --- gcom->InitMainMenu(); gcom->GuiInitTooltip(); gcom->GuiInitLang(); gcom->GuiInitGraphics(); gcom->InitGuiScreenRes(); //app->mWndTabs->setIndexSelected(3); //default*-- gcom->ResizeOptWnd(); //? // center mouse pos app->mCursorManager->cursorVisibilityChange(app->bGuiFocus || !app->bMoveCam); gcom->GuiCenterMouse(); // hide --- app->SetEdMode(ED_Deform); app->UpdEditWnds(); // UpdVisHit(); //after track #if 0 ///0 _tool_ fix video capture cursor imgCur = mGui->createWidget<ImageBox>("ImageBox", 100,100, 32,32, Align::Default, "Pointer"); imgCur->setImageTexture("pointer.png"); imgCur->setVisible(true); #endif // tool window texts ---------------------- int i; for (i=0; i<MAX_TXT; ++i) { String s = toStr(i); if (i<BR_TXT){ brTxt[i] = fTxt("brTxt"+s); brVal[i] = fTxt("brVal"+s); brKey[i] = fTxt("brKey"+s); } if (i<RD_TXT){ rdTxt[i] = fTxt("rdTxt"+s); rdVal[i] = fTxt("rdVal"+s); rdKey[i] = fTxt("rdKey"+s); } if (i<RDS_TXT){ rdTxtSt[i] = fTxt("rdTxtSt"+s); rdValSt[i] = fTxt("rdValSt"+s); } if (i<ST_TXT) stTxt[i] = fTxt("stTxt"+s); if (i<FL_TXT) flTxt[i] = fTxt("flTxt"+s); if (i<OBJ_TXT) objTxt[i]= fTxt("objTxt"+s); if (i<RI_TXT) riTxt[i] = fTxt("riTxt"+s); } /// brush presets o o o o o o o o ScrollView* scv = mGui->findWidget<ScrollView>("svBrushes"); int j=0, n=0; const int z = 128; for (i=0; i < app->brSetsNum; ++i,++n) { const App::BrushSet& st = app->brSets[i]; const String s = toStr(i); int x,y, xt,yt, sx, row1 = i-14; // y,x for next lines if (row1 < 0) // top row { x = 10+ i*50; y = 10; xt = x + 20; yt = y + 50; sx = 48; }else { if (st.newLine==1 && n > 0 || n > 9) { n=0; ++j; } // 1 new line x = 20+ n*70; y = 10+ j*70; xt = x + 25; yt = y + 55; sx = 64; if (st.newLine < 0) n -= st.newLine; // -1 empty x } Img img = scv->createWidget<ImageBox>("ImageBox", x,y, sx,sx, Align::Default, "brI"+s); img->eventMouseButtonClick += newDelegate(this, &CGui::btnBrushPreset); img->setUserString("tip", st.name); img->setNeedToolTip(true); img->setImageTexture("brushes.png"); img->setImageCoord(IntCoord(i%16*z,i/16*z, z,z)); if (!st.name.empty()) img->eventToolTip += newDelegate(gcom, &CGuiCom::notifyToolTip); gcom->setOrigPos(img, "EditorWnd"); Txt txt = scv->createWidget<TextBox>("TextBox", xt,yt, 40,22, Align::Default, "brT"+s); txt->setCaption(fToStr(st.Size,0,2)); int edMode = st.edMode; float fB = app->brClr[edMode][0], fG = app->brClr[edMode][1], fR = app->brClr[edMode][2]; float m = st.Size / 160.f + 0.4f; #define mul(v,m) std::min(1.f, std::max(0.f, v * m)) txt->setTextColour(Colour(mul(fB,m), mul(fG,m), mul(fR,m)) ); gcom->setOrigPos(txt, "EditorWnd"); } //scv->setCanvasSize(1020,j*90+300); /// [Settings] //------------------------------------------------------------------------ sv= &svCamSpeed; sv->Init("CamSpeed", &pSet->cam_speed, 0.1f,4.f); sv->DefaultF(0.9f); sv= &svCamInert; sv->Init("CamInert", &pSet->cam_inert, 0.f, 1.f); sv->DefaultF(0.4f); ck= &ckMinimap; ck->Init("Minimap", &pSet->trackmap); Cev(Minimap); sv= &svSizeMinimap; sv->Init("SizeMinimap", &pSet->size_minimap, 0.15f,2.f); sv->DefaultF(0.55f); Sev(SizeMinimap); sv= &svSizeRoadP; sv->Init("SizeRoadP", &pSet->road_sphr, 0.1f,12.f); sv->DefaultF(1.5f); Sev(SizeRoadP); sv= &svTerUpd; sv->Init("TerUpd", &pSet->ter_skip, 0, 20); sv->DefaultI(1); sv= &svMiniUpd; sv->Init("MiniUpd", &pSet->mini_skip, 0, 20); sv->DefaultI(4); ck= &ckWireframe; ck->Init("Wireframe", &app->mbWireFrame); Cev(Wireframe); ck= &ckCamPos; ck->Init("CamPos", &pSet->camPos); Cev(CamPos); ck= &ckInputBar; ck->Init("InputBar", &pSet->inputBar); Cev(InputBar); ck= &ckAllowSave; ck->Init("AllowSave", &pSet->allow_save); // set camera btns Btn("CamView1", btnSetCam); Btn("CamView2", btnSetCam); Btn("CamView3", btnSetCam); Btn("CamView4", btnSetCam); Btn("CamTop", btnSetCam); Btn("CamLeft", btnSetCam); Btn("CamRight", btnSetCam); Btn("CamFront", btnSetCam); Btn("CamBack", btnSetCam); // startup ck= &ckStartInMain; ck->Init("StartInMain", &pSet->startInMain); ck= &ckAutoStart; ck->Init("AutoStart", &pSet->autostart); ck= &ckEscQuits; ck->Init("EscQuits", &pSet->escquit); ck= &ckOgreDialog; ck->Init("OgreDialog", &pSet->ogre_dialog); ck= &ckMouseCapture;ck->Init("MouseCapture",&pSet->mouse_capture); /// [Sun] //---------------------------------------------------------------------------------------------- sv= &svSunPitch; sv->Init("SunPitch", &sc->ldPitch, 0.f,90.f, 1.f, 1,4); sv->DefaultF(54.f); Sev(UpdSun); sv= &svSunYaw; sv->Init("SunYaw", &sc->ldYaw, -180.f,180.f, 1.f, 1,4); sv->DefaultF(-123.f); Sev(UpdSun); sv= &svRain1Rate; sv->Init("Rain1Rate", &sc->rainEmit, 0.f,6000.f); sv->DefaultF(1000.f); sv= &svRain2Rate; sv->Init("Rain2Rate", &sc->rain2Emit, 0.f,6000.f); sv->DefaultF(1000.f); // fog sv= &svFogStart; sv->Init("FogStart", &sc->fogStart, 0.f,2000.f, 2.f, 0,3); sv->DefaultF(100.f); Sev(UpdFog); sv= &svFogEnd; sv->Init("FogEnd", &sc->fogEnd, 0.f,2000.f, 2.f, 0,3); sv->DefaultF(600.f); Sev(UpdFog); sv= &svFogHStart; sv->Init("FogHStart", &sc->fogHStart, 0.f,2000.f, 2.f, 0,3); sv->DefaultF(0.f); Sev(UpdFog); sv= &svFogHEnd; sv->Init("FogHEnd", &sc->fogHEnd, 0.f,2000.f, 2.f, 0,3); sv->DefaultF(60.f); Sev(UpdFog); sv= &svFogHeight; sv->Init("FogHeight", &sc->fogHeight, -200.f,200.f, 1.f, 1,4); sv->DefaultF(-300.f); Sev(UpdFog); sv= &svFogHDensity; sv->Init("FogHDensity", &sc->fogHDensity, 0.f,200.f, 2.f, 1,4); sv->DefaultF(60.f); Sev(UpdFog); ck= &ckFog; ck->Init("FogDisable", &pSet->bFog); Cev(Fog); ck= &ckWeather; ck->Init("WeatherDisable", &pSet->bWeather); // light Ed(LiAmb, editLiAmb); Ed(LiDiff, editLiDiff); Ed(LiSpec, editLiSpec); Ed(FogClr, editFogClr); Ed(FogClr2, editFogClr2); Ed(FogClrH, editFogClrH); clrAmb = fImg("ClrAmb"); clrDiff = fImg("ClrDiff"); clrSpec= fImg("ClrSpec"); clrTrail= fImg("ClrTrail"); clrFog = fImg("ClrFog"); clrFog2 = fImg("ClrFog2"); clrFogH= fImg("ClrFogH"); //Todo: on click event - open color dialog /// [Terrain] //------------------------------------------------------------------------ imgTexDiff = fImg("TerImgDiff"); Tab(tabsHmap, "TabHMapSize", tabHmap); sv= &svTerErrorNorm; sv->Init("TerErrorNorm", &sc->td.errorNorm, 1.5f,15.f, 1.5f,1,3); sv->DefaultF(3.f); Sev(TerErrorNorm); sv= &svTerNormScale; sv->Init("TerNormScale", &sc->td.normScale, 0.01f,3.f, 1.f, 1,3); sv->DefaultF(1.f); Sev(TerPar); sv= &svTerSpecPow; sv->Init("TerSpecPow", &sc->td.specularPow, 0.2f,128.f,2.f, 1,4); sv->DefaultF(32.f); Sev(TerPar); sv= &svTerSpecPowEm; sv->Init("TerSpecPowEm", &sc->td.specularPowEm, 0.5f,4.f, 1.f, 1,3); sv->DefaultF(2.f); Sev(TerPar); Btn("TerrainNew", btnTerrainNew); Btn("TerrainGenAdd", btnTerGenerate); Btn("TerrainGenSub", btnTerGenerate); Btn("TerrainGenMul", btnTerGenerate); Btn("TerrainHalf", btnTerrainHalf); Btn("TerrainDouble", btnTerrainDouble); Btn("TerrainMove", btnTerrainMove); /// generator . . . . . . . sv= &svTerGenScale; sv->Init("TerGenScale", &pSet->gen_scale, 0.f,160.f, 2.f, 2,4); sv->DefaultF(52.f); sv= &svTerGenOfsX; sv->Init("TerGenOfsX", &pSet->gen_ofsx, -12.f,12.f, 1.f, 3,5); sv->DefaultF(0.14f); Sev(TerGen); sv= &svTerGenOfsY; sv->Init("TerGenOfsY", &pSet->gen_ofsy, -12.f,12.f, 1.f, 3,5); sv->DefaultF(-1.54f); Sev(TerGen); sv= &svTerGenFreq; sv->Init("TerGenFreq", &pSet->gen_freq, 0.06f,3.f, 2.f, 3,5); sv->DefaultF(0.914f); Sev(TerGen); sv= &svTerGenOct; sv->Init("TerGenOct", &pSet->gen_oct, 0, 9); sv->DefaultI(4); Sev(TerGen); sv= &svTerGenPers; sv->Init("TerGenPers", &pSet->gen_persist,0.f, 0.7f, 1.f, 3,5); sv->DefaultF(0.347f); Sev(TerGen); sv= &svTerGenPow; sv->Init("TerGenPow", &pSet->gen_pow, 0.f, 6.f, 2.f, 2,4); sv->DefaultF(1.f); Sev(TerGen); sv= &svTerGenMul; sv->Init("TerGenMul", &pSet->gen_mul, 0.f, 6.f, 2.f, 2,4); sv->DefaultF(1.f); sv= &svTerGenOfsH; sv->Init("TerGenOfsH", &pSet->gen_ofsh, 0.f, 60.f, 2.f, 2,4); sv->DefaultF(0.f); sv= &svTerGenRoadSm;sv->Init("TerGenRoadSm",&pSet->gen_roadsm, 0.f, 6.f, 1.f, 2,4); sv->DefaultF(0.f); sv= &svTerGenAngMin;sv->Init("TerGenAngMin",&pSet->gen_terMinA, 0.f, 90.f, 1.f, 1,4); sv->DefaultF(0.f); sv= &svTerGenAngMax;sv->Init("TerGenAngMax",&pSet->gen_terMaxA, 0.f, 90.f, 1.f, 1,4); sv->DefaultF(90.f); sv= &svTerGenAngSm; sv->Init("TerGenAngSm", &pSet->gen_terSmA, 0.f, 90.f, 2.f, 1,4); sv->DefaultF(10.f); sv= &svTerGenHMin; sv->Init("TerGenHMin", &pSet->gen_terMinH,-150.f,150.f, 1.f, 0,1); sv->DefaultF(-300.f); sv= &svTerGenHMax; sv->Init("TerGenHMax", &pSet->gen_terMaxH,-150.f,150.f, 1.f, 0,1); sv->DefaultF( 300.f); sv= &svTerGenHSm; sv->Init("TerGenHSm", &pSet->gen_terSmH, 0.f, 100.f, 2.f, 1,4); sv->DefaultF(20.f); /// [Layers] ------------------------------------ bool b; ck= &ckTerLayOn; ck->Init("TerLayOn", &b); Cev(TerLayOn); valTerLAll = fTxt("TerLayersAll"); valTriplAll = fTxt("TerTriplAll"); Tab(tabsTerLayers, "TabTerLay", tabTerLayer); Btn("UpdateLayers", btnUpdateLayers); ck= &ckTexNormAuto; ck->Init("TexNormAuto", &bTexNormAuto); ck= &ckTerLayTripl; ck->Init("TerLayTripl", &b); Cev(TerLayTripl); ck= &ckDebugBlend; ck->Init("DebugBlend", &bDebugBlend); Cev(DebugBlend); dbgLclr = fImg("dbgTerLclr"); float f=0.f; i=0; // temp vars // ter layer sv= &svTerTriSize; sv->Init("TerTriSize", &sc->td.fTriangleSize, 0.5f,3.f, 1.f); sv->DefaultF(1.4f); Sev(TerTriSize); sv= &svTerLScale; sv->Init("TerLScale", &f, 6.0f, 72.f, 2.f); sv->DefaultF(8.f); //Sev(TerLay); // blendmap sv= &svTerLAngMin; sv->Init("TerLAngMin", &f, 0.f, 90.f, 1.f, 1,4); sv->DefaultF(0.f); Sev(TerLay); sv= &svTerLAngMax; sv->Init("TerLAngMax", &f, 0.f, 90.f, 1.f, 1,4); sv->DefaultF(90.f); Sev(TerLay); sv= &svTerLAngSm; sv->Init("TerLAngSm", &f, 0.f, 90.f, 2.f, 1,4); sv->DefaultF(20.f); Sev(TerLay); sv= &svTerLHMin; sv->Init("TerLHMin", &f,-150.f,150.f, 1.f, 0,2); sv->DefaultF(-300.f); Sev(TerLay); sv= &svTerLHMax; sv->Init("TerLHMax", &f,-150.f,150.f, 1.f, 0,2); sv->DefaultF( 300.f); Sev(TerLay); sv= &svTerLHSm; sv->Init("TerLHSm", &f, 0.f, 100.f, 2.f, 1,4); sv->DefaultF(20.f); Sev(TerLay); Btn("TerLmoveL", btnTerLmoveL); Btn("TerLmoveR", btnTerLmoveR); // noise ck= &ckTerLNOnly; ck->Init("TerLNonly", &b); Cev(TerLNOnly); sv= &svTerLNoise; sv->Init("TerLNoise", &f, 0.f,1.f); sv->DefaultF(0.f); Sev(TerLay); sv= &svTerLNprev; sv->Init("TerLNprev", &f, 0.f,1.f); sv->DefaultF(0.f); Sev(TerLay); sv= &svTerLNnext2; sv->Init("TerLNnext2", &f, 0.f,1.f); sv->DefaultF(0.f); Sev(TerLay); // noise params for (i=0; i<2; ++i) { String s = toStr(i+1); sv= &svTerLN_Freq[i]; sv->Init("TerLNFreq"+s, &f, 1.f,300.f, 2.f, 1,3); sv->DefaultF(30.f); Sev(TerLay); sv= &svTerLN_Oct[i]; sv->Init("TerLNOct" +s, &i, 1,5); sv->DefaultI(3); Sev(TerLay); sv= &svTerLN_Pers[i]; sv->Init("TerLNPers"+s, &f, 0.1f, 0.7f, 1.f, 3,5); sv->DefaultF(0.3f); Sev(TerLay); sv= &svTerLN_Pow[i]; sv->Init("TerLNPow" +s, &f, 0.2f, 8.f, 2.f); sv->DefaultF(1.f); Sev(TerLay); } // noise btns Btn("TerLNbtn1", radN1); bRn1 = btn; bRn1->setStateSelected(true); Btn("TerLNbtn2", radN2); bRn2 = btn; for (i=0; i < 15; ++i) { Btn("TerLN_"+toStr(i), btnNpreset); } Btn("TerLNrandom", btnNrandom); Btn("TerLNswap", btnNswap); // particles Ed(LDust, editLDust); Ed(LDustS, editLDust); Ed(LMud, editLDust); Ed(LSmoke, editLDust); Ed(LTrlClr, editLTrlClr); Cmb(cmbParDust, "CmbParDust", comboParDust); Cmb(cmbParMud, "CmbParMud", comboParDust); Cmb(cmbParSmoke,"CmbParSmoke",comboParDust); // surface Cmb(cmbSurface, "Surface", comboSurface); //1 txt- txtSuBumpWave = fTxt("SuBumpWave"); txtSuFrict = fTxt("SuFrict"); txtSuBumpAmp = fTxt("SuBumpAmp"); txtSurfTire = fTxt("SurfTire"); txtSuRollDrag = fTxt("SuRollDrag"); txtSurfType = fTxt("SurfType"); SldUpd_TerL(); /// [Vegetation] ------------------------------------ sv= &svGrassDens; sv->Init("GrassDens", &sc->densGrass, 0.f, 1.f, 2.f); sv->DefaultF(0.2f); sv= &svTreesDens; sv->Init("TreesDens", &sc->densTrees, 0.f, 3.f, 2.f); sv->DefaultF(0.3f); Ed(GrPage, editTrGr); Ed(GrDist, editTrGr); Ed(TrPage, editTrGr); Ed(TrDist, editTrGr); Ed(TrImpDist, editTrGr); sv= &svTrRdDist; sv->Init("TrRdDist", &sc->trRdDist, 0,6); sv->DefaultI(1); sv= &svGrDensSmooth;sv->Init("GrDensSmooth",&sc->grDensSmooth, 0,10); sv->DefaultI(3); Ed(SceneryId, editTrGr); // veget models ck= &ckPgLayOn; ck->Init("LTrEnabled", &b); Cev(PgLayOn); valLTrAll = fTxt("LTrAll"); Tab(tabsPgLayers, "LTrNumTab", tabPgLayers); Btn("UpdateVeget", btnUpdateVeget); sv= &svLTrDens; sv->Init("LTrDens", &f, 0.f, 1.f, 2.f, 3,5); sv->DefaultF(0.15f); sv= &svLTrRdDist; sv->Init("LTrRdDist", &i, 0,20); sv->DefaultI(0); sv= &svLTrRdDistMax;sv->Init("LTrRdDistMax", &i, 0,20); sv->DefaultI(20); sv= &svLTrMinSc; sv->Init("LTrMinSc", &f, 0.f,4.f, 3.f, 3,5); sv->DefaultF(0.7f); Sev(LTrSc); sv= &svLTrMaxSc; sv->Init("LTrMaxSc", &f, 0.f,4.f, 3.f, 3,5); sv->DefaultF(1.2f); Sev(LTrSc); sv= &svLTrWindFx; sv->Init("LTrWindFx", &f, 0.f,12.f, 3.f, 3,5); sv->DefaultF(0.5f); sv= &svLTrWindFy; sv->Init("LTrWindFy", &f, 0.f,0.4f, 3.f, 3,5); sv->DefaultF(0.06f); sv= &svLTrMaxTerAng;sv->Init("LTrMaxTerAng", &f, 0.f,90.f, 2.f, 1,4); sv->DefaultF(30.f); sv= &svLTrMinTerH; sv->Init("LTrMinTerH", &f,-60.f,60.f, 1.f, 1,4); sv->DefaultF(-100.f); sv= &svLTrMaxTerH; sv->Init("LTrMaxTerH", &f, 0.f,120.f, 1.f, 1,4); sv->DefaultF( 100.f); sv= &svLTrFlDepth; sv->Init("LTrFlDepth", &f, 0.f,5.f, 2.f, 1,4); sv->DefaultF(0.f); SldUpd_PgL(); // real &f set here txVCnt = fTxt("LTrInfCnt"); txVHmin = fTxt("LTrInfHmin"); txVHmax = fTxt("LTrInfHmax"); txVWmin = fTxt("LTrInfWmin"); txVWmax = fTxt("LTrInfWmax"); /// Grass ------------------------------------ Ed(GrSwayDistr, editTrGr); Ed(GrSwayLen, editTrGr); Ed(GrSwaySpd, editTrGr); imgGrass = fImg("ImgGrass"); imgGrClr = fImg("ImgGrClr"); Cmb(cmbGrassClr, "CmbGrClr", comboGrassClr); // grass channels sv= &svGrChAngMin; sv->Init("GrChMinA", &f, 0.f,90.f, 1.f, 1,4); sv->DefaultF(30.f); sv= &svGrChAngMax; sv->Init("GrChMaxA", &f, 0.f,90.f, 1.f, 1,4); sv->DefaultF(30.f); sv= &svGrChAngSm; sv->Init("GrChSmA", &f, 0.f,50.f, 2.f, 1,4); sv->DefaultF(20.f); sv= &svGrChHMin; sv->Init("GrChMinH", &f,-60.f,60.f, 1.f, 1,4); sv->DefaultF(-200.f); sv= &svGrChHMax; sv->Init("GrChMaxH", &f, 0.f,120.f, 1.f, 1,4); sv->DefaultF( 200.f); sv= &svGrChHSm; sv->Init("GrChSmH", &f, 0.f,60.f, 2.f, 1,4); sv->DefaultF(20.f); sv= &svGrChRdPow; sv->Init("GrChRdPow", &f, -8.f, 8.f, 1.f, 1,4); sv->DefaultF(0.f); // noise sv= &svGrChNoise; sv->Init("GrChNoise", &f, 0.f,2.f, 1.f, 1,4); sv->DefaultF(0.f); sv= &svGrChNfreq; sv->Init("GrChNFreq", &f, 1.f,300.f, 2.f, 1,3); sv->DefaultF(30.f); sv= &svGrChNoct; sv->Init("GrChNOct", &i, 1,5); sv->DefaultI(3); sv= &svGrChNpers; sv->Init("GrChNPers", &f, 0.1f, 0.7f, 1.f, 3,5); sv->DefaultF(0.3f); sv= &svGrChNpow; sv->Init("GrChNPow", &f, 0.2f, 8.f, 2.f); sv->DefaultF(1.f); Tab(tabsGrChan, "GrChanTab", tabGrChan); SldUpd_GrChan(); // grass layers ck= &ckGrLayOn; ck->Init("LGrEnabled", &b); Cev(GrLayOn); valLGrAll = fTxt("LGrAll"); Tab(tabsGrLayers, "LGrLayTab", tabGrLayers); Btn("UpdateGrass", btnUpdateGrass); sv= &svGrMinX; sv->Init("GrMinX", &f, 0.5f,4.f, 1.5f); sv->DefaultF(1.2f); sv= &svGrMaxX; sv->Init("GrMaxX", &f, 0.5f,4.1, 1.5f); sv->DefaultF(1.6f); sv= &svGrMinY; sv->Init("GrMinY", &f, 0.5f,4.f, 1.5f); sv->DefaultF(1.2f); sv= &svGrMaxY; sv->Init("GrMaxY", &f, 0.5f,4.f, 1.5f); sv->DefaultF(1.6f); sv= &svGrChan; sv->Init("LGrChan", &i, 0,3); sv->DefaultI(0); sv= &svLGrDens; sv->Init("LGrDens", &f, 0.001f,1.f, 2.f, 3,5); sv->DefaultF(0.22f); SldUpd_GrL(); /// [Road] ------------------------------------ sv= &svRdTcMul; sv->Init("RdTcMul", &f, 0.01f,0.3f, 1.5f, 3,5); sv->DefaultF(0.1f); sv= &svRdTcMulW; sv->Init("RdTcMulW", &f, 0.01f,0.4f, 1.5f, 3,5); sv->DefaultF(0.1f); sv= &svRdTcMulP; sv->Init("RdTcMulP", &f, 0.01f,0.3f, 1.5f, 3,5); sv->DefaultF(0.2f); sv= &svRdTcMulPW; sv->Init("RdTcMulPW", &f, 0.01f,0.4f, 1.5f, 3,5); sv->DefaultF(0.2f); sv= &svRdTcMulC; sv->Init("RdTcMulC", &f, 0.01f,0.4f, 1.5f, 3,5); sv->DefaultF(0.2f); sv= &svRdLenDim; sv->Init("RdLenDim", &f, 0.5f, 4.f, 1.5f, 2,4); sv->DefaultF(1.f); sv= &svRdWidthSteps;sv->Init("RdWidthSteps",&i, 3,16, 1.5f); sv->DefaultI(6); sv= &svRdPlsM; sv->Init("RdPlsM", &f, 1.f, 8.f, 1.5f, 1,3); sv->DefaultF(1.f); sv= &svRdPwsM; sv->Init("RdPwsM", &f, 1.f, 8.f, 1.5f, 1,3); sv->DefaultF(4.f); sv= &svRdColN; sv->Init("RdColN", &i, 3,16, 1.5f); sv->DefaultI(4); sv= &svRdColR; sv->Init("RdColR", &f, 1.0f, 6.f, 1.5f, 2,4); sv->DefaultF(2.f); sv= &svRdMergeLen; sv->Init("RdMergeLen", &f, 40.f, 2000.f, 2.f, 0,2); sv->DefaultF(400.f); sv= &svRdLodPLen; sv->Init("RdLodPLen", &f, 10.f, 160.f, 2.f, 0,2); sv->DefaultF(20.f); SldUpd_Road(); Ed(RdHeightOfs, editRoad); Ed(RdSkirtLen, editRoad); Ed(RdSkirtH, editRoad); /// [Game] ------------------------------------ sv= &svDamage; sv->Init("DamageMul", &sc->damageMul, 0.f,2.f, 1.f, 2,4); sv->DefaultF(1.f); sv= &svWind; sv->Init("WindAmt", &sc->windAmt, -6.f,6.f, 1.0f, 2,5); sv->DefaultF(0.f); sv= &svGravity; sv->Init("Gravity", &sc->gravity, 2.f,20.f, 1.5f, 2,4); sv->DefaultF(9.81f); ck= &ckDenyReversed; ck->Init("DenyReversed", &sc->denyReversed); ck= &ckTiresAsphalt; ck->Init("TiresAsphalt", &sc->asphalt); ck= &ckTerrainEmissive; ck->Init("TerrainEmissive", &sc->td.emissive); /// [Tools] ------------------------------------ Btn("TrackCopySel", btnTrkCopySel); valTrkCpySel = fTxt("TrkCopySelName"); Btn("CopySun", btnCopySun); Btn("CopyTerHmap", btnCopyTerHmap); Btn("CopyTerLayers", btnCopyTerLayers); Btn("CopyVeget", btnCopyVeget); Btn("CopyRoad", btnCopyRoad); Btn("CopyRoadPars", btnCopyRoadPars); Btn("DeleteRoad", btnDeleteRoad); Btn("DeleteFluids", btnDeleteFluids); Btn("DeleteObjects", btnDeleteObjects); sv= &svScaleAllMul; sv->Init("ScaleAllMul", &fScale, 0.5f,2.f, 1.5f); sv->DefaultF(1.f); sv= &svScaleTerHMul; sv->Init("ScaleTerHMul", &fScaleTer, 0.5f,2.f, 1.5f); sv->DefaultF(1.f); Btn("ScaleAll", btnScaleAll); Btn("ScaleTerH", btnScaleTerH); sv= &svAlignWidthAdd; sv->Init("AlignWidthAdd", &pSet->al_w_add, 0.f,20.f,1.f, 1,3); sv->DefaultF(10.f); sv= &svAlignWidthMul; sv->Init("AlignWidthMul", &pSet->al_w_mul, 1.f,4.f, 1.f, 2,4); sv->DefaultF(1.f); sv= &svAlignSmooth; sv->Init("AlignSmooth", &pSet->al_smooth, 0.f,6.f, 1.f, 1,3); sv->DefaultF(3.f); /// [Warnings] ------------------------------------ edWarn = fEd("Warnings"); txWarn = mGui->createWidget<TextBox>("TextBox", 300,20, 360,32, Align::Default, "Back"); txWarn->setTextShadow(true); txWarn->setTextShadowColour(Colour::Black); txWarn->setTextColour(Colour(1.0,0.4,0.2)); txWarn->setFontHeight(24); txWarn->setVisible(false); imgWarn = fImg("ImgWarn"); imgWarn->setVisible(false); imgInfo = fImg("ImgInfo"); ck= &ckCheckSave; ck->Init("CheckSave", &pSet->check_save); ck= &ckCheckLoad; ck->Init("CheckLoad", &pSet->check_load); Btn("CheckScId", btnCheckScId); /// Fill Combo boxes . . . . . . . //------------------------------------------------------------------------------------------------------------ //--------------------- Skies --------------------- Cmb(cmbSky, "SkyCombo", comboSky); std::string sData = PATHMANAGER::Data(); String sMat = sData +"/materials/scene/"; // path GetMaterialsMat(sMat+"sky.mat"); for (size_t i=0; i < vsMaterials.size(); ++i) { const String& s = vsMaterials[i]; if (s != "" && s != "base_sky") cmbSky->addItem(s); //LogO(s); } //--------------------- Weather --------------------- Cmb(cmbRain1, "Rain1Cmb", comboRain1); cmbRain1->addItem(""); Cmb(cmbRain2, "Rain2Cmb", comboRain2); cmbRain2->addItem(""); GetMaterials("weather.particle", true, "particle_system"); for (size_t i=0; i < vsMaterials.size(); ++i) { const String& s = vsMaterials[i]; cmbRain1->addItem(s); cmbRain2->addItem(s); } //--------------------- Terrain --------------------- Cmb(cmbTexNorm, "TexNormal", comboTexNorm); cmbTexNorm->addItem("flat_n.png"); strlist li; PATHMANAGER::DirList(sData + (pSet->tex_size > 0 ? "/terrain" : "/terrain_s"), li); for (strlist::iterator i = li.begin(); i != li.end(); ++i) { String s = *i; if (StringUtil::match(*i, "*_n.*", false)) cmbTexNorm->addItem(*i); //else //if (StringUtil::match(*i, "*_d.*", false)) //_T // cmbTexDiff->addItem(*i); } // particles GetMaterials("tires.particle", true, "particle_system"); for (size_t i=0; i < vsMaterials.size(); ++i) { const String& s = vsMaterials[i]; cmbParDust->addItem(s); cmbParMud->addItem(s); cmbParSmoke->addItem(s); } // surfaces for (size_t i=0; i < app->surfaces.size(); ++i) cmbSurface->addItem(app->surfaces[i].name); //--------------------- Grass --------------------- PATHMANAGER::DirList(sData + "/grass", li); for (strlist::iterator i = li.begin(); i != li.end(); ++i) { if (StringUtil::startsWith(*i, "grClr", false)) cmbGrassClr->addItem(*i); } //--------------------- Roads --------------------- GetMaterialsMat(sMat+"road.mat"); GetMaterialsMat(sMat+"pipe.mat",false); for (size_t i=0; i<4; ++i) { Cmb(cmbPipeMtr[i], "RdMtrP"+toStr(i+1), comboPipeMtr); if (i>0) { cmbPipeMtr[i]->addItem(""); } } Cmb(cmbRoadWMtr, "RdMtrW1", comboRoadWMtr); Cmb(cmbPipeWMtr, "RdMtrPW1", comboPipeWMtr); Cmb(cmbRoadColMtr, "RdMtrC1", comboRoadColMtr); for (size_t i=0; i < vsMaterials.size(); ++i) { String s = vsMaterials[i]; if (StringUtil::startsWith(s,"pipe") && !StringUtil::startsWith(s,"pipe_")) for (int n=0; n<4; ++n) cmbPipeMtr[n]->addItem(s); if (StringUtil::startsWith(s,"road_wall")) cmbRoadWMtr->addItem(s); if (StringUtil::startsWith(s,"pipe_wall")) cmbPipeWMtr->addItem(s); if (StringUtil::startsWith(s,"road_col")) cmbRoadColMtr->addItem(s); } //--------------------- Objects --------------------- app->vObjNames.clear(); strlist lo; PATHMANAGER::DirList(sData + "/objects", lo); for (strlist::iterator i = lo.begin(); i != lo.end(); ++i) if (StringUtil::endsWith(*i,".mesh") && !StringUtil::startsWith(*i,"sphere")) app->vObjNames.push_back((*i).substr(0,(*i).length()-5)); //no .ext objListDyn = fLi("ObjListDyn"); Lev(objListDyn, ObjsChng); objListSt = fLi("ObjListSt"); Lev(objListSt, ObjsChng); objListRck = fLi("ObjListRck"); Lev(objListRck, ObjsChng); objListBld = fLi("ObjListBld"); Lev(objListBld, ObjsChng); objPan = fWP("objPan"); for (int i=0; i < app->vObjNames.size(); ++i) { const std::string& name = app->vObjNames[i]; if (name != "sphere") { if (StringUtil::startsWith(name,"pers_",false)) objListBld->addItem("#E0E070"+name); // buildings else if (StringUtil::startsWith(name,"rock",false)||StringUtil::startsWith(name,"cave",false)) objListRck->addItem("#E0B070"+name); // rocks else if (boost::filesystem::exists(sData+"/objects/"+ name + ".bullet")) objListDyn->addItem("#A0E0FF"+name); // dynamic else objListSt->addItem("#C8C8C8"+name); } } //objList->setIndexSelected(0); //objList->findItemIndexWith(modeSel) //--------------------- Surfaces --------------------- surfList = fLi("SurfList"); Lev(surfList, Surf); for (n=0; n < 4; ++n) surfList->addItem("#80FF00"+TR("#{Layer} ")+toStr(n)); for (n=0; n < 4; ++n) surfList->addItem("#FFB020"+TR("#{Road} ")+toStr(n)); for (n=0; n < 4; ++n) surfList->addItem("#FFFF80"+TR("#{Pipe} ")+toStr(n)); surfList->setIndexSelected(0); //--------------------- Tweak --------------------- ComboBoxPtr cmbTwk; Cmb(cmbTwk, "TweakMtr", comboTweakMtr); GetMaterialsMat(sData +"/materials/water.mat"); GetMaterialsMat(sMat+"pipe.mat",false); GetMaterialsMat(sMat+"road.mat",false); GetMaterialsMat(sMat+"objects_static.mat",false); cmbTwk->addItem(""); for (size_t i=0; i < vsMaterials.size(); ++i) { String s = vsMaterials[i]; cmbTwk->addItem(s); } cmbTwk->setIndexSelected( cmbTwk->findItemIndexWith(pSet->tweak_mtr) ); /// [Pick window] ///------------------------------------------------------------------------------------------------------------ // Pick btns Btn("PickTex", btnPickTex); btn->eventMouseWheel += newDelegate(this, &CGui::wheelTex); btnTexDiff = btn; Btn("PickGrass", btnPickGrass); btn->eventMouseWheel += newDelegate(this, &CGui::wheelGrs); btnGrassMtr = btn; Btn("PickVeget", btnPickVeget); btn->eventMouseWheel += newDelegate(this, &CGui::wheelVeg); btnVeget = btn; for (n=0; n < 4; ++n) { Btn("RdMtr"+toStr(n+1), btnPickRoad); btnRoad[n] = btn; } ck= &ckPickSetPar; ck->Init("PickSetPar", &pSet->pick_setpar); panPick = fWP("PanelPick"); // todo: pick filter sceneries .. //const char sc[17]="TJSFGWIADCVUMOER"; //chk "Pick"+sc[i] //"PickRadAll" "PickRadCur" "PickRadFilter" /// Tex Diff -------- Mli2 lp; int l; lp = app->mWndPick->createWidget<MultiList2>("MultiListBox",8,8,400,800, Align::Left | Align::VStretch); liTex = lp; lp->eventListChangePosition += newDelegate(this, &CGui::listPickTex); lp->setColour(Colour(0.8,0.9,0.7)); lp->setInheritsAlpha(false); lp->removeAllColumns(); lp->removeAllItems(); lp->addColumn("#90C0F0", 25); //+TR("#{Scenery}") lp->addColumn("#E0FFE0"+TR("#{Diffuse}"), 160); ///pick dim lp->addColumn("#80FF80"+TR("#{Scale}"), 40); //lp->addColumn("#80FF80/", 40); lp->addColumn("#80FF80|"/*+TR("#{HighestSlopes}")*/, 27); lp->addColumn(" ", 20); liPickW[0] = 280; for (i=0; i < data->pre->ter.size(); ++i) { const PTer& t = data->pre->ter[i]; String c = gcom->scnClr[gcom->scnN[t.sc]]; if (c.empty()) c = "#000000"; lp->addItem(c+ t.sc, 0); l = lp->getItemCount()-1; lp->setSubItemNameAt(1,l, c+ t.texFile.substr(0, t.texFile.length()-2)); // no _d lp->setSubItemNameAt(2,l, c+ fToStr( t.tiling, 0,2)); //1,3 //lp->setSubItemNameAt(3,l, c+ fToStr( t.angMin, 0,2)); lp->setSubItemNameAt(3,l, c+ (t.triplanar?"1":"0")); } /// Grass -------- lp = app->mWndPick->createWidget<MultiList2>("MultiListBox",8,8,400,800, Align::Left | Align::VStretch); liGrs = lp; lp->eventListChangePosition += newDelegate(this, &CGui::listPickGrs); lp->setColour(Colour(0.7,0.9,0.7)); lp->setInheritsAlpha(false); lp->removeAllColumns(); lp->removeAllItems(); lp->addColumn("#90C0F0", 25); lp->addColumn("#E0FFE0"+TR("#{GrMaterial}"), 152); //lp->addColumn("#E0FFE0"+TR("#{GrColorMap}"), 120); lp->addColumn(" ", 20); liPickW[1] = 205; for (i=0; i < data->pre->gr.size(); ++i) { const PGrass& t = data->pre->gr[i]; String c = gcom->scnClr[gcom->scnN[t.sc]]; if (c.empty()) c = "#000000"; lp->addItem(c+ t.sc, 0); l = lp->getItemCount()-1; lp->setSubItemNameAt(1,l, c+ t.mtr); //lp->setSubItemNameAt(2,l, c+ t.clr.substr(5)); } /// Veget -------- lp = app->mWndPick->createWidget<MultiList2>("MultiListBox",8,8,400,800, Align::Left | Align::VStretch); liVeg = lp; lp->eventListChangePosition += newDelegate(this, &CGui::listPickVeg); lp->setColour(Colour(0.7,0.9,0.9)); lp->setInheritsAlpha(false); lp->removeAllColumns(); lp->removeAllItems(); lp->addColumn("#90C0F0", 25); lp->addColumn("#E0FFE0"+TR("#{Model}"), 157); lp->addColumn("#80E0E0"+TR("#{MaxScale}"), 40); lp->addColumn("#80E080/"/*+TR("#{AngleMax}")*/, 30); lp->addColumn(" ", 20); liPickW[2] = 280; for (i=0; i < data->pre->veg.size(); ++i) { const PVeget& t = data->pre->veg[i]; String c = gcom->scnClr[gcom->scnN[t.sc]]; if (c.empty()) c = "#000000"; lp->addItem(c+ t.sc, 0); l = lp->getItemCount()-1; lp->setSubItemNameAt(1,l, c+ t.name); //lp->setSubItemNameAt(2,l, c+ fToStr( t.minScale, 1,3)); lp->setSubItemNameAt(2,l, c+ fToStr( t.maxScale, 1,3)); lp->setSubItemNameAt(3,l, c+ fToStr( t.maxTerAng, 0,2)); } /// Road -------- lp = app->mWndPick->createWidget<MultiList2>("MultiListBox",8,8,400,800, Align::Left | Align::VStretch); liRd = lp; lp->eventListChangePosition += newDelegate(this, &CGui::listPickRd); lp->setColour(Colour(0.9,0.8,0.7)); lp->setInheritsAlpha(false); lp->removeAllColumns(); lp->removeAllItems(); lp->addColumn("#90C0F0", 25); lp->addColumn("#FFE0D0"+TR("#{GrMaterial}"), 157); lp->addColumn("#80E0E0"+TR("#{Surface}"), 80); lp->addColumn(" ", 20); liPickW[3] = 280; lp->addItem("#102030J", 0); lp->setSubItemNameAt(1,0, "#102030"); // "" for (i=0; i < data->pre->rd.size(); ++i) { const PRoad& t = data->pre->rd[i]; String c = gcom->scnClr[gcom->scnN[t.sc]]; if (c.empty()) c = "#000000"; lp->addItem(c+ t.sc, 0); l = lp->getItemCount()-1; lp->setSubItemNameAt(1,l, c+ t.mtr); String su = t.surfName; if (su.substr(0,4)=="road") su = su.substr(4, su.length()); lp->setSubItemNameAt(2,l, c+ su); } // todo: sort,filter pick lists.. //lp->mSortColumnIndex = pSet->tracks_sort; //lp->mSortUp = pSet->tracks_sortup; //TrackListUpd(true); //upd //listTrackChng(trkList,0); /// [Track] //------------------------------------------------------------------------ gcom->sListTrack = pSet->gui.track; //! set last gcom->bListTrackU = pSet->gui.track_user; sCopyTrack = ""; //! none bCopyTrackU = 0; // text desc Edt(gcom->trkDesc[0], "TrackDesc", editTrkDesc); trkName = fEd("TrackName"); if (trkName) trkName->setCaption(pSet->gui.track); gcom->GuiInitTrack(); // btn new, rename, delete Btn("TrackNew", btnTrackNew); Btn("TrackRename", btnTrackRename); Btn("TrackDelete", btnTrackDel); // load = new game for (int i=1; i<=2; ++i) { Btn("NewGame"+toStr(i), btnNewGame); } CreateGUITweakMtr(); /// 3d view [] (veget models, objects) //-------------------------------------------- //rndCanvas = mGUI->findWidget<Canvas>("CanVeget"); //? viewCanvas = app->mWndEdit->createWidget<Canvas>("Canvas", GetViewSize(), Align::Stretch); viewCanvas->setInheritsAlpha(false); viewCanvas->setPointer("hand"); viewCanvas->setVisible(false); viewBox->setCanvas(viewCanvas); viewBox->setBackgroundColour(Colour(0.32,0.35,0.37,0.7)); viewBox->setAutoRotation(true); viewBox->setMouseRotation(true); bGI = true; // gui inited, gui events can now save vals LogO(String("::: Time Init Gui: ") + fToStr(ti.getMilliseconds(),0,3) + " ms"); }