本文整理汇总了C++中Starshatter::GetChatMode方法的典型用法代码示例。如果您正苦于以下问题:C++ Starshatter::GetChatMode方法的具体用法?C++ Starshatter::GetChatMode怎么用?C++ Starshatter::GetChatMode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Starshatter
的用法示例。
在下文中一共展示了Starshatter::GetChatMode方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: menu_rect
//.........这里部分代码省略.........
if (menu) {
Rect menu_rect(width-115, 10, 115, 12);
font->DrawText(menu->GetTitle(), 0, menu_rect, DT_CENTER);
menu_rect.y += 15;
ListIter<MenuItem> item = menu->GetItems();
while (++item) {
if (ship->GetEMCON() < 2 ||
(TargetRequired(item.value()) && !ship->GetTarget()) ||
item->GetText().contains("KIA")) {
item->SetEnabled(false);
font->SetAlpha(0.35);
}
else {
item->SetEnabled(true);
font->SetAlpha(1);
}
font->DrawText(item->GetText(), 0, menu_rect, DT_LEFT);
menu_rect.y += 10;
}
}
}
int message_queue_empty = true;
// age messages:
for (int i = 0; i < MAX_MSG; i++) {
if (msg_time[i] > 0) {
msg_time[i] -= Game::GUITime();
if (msg_time[i] <= 0) {
msg_time[i] = 0;
msg_text[i] = "";
}
message_queue_empty = false;
}
}
if (!message_queue_empty) {
// advance message pipeline:
for (int i = 0; i < MAX_MSG; i++) {
if (msg_time[0] == 0) {
for (int j = 0; j < MAX_MSG-1; j++) {
msg_time[j] = msg_time[j+1];
msg_text[j] = msg_text[j+1];
}
msg_time[MAX_MSG-1] = 0;
msg_text[MAX_MSG-1] = "";
}
}
bool hud_off = false;
if (HUDView::GetInstance())
hud_off = (HUDView::GetInstance()->GetHUDMode() == HUDView::HUD_MODE_OFF);
// draw messages:
if (!hud_off) {
for (int i = 0; i < MAX_MSG; i++) {
if (msg_time[i] > 0) {
Rect msg_rect(0, 95 + i*10, width, 12);
if (msg_time[i] > 1)
font->SetAlpha(1);
else
font->SetAlpha(0.5 + 0.5*msg_time[i]);
font->DrawText(msg_text[i].data(), msg_text[i].length(), msg_rect, DT_CENTER);
}
}
font->SetAlpha(1);
}
}
Starshatter* stars = Starshatter::GetInstance();
if (stars && stars->GetChatMode()) {
Text chat;
switch (stars->GetChatMode()) {
case 1: chat = "ALL: "; break;
case 2: chat = "TEAM: "; break;
case 3: chat = "WING: "; break;
case 4: chat = "UNIT: "; break;
}
chat += stars->GetChatText();
Rect chat_rect(width/2 - 250, height-150, 500, 12);
font->DrawText(chat, 0, chat_rect, DT_LEFT);
chat_rect.Inflate(2,2);
window->DrawRect(chat_rect, hud_color);
}
}
示例2: if
void
ShipCtrl::ExecFrame(double seconds)
{
Starshatter* stars = Starshatter::GetInstance();
if (stars && stars->GetChatMode()) return;
if (!ship) return;
const int DELTA_THROTTLE = 5;
controller->Acquire();
if (ship->IsStarship() && ship->GetFLCSMode() == Ship::FLCS_HELM) {
ship->ApplyHelmPitch(controller->Pitch() * seconds);
ship->ApplyHelmYaw(controller->Yaw() * seconds);
}
else {
ship->ApplyRoll(controller->Roll());
ship->ApplyPitch(controller->Pitch());
ship->ApplyYaw(controller->Yaw());
}
ship->SetTransX(controller->X() * ship->Design()->trans_x);
ship->SetTransY(controller->Y() * ship->Design()->trans_y);
ship->SetTransZ(controller->Z() * ship->Design()->trans_z);
bool augmenter = false;
if (controller->Throttle() > 0.05) {
if (throttle_active) {
ship->SetThrottle(controller->Throttle() * 100);
if (controller->Throttle() >= 0.99)
augmenter = true;
}
else if (!launch_latch || controller->Throttle() > 0.5) {
throttle_active = true;
launch_latch = false;
}
}
else if (throttle_active) {
ship->SetThrottle(0);
throttle_active = false;
}
ship->ExecFLCSFrame();
static double time_til_change = 0.0;
if (time_til_change < 0.001) {
if (KeyDown(KEY_THROTTLE_UP)) {
ship->SetThrottle(ship->Throttle() + DELTA_THROTTLE);
time_til_change = 0.05;
}
else if (KeyDown(KEY_THROTTLE_DOWN)) {
ship->SetThrottle(ship->Throttle() - DELTA_THROTTLE);
time_til_change = 0.05;
}
else if (KeyDown(KEY_THROTTLE_ZERO)) {
ship->SetThrottle(0);
if (ship->GetFLCS())
ship->GetFLCS()->FullStop();
time_til_change = 0.05;
}
else if (KeyDown(KEY_THROTTLE_FULL)) {
ship->SetThrottle(100);
time_til_change = 0.05;
}
else if (KeyDown(KEY_FLCS_MODE_AUTO)) {
ship->CycleFLCSMode();
time_til_change = 0.5f;
}
else if (KeyDown(KEY_CYCLE_PRIMARY)) {
HUDSounds::PlaySound(HUDSounds::SND_WEP_MODE);
ship->CyclePrimary();
time_til_change = 0.5f;
}
else if (KeyDown(KEY_CYCLE_SECONDARY)) {
HUDSounds::PlaySound(HUDSounds::SND_WEP_MODE);
ship->CycleSecondary();
time_til_change = 0.5f;
}
if (ship->GetShield()) {
Shield* shield = ship->GetShield();
double level = shield->GetPowerLevel();
if (KeyDown(KEY_SHIELDS_FULL)) {
HUDSounds::PlaySound(HUDSounds::SND_SHIELD_LEVEL);
shield->SetPowerLevel(100);
time_til_change = 0.5f;
}
else if (KeyDown(KEY_SHIELDS_ZERO)) {
HUDSounds::PlaySound(HUDSounds::SND_SHIELD_LEVEL);
//.........这里部分代码省略.........