当前位置: 首页>>代码示例>>C++>>正文


C++ IF_PRINT_WARNING函数代码示例

本文整理汇总了C++中IF_PRINT_WARNING函数的典型用法代码示例。如果您正苦于以下问题:C++ IF_PRINT_WARNING函数的具体用法?C++ IF_PRINT_WARNING怎么用?C++ IF_PRINT_WARNING使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了IF_PRINT_WARNING函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


注:本文中的IF_PRINT_WARNING函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。