本文整理汇总了C++中Starshatter类的典型用法代码示例。如果您正苦于以下问题:C++ Starshatter类的具体用法?C++ Starshatter怎么用?C++ Starshatter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Starshatter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
void
CameraDirector::SetViewObjectGroup(ListIter<Ship> group, bool quick)
{
if (!ship) return;
Starshatter* stars = Starshatter::GetInstance();
if (!stars->InCutscene()) {
// only view solid contacts:
while (++group) {
Ship* s = group.value();
if (s->GetIFF() != ship->GetIFF()) {
Contact* c = ship->FindContact(s);
if (!c || !c->ActLock())
return;
}
if (s->Life() == 0 || s->IsDying() || s->IsDead())
return;
}
}
group.reset();
if (external_group.size() > 1 &&
external_group.size() == group.size()) {
bool same = true;
for (int i = 0; same && i < external_group.size(); i++) {
if (external_group[i] != group.container()[i])
same = false;
}
if (same) {
SetMode(MODE_ZOOM);
return;
}
}
ClearGroup();
if (quick) {
mode = MODE_ORBIT;
transition = 0;
}
else {
SetMode(MODE_TRANSLATE);
}
external_group.append(group.container());
ListIter<Ship> iter = external_group;
while (++iter) {
Ship* s = iter.value();
region = s->GetRegion();
Observe(s);
}
}
示例2:
void
KeyDlg::OnApply(AWEvent* event)
{
Starshatter* stars = Starshatter::GetInstance();
if (stars) {
KeyMap& keymap = stars->GetKeyMap();
KeyMapEntry* map = keymap.GetKeyMap(key_index);
if (key_clear) {
map->key = 0;
map->alt = 0;
map->joy = 0;
}
if (key_key) {
map->key = key_key;
map->alt = key_shift;
}
if (key_joy) {
map->joy = key_joy;
}
}
if (manager)
manager->ShowCtlDlg();
}
示例3:
void
JoyDlg::OnApply(AWEvent* event)
{
Starshatter* stars = Starshatter::GetInstance();
if (stars) {
KeyMap& keymap = stars->GetKeyMap();
keymap.Bind(KEY_AXIS_YAW, map_axis[0]+KEY_JOY_AXIS_X, 0);
keymap.Bind(KEY_AXIS_PITCH, map_axis[1]+KEY_JOY_AXIS_X, 0);
keymap.Bind(KEY_AXIS_ROLL, map_axis[2]+KEY_JOY_AXIS_X, 0);
keymap.Bind(KEY_AXIS_THROTTLE, map_axis[3]+KEY_JOY_AXIS_X, 0);
keymap.Bind(KEY_AXIS_YAW_INVERT, invert_checkbox[0]->GetButtonState(), 0);
keymap.Bind(KEY_AXIS_PITCH_INVERT, invert_checkbox[1]->GetButtonState(), 0);
keymap.Bind(KEY_AXIS_ROLL_INVERT, invert_checkbox[2]->GetButtonState(), 0);
keymap.Bind(KEY_AXIS_THROTTLE_INVERT, invert_checkbox[3]->GetButtonState(), 0);
keymap.SaveKeyMap("key.cfg", 256);
stars->MapKeys();
}
if (manager)
manager->ShowCtlDlg();
}
示例4:
void
CmpLoadDlg::ExecFrame()
{
Starshatter* stars = Starshatter::GetInstance();
if (stars) {
if (lbl_activity) lbl_activity->SetText(stars->GetLoadActivity());
if (lbl_progress) lbl_progress->SetValue(stars->GetLoadProgress());
}
}
示例5:
void
ExitDlg::OnApply(AWEvent* event)
{
Starshatter* stars = Starshatter::GetInstance();
if (stars) {
::Print("Exit Confirmed.\n");
stars->Exit();
}
}
示例6: if
void
CmpSceneDlg::Show()
{
FormWindow::Show();
Starshatter* stars = Starshatter::GetInstance();
if (stars->InCutscene()) {
Sim* sim = Sim::GetSim();
if (sim) {
cam_view->UseCamera(CameraDirector::GetInstance()->GetCamera());
cam_view->UseScene(sim->GetScene());
}
// initialize lens flare bitmaps:
if (stars->LensFlare()) {
cam_view->LensFlareElements(flare1, flare4, flare2, flare3);
cam_view->LensFlare(true);
}
// if lens flare disabled, just create the corona:
else if (stars->Corona()) {
cam_view->LensFlareElements(flare1, 0, 0, 0);
cam_view->LensFlare(true);
}
if (disp_view) {
old_disp_win = disp_view->GetWindow();
disp_view->SetWindow(mov_scene);
mov_scene->AddView(disp_view);
}
if (subtitles_box) {
subtitles_box->SetText(stars->GetSubtitles());
subtitles_delay = 0;
subtitles_time = 0;
}
}
}
示例7: SetFocus
void
KeyDlg::Show()
{
FormWindow::Show();
Starshatter* stars = Starshatter::GetInstance();
if (stars) {
KeyMap& keymap = stars->GetKeyMap();
if (command)
command->SetText(keymap.DescribeAction(key_index));
if (current_key)
current_key->SetText(keymap.DescribeKey(key_index));
}
key_clear = false;
new_key->SetText("");
SetFocus();
}
示例8:
void
CmpSceneDlg::ExecFrame()
{
Starshatter* stars = Starshatter::GetInstance();
Mission* cutscene_mission = stars->GetCutsceneMission();
if (cutscene_mission && disp_view) {
disp_view->ExecFrame();
if (subtitles_box && subtitles_box->GetLineCount() > 0) {
if (subtitles_delay == 0) {
int nlines = subtitles_box->GetLineCount();
MissionEvent* begin_scene = cutscene_mission->FindEvent(MissionEvent::BEGIN_SCENE);
MissionEvent* end_scene = cutscene_mission->FindEvent(MissionEvent::END_SCENE);
if (begin_scene && end_scene) {
double total_time = end_scene->Time() - begin_scene->Time();
subtitles_delay = total_time / nlines;
subtitles_time = Game::RealTime() / 1000.0 + subtitles_delay;
}
else {
subtitles_delay = -1;
}
}
if (subtitles_delay > 0) {
double seconds = Game::RealTime() / 1000.0;
if (subtitles_time <= seconds) {
subtitles_time = seconds + subtitles_delay;
subtitles_box->Scroll(ScrollWindow::SCROLL_DOWN);
}
}
}
}
else {
manager->ShowCmdDlg();
}
}
示例9:
void
DebriefDlg::OnClose(AWEvent* event)
{
Sim* sim = Sim::GetSim();
sim->CommitMission();
sim->UnloadMission();
NetLobby* lobby = NetLobby::GetInstance();
if (lobby && lobby->IsHost()) {
lobby->SelectMission(0);
lobby->ExecFrame();
}
Player* player = Player::GetCurrentPlayer();
if (player && player->ShowAward()) {
manager->ShowAwardDlg();
}
else {
Starshatter* stars = Starshatter::GetInstance();
if (stars) {
Mouse::Show(false);
Campaign* campaign = Campaign::GetCampaign();
if (campaign && campaign->GetCampaignId() < Campaign::SINGLE_MISSIONS)
stars->SetGameMode(Starshatter::CMPN_MODE);
else
stars->SetGameMode(Starshatter::MENU_MODE);
}
else {
Game::Panic("DebriefDlg::OnClose() - Game instance not found");
}
}
}
示例10:
void
LoadScreen::ShowLoadDlg()
{
if (load_dlg) load_dlg->Hide();
if (cmp_load_dlg) cmp_load_dlg->Hide();
Starshatter* stars = Starshatter::GetInstance();
// show campaign load dialog if available and loading campaign
if (stars && cmp_load_dlg) {
if (stars->GetGameMode() == Starshatter::CLOD_MODE ||
stars->GetGameMode() == Starshatter::CMPN_MODE) {
cmp_load_dlg->Show();
Mouse::Show(false);
return;
}
}
// otherwise, show regular load dialog
if (load_dlg) {
load_dlg->Show();
Mouse::Show(false);
}
}
示例11: if
void
LoadDlg::ExecFrame()
{
Starshatter* stars = Starshatter::GetInstance();
if (stars) {
if (title) {
if (stars->GetGameMode() == Starshatter::CLOD_MODE ||
stars->GetGameMode() == Starshatter::CMPN_MODE)
title->SetText(Game::GetText("LoadDlg.campaign"));
else if (stars->GetGameMode() == Starshatter::MENU_MODE)
title->SetText(Game::GetText("LoadDlg.tac-ref"));
else
title->SetText(Game::GetText("LoadDlg.mission"));
}
activity->SetText(stars->GetLoadActivity());
progress->SetValue(stars->GetLoadProgress());
}
}
示例12: WinMain
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow)
{
int result = 0;
int test_mode = 0;
int do_server = 0;
if (strstr(lpCmdLine, "-server"))
ErrLog = fopen("serverlog.txt", "w");
else
ErrLog = fopen("errlog.txt", "w");
PrintLogHeader();
if (strstr(lpCmdLine, "-test")) {
Print(" Request TEST mode\n");
test_mode = 1;
}
if (strstr(lpCmdLine, "-fps")) {
HUDView::ShowFPS(true);
}
if (strstr(lpCmdLine, "-dump")) {
Print(" Request dump dynamic missions\n");
dump_missions = 1;
}
if (strstr(lpCmdLine, "-lan")) {
Print(" Request LAN ONLY mode\n");
NetBrokerClient::Disable();
}
if (strstr(lpCmdLine, "-server")) {
do_server = 1;
Print(" Request Standalone Server Mode\n");
}
char* d3dinfo = strstr(lpCmdLine, "-d3d");
if (d3dinfo) {
int n = d3dinfo[4] - '0';
if (n >= 0 && n <= 5)
VD3D_describe_things = n;
Print(" D3D Info Level: %d\n", VD3D_describe_things);
}
else {
VD3D_describe_things = 0;
}
// FREE VERSION - AUTHORIZATION DISABLED
/*
::Print(" Checking authorization codes...\n");
if (!Authorization::IsUserAuthorized()) {
if (!DataLoader::GetLoader()) {
DataLoader::Initialize();
DataLoader::GetLoader()->EnableDatafile("content.dat");
}
Game* game = new Game();
game->InitContent();
MessageBox(0, FormatTextEscape(Game::GetText("main.auth-invalid")).data(),
Game::GetText("main.title.error").data(), MB_OK);
::Print(" Not authorized.\n");
delete game;
DataLoader::Close();
}
else {
::Print(" Authorized\n");
*/
try {
NetLayer net;
if (do_server) {
StarServer* server = new(__FILE__,__LINE__) StarServer();
if (server->Init(hInstance, hPrevInstance, lpCmdLine, nCmdShow))
result = server->Run();
Print("\n+====================================================================+\n");
Print(" Begin Shutdown...\n");
delete server;
}
else {
Starshatter* stars = 0;
stars = new(__FILE__,__LINE__) Starshatter;
stars->SetTestMode(test_mode);
if (stars->Init(hInstance, hPrevInstance, lpCmdLine, nCmdShow))
result = stars->Run();
Print("\n+====================================================================+\n");
Print(" Begin Shutdown...\n");
//.........这里部分代码省略.........
示例13: Point
void
CameraDirector::SetViewObject(Ship* obj, bool quick)
{
if (!ship) return;
if (!obj) {
obj = ship;
region = ship->GetRegion();
}
external_body = 0;
external_point = Point();
Starshatter* stars = Starshatter::GetInstance();
if (obj->GetIFF() != ship->GetIFF() && !stars->InCutscene()) {
// only view solid contacts:
Contact* c = ship->FindContact(obj);
if (!c || !c->ActLock())
return;
}
if (mode == MODE_TARGET) {
ClearGroup();
if (external_ship) {
external_ship = 0;
}
}
else if (mode >= MODE_ORBIT) {
if (quick) {
mode = MODE_ORBIT;
transition = 0;
}
else {
SetMode(MODE_TRANSLATE);
}
if (external_group.size()) {
ClearGroup();
if (external_ship) {
external_ship = 0;
}
}
else {
if ((obj == external_ship) || (obj==ship && external_ship==0)) {
if (!quick)
SetMode(MODE_ZOOM);
}
else if (external_ship) {
external_ship = 0;
}
}
}
if (external_ship != obj) {
external_ship = obj;
if (external_ship) {
region = external_ship->GetRegion();
if (external_ship->Life() == 0 || external_ship->IsDying() || external_ship->IsDead()) {
external_ship = 0;
range_min = 100;
}
else {
Observe(external_ship);
if (sim)
sim->ActivateRegion(external_ship->GetRegion());
range_min = external_ship->Radius() * 1.5;
}
}
Observe(external_ship);
ExternalRange(1);
}
}
示例14: if
void
QuitView::ExecFrame()
{
sim = Sim::GetSim();
if (show_menu) {
Color::SetFade(1, Color::Black, 0);
int action = 0;
if (Mouse::LButton()) {
mouse_latch = true;
}
else if (mouse_latch) {
mouse_latch = false;
if (Mouse::X() > xcenter - w2 && Mouse::X() < xcenter + w2) {
int y0 = ycenter - h2;
for (int i = 0; i < 4; i++)
if (Mouse::Y() >= y0 + 75 + i * 30 && Mouse::Y() <= y0 + 105 + i * 30)
action = i+1;
}
}
for (int i = 1; i <= 4; i++) {
if (Keyboard::KeyDown('0' + i))
action = i;
}
// was mission long enough to accept?
if (action == 1 && !CanAccept()) {
Button::PlaySound(Button::SND_REJECT);
action = 3;
}
// exit and accept:
if (action == 1) {
CloseMenu();
Game::SetTimeCompression(1);
Starshatter* stars = Starshatter::GetInstance();
stars->SetGameMode(Starshatter::PLAN_MODE);
}
// quit and discard results:
else if (action == 2) {
CloseMenu();
Game::SetTimeCompression(1);
Starshatter* stars = Starshatter::GetInstance();
Campaign* campaign = Campaign::GetCampaign();
// discard mission and events:
if (sim) sim->UnloadMission();
else ShipStats::Initialize();
if (campaign && campaign->GetCampaignId() < Campaign::SINGLE_MISSIONS) {
campaign->RollbackMission();
stars->SetGameMode(Starshatter::CMPN_MODE);
}
else {
stars->SetGameMode(Starshatter::MENU_MODE);
}
}
// resume:
else if (action == 3) {
CloseMenu();
}
// controls:
else if (action == 4) {
GameScreen* game_screen = GameScreen::GetInstance();
if (game_screen)
game_screen->ShowCtlDlg();
else
CloseMenu();
}
}
}
示例15: SetMode
void
CameraDirector::ExecFrame(double seconds)
{
if (!ship)
return;
hud = HUDView::GetInstance();
int flight_phase = ship->GetFlightPhase();
if (flight_phase < Ship::LOCKED)
SetMode(MODE_DOCKING);
if (ship->IsAirborne()) {
if (flight_phase >= Ship::DOCKING)
SetMode(MODE_DOCKING);
}
else {
if (flight_phase >= Ship::RECOVERY)
SetMode(MODE_DOCKING);
}
if (flight_phase >= Ship::LOCKED && flight_phase < Ship::ACTIVE) {
int m = GetMode();
if (m != MODE_COCKPIT && m != MODE_VIRTUAL)
SetMode(MODE_COCKPIT);
}
if (ship->InTransition()) {
SetMode(MODE_DROP);
}
// automatically restore mode after transition:
else if (old_mode != MODE_NONE) {
mode = old_mode;
requested_mode = old_mode;
old_mode = MODE_NONE;
}
int op_mode = mode;
if (requested_mode > mode)
op_mode = requested_mode;
Starshatter* stars = Starshatter::GetInstance();
// if we are in padlock, and have not locked a ship
// try to padlock the current target:
if (op_mode == MODE_TARGET && !external_ship) {
SimObject* tgt = ship->GetTarget();
if (tgt && tgt->Type() == SimObject::SIM_SHIP)
SetViewObject((Ship*) tgt);
}
// if in an external mode, check the external ship:
else if (op_mode >= MODE_TARGET && op_mode <= MODE_ZOOM) {
if (external_ship && external_ship != ship && !stars->InCutscene()) {
Contact* c = ship->FindContact(external_ship);
if (!c || !c->ActLock()) {
SetViewObject(ship);
}
}
}
if (ship->Rep()) {
if (op_mode == MODE_COCKPIT) {
ship->HideRep();
ship->HideCockpit();
}
else if (op_mode == MODE_VIRTUAL || op_mode == MODE_TARGET) {
if (ship->Cockpit()) {
ship->HideRep();
ship->ShowCockpit();
}
else {
ship->ShowRep();
}
}
else {
ship->Rep()->SetForeground(op_mode == MODE_DOCKING);
ship->ShowRep();
ship->HideCockpit();
}
}
if (hud && hud->Ambient() != Color::Black)
sim->GetScene()->SetAmbient( hud->Ambient() );
else
sim->GetScene()->SetAmbient( sim->GetStarSystem()->Ambient() );
switch (op_mode) {
default:
case MODE_COCKPIT: Cockpit(seconds); break;
case MODE_CHASE: Chase(seconds); break;
case MODE_TARGET: Target(seconds); break;
case MODE_THREAT: Threat(seconds); break;
case MODE_VIRTUAL: Virtual(seconds); break;
case MODE_ORBIT:
case MODE_TRANSLATE:
case MODE_ZOOM: Orbit(seconds); break;
case MODE_DOCKING: Docking(seconds); break;
case MODE_DROP: Drop(seconds); break;
//.........这里部分代码省略.........