Added initialization script which is run at startup.
parent
6d96d5d412
commit
7572a45c56
|
@ -56,6 +56,7 @@ CelestiaConfig* ReadCelestiaConfig(string filename)
|
|||
config->faintestVisible = 6.0f;
|
||||
configParams->getNumber("FaintestVisibleMagnitude", config->faintestVisible);
|
||||
configParams->getString("FavoritesFile", config->favoritesFile);
|
||||
configParams->getString("InitScript", config->initScriptFile);
|
||||
configParams->getString("AsterismsFile", config->asterismsFile);
|
||||
configParams->getString("StarDatabase", config->starDatabaseFile);
|
||||
configParams->getString("StarNameDatabase", config->starNamesFile);
|
||||
|
|
|
@ -22,6 +22,7 @@ struct CelestiaConfig
|
|||
std::string asterismsFile;
|
||||
float faintestVisible;
|
||||
std::string favoritesFile;
|
||||
std::string initScriptFile;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -767,7 +767,12 @@ void handleKeyPress(int c)
|
|||
break;
|
||||
|
||||
case 'I':
|
||||
renderer->setCloudMapping(!renderer->getCloudMapping());
|
||||
{
|
||||
bool enabled = !renderer->getCloudMapping();
|
||||
CheckMenuItem(menuBar, ID_RENDER_SHOWATMOSPHERES,
|
||||
enabled ? MF_CHECKED : MF_UNCHECKED);
|
||||
renderer->setCloudMapping(enabled);
|
||||
}
|
||||
break;
|
||||
|
||||
case '/':
|
||||
|
@ -879,7 +884,7 @@ void ChangeSize(GLsizei w, GLsizei h)
|
|||
|
||||
|
||||
GLsizei g_w, g_h;
|
||||
int bReady;
|
||||
bool bReady = false;
|
||||
|
||||
|
||||
void RenderOverlay()
|
||||
|
@ -1012,7 +1017,7 @@ int APIENTRY WinMain(HINSTANCE hInstance,
|
|||
int nCmdShow)
|
||||
{
|
||||
// Say we're not ready to render yet.
|
||||
bReady = 0;
|
||||
bReady = false;
|
||||
|
||||
appInstance = hInstance;
|
||||
|
||||
|
@ -1257,22 +1262,9 @@ int APIENTRY WinMain(HINSTANCE hInstance,
|
|||
}
|
||||
}
|
||||
|
||||
// We're now ready.
|
||||
bReady = 1;
|
||||
|
||||
#if 0
|
||||
// Start out at Mir
|
||||
sim->selectBody("Sol");
|
||||
sim->selectBody("Mir");
|
||||
sim->gotoSelection();
|
||||
sim->setTimeScale(0.0f);
|
||||
sim->update(5.0);
|
||||
sim->setTimeScale(1.0f);
|
||||
sim->follow();
|
||||
#endif
|
||||
|
||||
if (config->initScriptFile != "")
|
||||
{
|
||||
ifstream scriptfile("test.cel");
|
||||
ifstream scriptfile(config->initScriptFile.c_str());
|
||||
CommandParser parser(scriptfile);
|
||||
script = parser.parse();
|
||||
if (script == NULL)
|
||||
|
@ -1280,8 +1272,14 @@ int APIENTRY WinMain(HINSTANCE hInstance,
|
|||
const vector<string>* errors = parser.getErrors();
|
||||
for_each(errors->begin(), errors->end(), printlineFunc<string>(cout));
|
||||
}
|
||||
else
|
||||
{
|
||||
runningScript = new Execution(*script, sim, renderer);
|
||||
}
|
||||
}
|
||||
|
||||
bReady = true;
|
||||
|
||||
// Usual running around in circles bit...
|
||||
int bGotMsg;
|
||||
MSG msg;
|
||||
|
@ -1306,7 +1304,7 @@ int APIENTRY WinMain(HINSTANCE hInstance,
|
|||
}
|
||||
|
||||
// Not ready to render anymore.
|
||||
bReady = 0;
|
||||
bReady = false;
|
||||
|
||||
// Nuke all applicable scene stuff.
|
||||
renderer->shutdown();
|
||||
|
@ -1564,6 +1562,14 @@ LRESULT CALLBACK SkeletonProc(HWND hWnd,
|
|||
showAsterisms ? MF_CHECKED : MF_UNCHECKED);
|
||||
renderer->showAsterisms(showAsterisms ? asterisms : NULL);
|
||||
break;
|
||||
case ID_RENDER_SHOWATMOSPHERES:
|
||||
{
|
||||
bool enabled = !renderer->getCloudMapping();
|
||||
CheckMenuItem(menuBar, ID_RENDER_SHOWATMOSPHERES,
|
||||
enabled ? MF_CHECKED : MF_UNCHECKED);
|
||||
renderer->setCloudMapping(enabled);
|
||||
}
|
||||
break;
|
||||
|
||||
case ID_RENDER_AMBIENTLIGHT_NONE:
|
||||
CheckMenuItem(menuBar, ID_RENDER_AMBIENTLIGHT_NONE, MF_CHECKED);
|
||||
|
|
Loading…
Reference in New Issue