本文整理汇总了C++中IF_PRINT_WARNING函数的典型用法代码示例。如果您正苦于以下问题:C++ IF_PRINT_WARNING函数的具体用法?C++ IF_PRINT_WARNING怎么用?C++ IF_PRINT_WARNING使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IF_PRINT_WARNING函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: IF_PRINT_WARNING
// The destructor frees all the modes still on the stack
ModeEngine::~ModeEngine()
{
IF_PRINT_WARNING(MODE_MANAGER_DEBUG)
<< "MODE MANAGER: ModeEngine destructor invoked" << std::endl;
// Delete any game modes on the stack
while(!_game_stack.empty()) {
delete _game_stack.back();
_game_stack.pop_back();
}
// Delete any game modes on the push stack
while(!_push_stack.empty()) {
delete _push_stack.back();
_push_stack.pop_back();
}
delete _help_window;
}
开发者ID:akien-mga,项目名称:ValyriaTear,代码行数:19,代码来源:mode_manager.cpp
示例2: low_green
void IndicatorSupervisor::AddHealingIndicator(uint32 amount, bool hit_points) {
const Color low_green(0.0f, 1.0f, 0.60f, 1.0f);
const Color mid_green(0.0f, 1.0f, 0.30f, 1.0f);
const Color high_green(0.0f, 1.0f, 0.15f, 1.0f);
const Color low_blue(0.0f, 0.60f, 1.0f, 1.0f);
const Color mid_blue(0.0f, 0.30f, 1.0f, 1.0f);
const Color high_blue(0.0f, 0.15f, 1.0f, 1.0f);
if (amount == 0) {
IF_PRINT_WARNING(BATTLE_DEBUG) << "function was given a zero value argument" << std::endl;
return;
}
std::string text = NumberToString(amount);
TextStyle style;
// TODO: use different colors/shades of green for different degrees of damage. There's a
// bug in rendering colored text that needs to be addressed first.
float healing_percent = static_cast<float>(amount / _actor->GetMaxHitPoints());
if (healing_percent < 0.10f) {
style.font = "text24";
style.color = hit_points ? low_green : low_blue;
style.shadow_style = VIDEO_TEXT_SHADOW_BLACK;
}
else if (healing_percent < 0.20f) {
style.font = "text24";
style.color = hit_points ? mid_green : mid_blue;
style.shadow_style = VIDEO_TEXT_SHADOW_BLACK;
}
else if (healing_percent < 0.30f) {
style.font = "text24";
style.color = hit_points ? high_green : high_blue;
style.shadow_style = VIDEO_TEXT_SHADOW_BLACK;
}
else { // (healing_percent >= 0.30f)
style.font = "text24";
style.color = hit_points ? Color::green : Color::blue;
style.shadow_style = VIDEO_TEXT_SHADOW_BLACK;
}
_wait_queue.push_back(new IndicatorText(_actor, text, style, HEALING_INDICATOR));
}
开发者ID:rkettering,项目名称:ValyriaTear,代码行数:43,代码来源:battle_indicators.cpp
示例3: CalculateOppositeDirection
uint16 CalculateOppositeDirection(const uint16 direction) {
switch (direction) {
case NORTH: return SOUTH;
case SOUTH: return NORTH;
case WEST: return EAST;
case EAST: return WEST;
case NW_NORTH: return SE_SOUTH;
case NW_WEST: return SE_EAST;
case NE_NORTH: return SW_SOUTH;
case NE_EAST: return SW_WEST;
case SW_SOUTH: return NE_NORTH;
case SW_WEST: return NE_EAST;
case SE_SOUTH: return NW_NORTH;
case SE_EAST: return NW_WEST;
default:
IF_PRINT_WARNING(MAP_DEBUG) << "invalid direction argument: " << direction << endl;
return SOUTH;
}
}
开发者ID:segafan,项目名称:Hero-of-Allacrost,代码行数:19,代码来源:map_utils.cpp
示例4: DecrementIntensity
bool DecrementIntensity(GLOBAL_INTENSITY &intensity, uint8 amount)
{
if(amount == 0)
return false;
if((intensity <= GLOBAL_INTENSITY_NEG_EXTREME) || (intensity >= GLOBAL_INTENSITY_TOTAL))
return false;
// This check protects against overflow conditions
if(amount > (GLOBAL_INTENSITY_TOTAL * 2)) {
IF_PRINT_WARNING(GLOBAL_DEBUG) << "attempted to decrement intensity by an excessive amount: " << amount << std::endl;
intensity = GLOBAL_INTENSITY_NEG_EXTREME;
return true;
}
intensity = GLOBAL_INTENSITY(intensity - amount);
if(intensity <= GLOBAL_INTENSITY_INVALID)
intensity = GLOBAL_INTENSITY_NEG_EXTREME;
return true;
}
开发者ID:AMDmi3,项目名称:ValyriaTear,代码行数:19,代码来源:global_utils.cpp
示例5: IF_PRINT_WARNING
void DialogueSupervisor::AnnounceDialogueUpdate(uint32 dialogue_id) {
map<uint32, vector<uint32> >::iterator entry = _sprite_references.find(dialogue_id);
// Note that we don't print a warning if no entry was found, because the case where a dialogue exists
// but is not referenced by any sprites is a valid one
if (entry == _sprite_references.end())
return;
// Update the dialogue status of all sprites that reference this dialogue
for (uint32 i = 0; i < entry->second.size(); i++) {
MapSprite* referee = static_cast<MapSprite*>(MapMode::CurrentInstance()->GetObjectSupervisor()->GetObject(entry->second[i]));
if (referee == NULL) {
IF_PRINT_WARNING(MAP_DEBUG) << "map sprite: " << entry->second[i] << " references dialogue: " << dialogue_id << " but sprite object did not exist"<< endl;
}
else {
referee->UpdateDialogueStatus();
}
}
}
开发者ID:segafan,项目名称:Hero-of-Allacrost,代码行数:19,代码来源:map_dialogue.cpp
示例6: alSourcei
void AudioSource::Reset()
{
owner = NULL;
if(IsValid() == false) {
return;
}
alSourcei(source, AL_LOOPING, AL_FALSE);
alSourcef(source, AL_GAIN, 1.0f);
alSourcei(source, AL_SAMPLE_OFFSET, 0); // This line will cause AL_INVALID_ENUM error in linux/Solaris. It is normal.
alSourcei(source, AL_BUFFER, 0);
if(AudioManager->CheckALError()) {
#ifdef WIN32
IF_PRINT_WARNING(AUDIO_DEBUG) << "resetting source failed: " << AudioManager->CreateALErrorString() << std::endl;
#endif
}
}
开发者ID:grimreaper,项目名称:ValyriaTear,代码行数:19,代码来源:audio_descriptor.cpp
示例7: IF_PRINT_WARNING
void ResidentZone::AddPotentialResident(VirtualSprite* sprite) {
if (sprite == NULL) {
IF_PRINT_WARNING(MAP_DEBUG) << "function received NULL argument" << endl;
return;
}
// Check that sprite is not already a resident
if (IsSpriteResident(sprite) == true) {
return;
}
// Check that the sprite's context is compatible with this zone and is located within the zone boundaries
if (sprite->GetContext() & _active_contexts) {
if (IsInsideZone(sprite->GetXPosition(), sprite->GetYPosition())) {
_entering_residents.insert(sprite);
_residents.insert(sprite);
}
}
}
开发者ID:NemesisDD,项目名称:ValyriaTear,代码行数:19,代码来源:map_zones.cpp
示例8: IF_PRINT_WARNING
void TreasureObject::Open()
{
if(!_treasure) {
PRINT_ERROR << "Can't open treasure with invalid treasure content." << std::endl;
return;
}
if(_treasure->IsTaken()) {
IF_PRINT_WARNING(MAP_DEBUG) << "attempted to retrieve an already taken treasure: " << _object_id << std::endl;
return;
}
// Test whether events should be triggered
if (_events.empty())
_events_triggered = true;
SetCurrentAnimation(TREASURE_OPENING_ANIM);
_is_opening = true;
}
开发者ID:ValyriaTear,项目名称:ValyriaTear,代码行数:19,代码来源:map_treasure.cpp
示例9: glGetIntegerv
void VideoEngine::MakeScreenshot(const std::string &filename)
{
private_video::ImageMemory buffer;
// Retrieve the width and height of the viewport.
GLint viewport_dimensions[4]; // viewport_dimensions[2] is the width, [3] is the height
glGetIntegerv(GL_VIEWPORT, viewport_dimensions);
// Buffer to store the image before it is flipped
buffer.width = viewport_dimensions[2];
buffer.height = viewport_dimensions[3];
buffer.pixels = malloc(buffer.width * buffer.height * 3);
buffer.rgb_format = true;
// Read the viewport pixel data
glReadPixels(viewport_dimensions[0], viewport_dimensions[1],
buffer.width, buffer.height, GL_RGB, GL_UNSIGNED_BYTE, buffer.pixels);
if(CheckGLError() == true) {
IF_PRINT_WARNING(VIDEO_DEBUG) << "an OpenGL error occured: " << CreateGLErrorString() << std::endl;
free(buffer.pixels);
buffer.pixels = NULL;
return;
}
// Vertically flip the image, then swap the flipped and original images
void *buffer_temp = malloc(buffer.width * buffer.height * 3);
for(uint32 i = 0; i < buffer.height; ++i) {
memcpy((uint8 *)buffer_temp + i * buffer.width * 3,
(uint8 *)buffer.pixels + (buffer.height - i - 1) * buffer.width * 3, buffer.width * 3);
}
void *temp = buffer.pixels;
buffer.pixels = buffer_temp;
buffer_temp = temp;
buffer.SaveImage(filename);
free(buffer_temp);
free(buffer.pixels);
buffer.pixels = NULL;
}
开发者ID:galexcode,项目名称:ValyriaTear,代码行数:42,代码来源:video.cpp
示例10: MakeUnicodeString
void DialogueSupervisor::AddSpeaker(const std::string& speaker_id, const std::string& name, const std::string& portrait)
{
if(_speakers.find(speaker_id) != _speakers.end()) {
PRINT_WARNING << "Speaker already existed with requested id: " << speaker_id << std::endl;
return;
}
Speaker new_speaker;
new_speaker.name = MakeUnicodeString(name);
if(!portrait.empty()) {
if(!new_speaker.portrait.Load(portrait)) {
IF_PRINT_WARNING(COMMON_DEBUG) << "invalid image filename for new portrait: " << portrait << std::endl;
}
// Make sure the portrait doesn't go over the screen edge.
if(new_speaker.portrait.GetHeight() > 130.0f)
new_speaker.portrait.SetHeightKeepRatio(130.0f);
}
_speakers[speaker_id] = new_speaker;
}
开发者ID:authenticate,项目名称:ValyriaTear,代码行数:20,代码来源:dialogue.cpp
示例11: IF_PRINT_WARNING
void WriteScriptDescriptor::CloseFile() {
if (IsFileOpen() == false) {
IF_PRINT_WARNING(SCRIPT_DEBUG)
<< "SCRIPT ERROR: in WriteScriptDescriptor::CloseFile(), could not close the "
<< "file because it was not open." << std::endl;
return;
}
if (SCRIPT_DEBUG && IsErrorDetected()) {
PRINT_WARNING << "SCRIPT WARNING: In WriteScriptDescriptor::CloseFile(), the file " << _filename
<< " had error messages remaining. They are as follows:" << std::endl
<< _error_messages.str() << std::endl;
}
_outfile.close();
_error_messages.clear();
_open_tables.clear();
_access_mode = SCRIPT_CLOSED;
ScriptManager->_RemoveOpenFile(this);
}
开发者ID:rkettering,项目名称:ValyriaTear,代码行数:20,代码来源:script_write.cpp
示例12: IF_PRINT_WARNING
void AudioEngine::PlaySound(const std::string &filename)
{
std::map<std::string, AudioCacheElement>::iterator element = _audio_cache.find(filename);
if(element == _audio_cache.end()) {
// Don't check the current game mode to prevent the sound unloading in certain cases.
// We'll let the audio cache handle it all atm.
if(!LoadSound(filename)) {
IF_PRINT_WARNING(AUDIO_DEBUG)
<< "could not play sound from cache because "
"the sound could not be loaded" << std::endl;
return;
} else {
element = _audio_cache.find(filename);
}
}
element->second.audio->Play();
element->second.last_update_time = SDL_GetTicks();
}
开发者ID:grimreaper,项目名称:ValyriaTear,代码行数:20,代码来源:audio.cpp
示例13: IF_PRINT_DEBUG
bool TextureController::_SaveTempTextures() {
bool success = true;
for (map<string, ImageTexture*>::iterator i = _images.begin(); i != _images.end(); i++) {
ImageTexture *image = i->second;
// Check that this is a temporary texture and if so, save it to disk as a .png file
if (image->tags.find("<T>") != string::npos) {
IF_PRINT_DEBUG(VIDEO_DEBUG) << " saving temporary texture " << image->filename << endl;
ImageMemory buffer;
buffer.CopyFromImage(image);
string path = GetUserDataPath(true);
if (buffer.SaveImage(path + image->filename + ".png", true) == false) {
success = false;
IF_PRINT_WARNING(VIDEO_DEBUG) << "call to ImageMemory::SaveImage() failed" << endl;
}
}
}
return success;
}
开发者ID:segafan,项目名称:Hero-of-Allacrost,代码行数:20,代码来源:texture_controller.cpp
示例14: GetDialogue
void DialogueSupervisor::BeginDialogue(uint32 dialogue_id)
{
SpriteDialogue *dialogue = GetDialogue(dialogue_id);
if(dialogue == NULL) {
PRINT_WARNING << "Could not begin dialogue because none existed for id: " << dialogue_id << std::endl
<< "Did you register the dialogue using 'AddDialogue()'?" << std::endl;
return;
}
if(_current_dialogue != NULL) {
IF_PRINT_WARNING(COMMON_DEBUG) << "beginning a new dialogue while another dialogue is still active" << std::endl;
}
_line_counter = 0;
_current_dialogue = dialogue;
_emote_triggered = false;
_BeginLine();
MapMode::CurrentInstance()->PushState(STATE_DIALOGUE);
}
开发者ID:akien-mga,项目名称:ValyriaTear,代码行数:20,代码来源:map_dialogue.cpp
示例15: IF_PRINT_WARNING
void TextBox::Draw()
{
if(_text.empty())
return;
if(_initialized == false) {
IF_PRINT_WARNING(VIDEO_DEBUG) << "function failed because the textbox was not initialized:\n" << _initialization_errors << std::endl;
return;
}
// Don't draw text window if parent window is hidden
if(_owner && _owner->GetState() == VIDEO_MENU_STATE_HIDDEN)
return;
VideoManager->PushState();
VideoManager->SetDrawFlags(_xalign, _yalign, VIDEO_BLEND, 0);
/*
// TODO: this block of code (scissoring for textboxes) does not work properly
if (_owner) {
rect.Intersect(_owner->GetScissorRect());
}
rect.Intersect(VideoManager->GetScissorRect());
VideoManager->EnableScissoring(_owner || VideoManager->IsScissoringEnabled());
if (VideoManager->IsScissoringEnabled()) {
VideoManager->SetScissorRect(_scissor_rect);
}
*/
// Set the draw cursor, draw flags, and draw the text
VideoManager->Move(0.0f, _text_ypos);
VideoManager->SetDrawFlags(VIDEO_X_LEFT, VIDEO_Y_TOP, VIDEO_BLEND, 0);
_DrawTextLines(_text_xpos, _text_ypos, _scissor_rect);
if(GUIManager->DEBUG_DrawOutlines())
_DEBUG_DrawOutline();
VideoManager->PopState();
} // void TextBox::Draw()
开发者ID:IkarusDowned,项目名称:ValyriaTear,代码行数:41,代码来源:textbox.cpp
示例16: AudioInput
AudioMemory::AudioMemory(AudioInput *input) :
AudioInput(),
_audio_data(nullptr),
_data_position(0)
{
_filename = input->GetFilename();
_samples_per_second = input->GetSamplesPerSecond();
_bits_per_sample = input->GetBitsPerSample();
_number_channels = static_cast<uint8_t>(input->GetNumberChannels());
_total_number_samples = input->GetTotalNumberSamples();
_sample_size = input->GetSampleSize();
_play_time = input->GetPlayTime();
_data_size = input->GetDataSize();
_audio_data = new uint8_t[input->GetDataSize()];
bool all_data_read = false;
input->Read(_audio_data, input->GetTotalNumberSamples(), all_data_read);
if(all_data_read == false) {
IF_PRINT_WARNING(AUDIO_DEBUG) << "failed to read entire audio data stream for file: " << _filename << std::endl;
}
}
开发者ID:authenticate,项目名称:ValyriaTear,代码行数:21,代码来源:audio_input.cpp
示例17: Regenerate
bool TextTexture::Reload()
{
// Regenerate text image if it is not already loaded in a texture sheet
if(texture_sheet == NULL)
return Regenerate();
ImageMemory buffer;
if(TextManager->_RenderText(string, style, buffer) == false)
return false;
if(texture_sheet->CopyRect(x, y, buffer) == false) {
IF_PRINT_WARNING(VIDEO_DEBUG) << "call to TextureSheet::CopyRect() failed" << std::endl;
free(buffer.pixels);
buffer.pixels = NULL;
return false;
}
free(buffer.pixels);
buffer.pixels = NULL;
return true;
}
开发者ID:AMDmi3,项目名称:ValyriaTear,代码行数:21,代码来源:text.cpp
示例18: if
bool BattleTarget::IsValid(bool permit_dead_targets) {
// No dead enemies can be selected here.
if (IsTargetPoint(_type)) {
if (!_actor)
return false;
bool enemy_actor = _actor->IsEnemy();
if (_point >= _actor->GetAttackPoints().size())
return false;
// We extra check the actor HP since the state might desynced on purpose.
else if (!_actor->IsAlive() || _actor->GetHitPoints() == 0)
return !enemy_actor && permit_dead_targets;
else if (_actor->GetState() == ACTOR_STATE_DYING)
return !enemy_actor && permit_dead_targets;
else
return true;
}
else if (IsTargetActor(_type) == true) {
if (!_actor)
return false;
bool enemy_actor = _actor->IsEnemy();
if (!_actor->IsAlive() || _actor->GetHitPoints() == 0)
return !enemy_actor && permit_dead_targets;
else if (_actor->GetState() == ACTOR_STATE_DYING)
return !enemy_actor && permit_dead_targets;
else
return true;
}
else if (IsTargetParty(_type)) {
if (!_party)
return false;
else
return true;
}
else {
IF_PRINT_WARNING(BATTLE_DEBUG) << "invalid target type: " << _type << std::endl;
return false;
}
}
开发者ID:triptych,项目名称:ValyriaTear,代码行数:40,代码来源:battle_utils.cpp
示例19: switch
void TradeInterface::_UpdateAvailableTradeDealTypes()
{
_trade_deal_types = 0;
// Determine what types of objects the shop deals in based on the managed object list
std::map<uint32, ShopObject *>* trade_objects = ShopMode::CurrentInstance()->GetAvailableTrade();
for(std::map<uint32, ShopObject *>::iterator it = trade_objects->begin(); it != trade_objects->end(); ++it) {
vt_global::GLOBAL_OBJECT object_type = it->second->GetObject()->GetObjectType();
switch(object_type) {
case GLOBAL_OBJECT_ITEM:
_trade_deal_types |= DEALS_ITEMS;
break;
case GLOBAL_OBJECT_WEAPON:
_trade_deal_types |= DEALS_WEAPONS;
break;
case GLOBAL_OBJECT_HEAD_ARMOR:
_trade_deal_types |= DEALS_HEAD_ARMOR;
break;
case GLOBAL_OBJECT_TORSO_ARMOR:
_trade_deal_types |= DEALS_TORSO_ARMOR;
break;
case GLOBAL_OBJECT_ARM_ARMOR:
_trade_deal_types |= DEALS_ARM_ARMOR;
break;
case GLOBAL_OBJECT_LEG_ARMOR:
_trade_deal_types |= DEALS_LEG_ARMOR;
break;
case GLOBAL_OBJECT_SPIRIT:
_trade_deal_types |= DEALS_SPIRIT;
break;
default:
IF_PRINT_WARNING(SHOP_DEBUG) << "unknown object type sold in shop: " << object_type << std::endl;
break;
}
// Also test whether this is a key item
if (it->second->GetObject()->IsKeyItem())
_trade_deal_types |= DEALS_KEY_ITEMS;
}
}
开发者ID:galexcode,项目名称:ValyriaTear,代码行数:40,代码来源:shop_trade.cpp
示例20: while
bool ParticleEffect::Update(float frame_time)
{
_age += frame_time;
_num_particles = 0;
if(!_alive)
return true;
bool success = true;
hoa_mode_manager::EffectParameters effect_parameters;
effect_parameters.orientation = _orientation;
// note we subtract the effect position to put the attractor point in effect
// space instead of screen space
effect_parameters.attractor_x = _attractor_x - _x;
effect_parameters.attractor_y = _attractor_y - _y;
std::vector<ParticleSystem>::iterator iSystem = _systems.begin();
while(iSystem != _systems.end()) {
if(!(*iSystem).IsAlive()) {
iSystem = _systems.erase(iSystem);
if(_systems.empty())
_alive = false;
} else {
if(!(*iSystem).Update(frame_time, effect_parameters)) {
success = false;
IF_PRINT_WARNING(VIDEO_DEBUG)
<< "Failed to update system!" << std::endl;
}
_num_particles += (*iSystem).GetNumParticles();
++iSystem;
}
}
return success;
}
开发者ID:grimreaper,项目名称:ValyriaTear,代码行数:40,代码来源:particle_effect.cpp
注:本文中的IF_PRINT_WARNING函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论