您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ Character函数代码示例

51自学网 2021-06-01 20:10:08
  C++
这篇教程C++ Character函数代码示例写得很实用,希望能帮到您。

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

在下文中一共展示了Character函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: ChangeTeamState

void CGameTeams::SetForceCharacterTeam(int ClientID, int Team){	m_TeeFinished[ClientID] = false;	if(m_Core.Team(ClientID) != TEAM_FLOCK 		&& m_Core.Team(ClientID) != TEAM_SUPER 		&& m_TeamState[m_Core.Team(ClientID)] != TEAMSTATE_EMPTY)	{		bool NoOneInOldTeam = true;		for(int i = 0; i < MAX_CLIENTS; ++i)			if(i != ClientID && m_Core.Team(ClientID) == m_Core.Team(i))			{				NoOneInOldTeam = false;//all good exists someone in old team				break;			} 		if(NoOneInOldTeam)			m_TeamState[m_Core.Team(ClientID)] = TEAMSTATE_EMPTY;	}	if(Count(m_Core.Team(ClientID)) > 0) m_MembersCount[m_Core.Team(ClientID)]--;	m_Core.Team(ClientID, Team);	if(m_Core.Team(ClientID) != TEAM_SUPER) m_MembersCount[m_Core.Team(ClientID)]++;	if(Team != TEAM_SUPER && m_TeamState[Team] == TEAMSTATE_EMPTY)		ChangeTeamState(Team, TEAMSTATE_OPEN);		for (int LoopClientID = 0; LoopClientID < MAX_CLIENTS; ++LoopClientID)	{		if(Character(LoopClientID) && Character(LoopClientID)->GetPlayer()->m_IsUsingDDRaceClient)			SendTeamsState(LoopClientID);	}}
开发者ID:Fear-cool,项目名称:dDDRace,代码行数:29,


示例2: Character

bool CGameTeams::SetCharacterTeam(int ClientID, int Team){	//Check on wrong parameters. +1 for TEAM_SUPER	if(ClientID < 0 || ClientID >= MAX_CLIENTS || Team < 0 || Team >= MAX_CLIENTS + 1)		return false;	//You can join to TEAM_SUPER at any time, but any other group you cannot if it started	if(Team != TEAM_SUPER && m_TeamState[Team] >= TEAMSTATE_CLOSED)		return false;	//No need to switch team if you there	if(m_Core.Team(ClientID) == Team)		return false;	//You cannot be in TEAM_SUPER if you not super	if(Team == TEAM_SUPER && !Character(ClientID)->m_Super) return false;	//if you begin race	if(Character(ClientID)->m_DDRaceState != DDRACE_NONE)	{		//you will be killed if you try to join FLOCK		if(Team == TEAM_FLOCK && m_Core.Team(ClientID) != TEAM_FLOCK)			Character(ClientID)->GetPlayer()->KillCharacter(WEAPON_GAME);		else if(Team != TEAM_SUPER)			return false;	}	SetForceCharacterTeam(ClientID, Team);			//GameServer()->CreatePlayerSpawn(Character(id)->m_Core.m_Pos, TeamMask());	return true;}
开发者ID:Fear-cool,项目名称:dDDRace,代码行数:28,


示例3: Server

bool CWeapon_GenericGun07::OnFire(vec2 Direction){	if(m_ReloadTimer > 0)		return false;			// check for ammo	if(!m_Ammo)	{		// 125ms is a magical limit of how fast a human can click		m_ReloadTimer = 125 * Server()->TickSpeed() / 1000;		if(m_LastNoAmmoSound+Server()->TickSpeed() <= Server()->Tick())		{			CEvent_Sound(GameServer()).World(WorldID())				.Send(Character()->GetPos(), SOUND_WEAPON_NOAMMO);					m_LastNoAmmoSound = Server()->Tick();		}		return false;	}		vec2 ProjStartPos = Character()->GetPos() + Direction * Character()->GetProximityRadius()*0.75f;		CreateProjectile(ProjStartPos, Direction);		m_Ammo--;		m_ReloadTimer = g_pData->m_Weapons.m_aId[m_TW07ID].m_Firedelay * Server()->TickSpeed() / 1000;		return true;}
开发者ID:teeworlds-modapi,项目名称:teeworlds,代码行数:30,


示例4: if

int64_t CGameTeams::TeamMask(int Team, int ExceptID, int Asker){	int64_t Mask = 0;	for (int i = 0; i < MAX_CLIENTS; ++i)	{		if (i == ExceptID)			continue; // Explicitly excluded		if (!GetPlayer(i))			continue; // Player doesn't exist		if (!(GetPlayer(i)->GetTeam() == -1 || GetPlayer(i)->m_Paused))		{ // Not spectator			if (i != Asker)			{ // Actions of other players				if (!Character(i))					continue; // Player is currently dead				if (!GetPlayer(i)->m_ShowOthers)				{					if (m_Core.GetSolo(Asker))						continue; // When in solo part don't show others					if (m_Core.GetSolo(i))						continue; // When in solo part don't show others					if (m_Core.Team(i) != Team && m_Core.Team(i) != TEAM_SUPER)						continue; // In different teams				} // ShowOthers			} // See everything of yourself		}		else if (GetPlayer(i)->m_SpectatorID != SPEC_FREEVIEW)		{ // Spectating specific player			if (GetPlayer(i)->m_SpectatorID != Asker)			{ // Actions of other players				if (!Character(GetPlayer(i)->m_SpectatorID))					continue; // Player is currently dead				if (!GetPlayer(i)->m_ShowOthers)				{					if (m_Core.GetSolo(Asker))						continue; // When in solo part don't show others					if (m_Core.GetSolo(GetPlayer(i)->m_SpectatorID))						continue; // When in solo part don't show others					if (m_Core.Team(GetPlayer(i)->m_SpectatorID) != Team && m_Core.Team(GetPlayer(i)->m_SpectatorID) != TEAM_SUPER)						continue; // In different teams				} // ShowOthers			} // See everything of player you're spectating		}		else		{ // Freeview			if (GetPlayer(i)->m_SpecTeam)			{ // Show only players in own team when spectating				if (m_Core.Team(i) != Team && m_Core.Team(i) != TEAM_SUPER)					continue; // in different teams			}		}		Mask |= 1LL << i;	}	return Mask;}
开发者ID:Enyltyn,项目名称:AllTheHaxx,代码行数:58,


示例5: on_testAchieve_clicked

void MainWindow::on_testAchieve_clicked(){    action = TESTACHIEVE;    ArmoryCharacter::insert(Character("Giganteus", "Thrall"));    ArmoryCharacter::insert(Character("Gigahuf", "Thrall"));    ArmoryCharacter::insert(Character("Sauerbruch", "Thrall"));    ArmoryCharacter::insert(Character("Giganteus", "Antonidas"));    db->updatePlayers();}
开发者ID:gpiez,项目名称:battlecrawler,代码行数:9,


示例6: common_refill_and_read_nolock

static int __cdecl common_refill_and_read_nolock(__crt_stdio_stream const stream) throw(){    typedef __acrt_stdio_char_traits<Character> stdio_traits;    _VALIDATE_RETURN(stream.valid(), EINVAL, stdio_traits::eof);    if (!stream.is_in_use() || stream.is_string_backed())        return stdio_traits::eof;    if (stream.has_all_of(_IOWRITE))    {        stream.set_flags(_IOERROR);        return stdio_traits::eof;    }    stream.set_flags(_IOREAD);    // Get a buffer, if necessary:    if (!stream.has_any_buffer())        __acrt_stdio_allocate_buffer_nolock(stream.public_stream());    auto const context = get_context_nolock(stream, Character());    stream->_ptr = stream->_base;    stream->_cnt = _read(_fileno(stream.public_stream()), stream->_base, stream->_bufsiz);    if (!is_buffer_valid_nolock(stream, Character()))    {        stream.set_flags(stream->_cnt != 0 ? _IOERROR : _IOEOF);        stream->_cnt = 0;        return stdio_traits::eof;    }    if (!stream.has_any_of(_IOWRITE | _IOUPDATE) &&        ((_osfile_safe(_fileno(stream.public_stream())) & (FTEXT | FEOFLAG)) == (FTEXT | FEOFLAG)))    {        stream.set_flags(_IOCTRLZ);    }    // Check for small _bufsiz (_SMALL_BUFSIZ). If it is small and if it is our    // buffer, then this must be the first call to this function after an fseek    // on a read-access-only stream. Restore _bufsiz to its larger value    // (_INTERNAL_BUFSIZ) so that the next call to this function, if one is made,    // will fill the whole buffer.    if (stream->_bufsiz == _SMALL_BUFSIZ &&        stream.has_crt_buffer() &&        !stream.has_all_of(_IOBUFFER_SETVBUF))    {        stream->_bufsiz = _INTERNAL_BUFSIZ;    }    return read_character_nolock(stream, context, Character());}
开发者ID:DinrusGroup,项目名称:DinrusUcrtBased,代码行数:53,


示例7: Character

void PlayerController::Tick(sf::Window *window) {  b2Body *body = Character()->Body();  b2Vec2 chrPos = body->GetPosition();  b2Vec2 base = Character()->ClosestPlanet()->Position();  float angle_r = RadiansOf(chrPos - base);  if (chrPos.x < base.x)    angle_r = -angle_r;  Character()->Body()->SetTransform(chrPos, angle_r);  if (left_down_) {    b2Vec2 mouseVec(mouse_x_ - window->getSize().x / 2.0f,                    mouse_y_ - window->getSize().y / 2.0f);    b2Vec2 rotated = RotatedVector(mouseVec, angle_r);    body->ApplyLinearImpulse(rotated, body->GetPosition());  }}
开发者ID:Bredgren,项目名称:CosmicCombat_old,代码行数:15,


示例8: while

void MWState::CharacterManager::createCharacter(const std::string& name){    std::ostringstream stream;    // The character name is user-supplied, so we need to escape the path    for (std::string::const_iterator it = name.begin(); it != name.end(); ++it)    {        if (std::isalnum(*it)) // Ignores multibyte characters and non alphanumeric characters            stream << *it;        else            stream << "_";    }    boost::filesystem::path path = mPath / stream.str();    // Append an index if necessary to ensure a unique directory    int i=0;    while (boost::filesystem::exists(path))    {           std::ostringstream test;           test << stream.str();           test << " - " << ++i;           path = mPath / test.str();    }    mCharacters.push_back (Character (path, mGame));    mCurrent = &mCharacters.back();}
开发者ID:AAlderman,项目名称:openmw,代码行数:29,


示例9: main

int main(){	Character cube = Character("Cube", 5, 25, 123);	Environment earth = Environment(137, "Earth", EARTH_GRAVITY);	PhysicsController controller = PhysicsController();	float maxJumpHeightOnEarth = controller.getMaxJumpHeightInMeters(earth, cube);	float timeInAirOnEarth = controller.getJumpDurationInSeconds(earth, cube);	float bookHeight = 0.05;	bool canJumpOverBookOnEarth = controller.canJumpOverObstacle(earth, cube, bookHeight);	std::cout << "EARTH:" << std::endl <<		"--max jump height: " << maxJumpHeightOnEarth << " meters" << std::endl <<		"--time in air: " << timeInAirOnEarth << " seconds" << std::endl <<		"--can jump over book: " << (canJumpOverBookOnEarth ? "Yes" : "No") << std::endl;	std::cout << std::endl;	Environment moon = Environment(321, "Moon", MOON_GRAVITY);	float maxJumpHeightOnTheMoon = controller.getMaxJumpHeightInMeters(moon, cube);	float timeInAirOnTheMoon = controller.getJumpDurationInSeconds(moon, cube);	bool canJumpOverBookOnTheMoon = controller.canJumpOverObstacle(moon, cube, bookHeight);	std::cout << "MOON:" << std::endl <<		"--max jump height: " << maxJumpHeightOnTheMoon << " meters" << std::endl <<		"--time in air: " << timeInAirOnTheMoon << " seconds" << std::endl <<		"--can jump over book: " << (canJumpOverBookOnTheMoon ? "Yes" : "No") << std::endl;	return 0;}
开发者ID:krasi070,项目名称:CPlusPlus,代码行数:27,


示例10: main

int main() {        Character character = Character();    character.prompt();        return 0;}
开发者ID:temportalflux,项目名称:DnDCharacters,代码行数:7,


示例11: scanner

Lexer::Lexer(char* filename)    :    scanner(),    token(Character(NULL, NULL, NULL, NULL, NULL), &scanner, NULL){    scanner.OpenFile(filename);}
开发者ID:patrickmortensen,项目名称:theEngine,代码行数:7,


示例12: CLaser

void CMod_Weapon_Laser::CreateProjectile(vec2 Pos, vec2 Direction){	new CLaser(GameWorld(), Pos, Direction, GameServer()->Tuning()->m_LaserReach, Player()->GetCID());		CModAPI_WorldEvent_Sound(GameServer(), WorldID())		.Send(Character()->GetPos(), SOUND_LASER_FIRE);}
开发者ID:teeworlds-modapi,项目名称:mod-target,代码行数:7,


示例13: Character

HumanChar::HumanChar(Gtk * graphic, HumanBox* hb){  this->letter = Character();  this->clicked = false;  this->graphic = graphic;  this->parent = hb;}
开发者ID:Emma1718,项目名称:Literaki,代码行数:8,


示例14: ERR_FAIL_V

Font::Character Font::get_character(CharType p_char) const {	if (!char_map.has(p_char)) {		ERR_FAIL_V(Character());	};	return char_map[p_char];};
开发者ID:ShadowKyogre,项目名称:godot,代码行数:8,


示例15: uninitialize_environment_internal

static void __cdecl uninitialize_environment_internal(Character**& environment) throw(){    if (environment == get_initial_environment(Character()))    {        return;    }    free_environment(environment);}
开发者ID:DinrusGroup,项目名称:DinrusUcrtBased,代码行数:9,


示例16: Backspace

void CGUIDialogKeyboardGeneric::OnClickButton(int iButtonControl){  if (iButtonControl == CTL_BUTTON_BACKSPACE)  {    Backspace();  }  else    Character(GetCharacter(iButtonControl));}
开发者ID:maximuska,项目名称:xbmc,代码行数:9,


示例17: main

int main(){	Weapon sword  = Weapon("Steel Sword", 35,100,10,0,"sword",1);	Item * sPtr = &sword;	Inventory inv = Inventory(sPtr);	Inventory * invPtr = &inv;	Character chris  = Character("Chris", "Thief", "Human", 23,invPtr);	chris.getInventory()->addItem(sword);	chris.printStats();}
开发者ID:crogers1842,项目名称:FirstC--Game,代码行数:10,


示例18: get_tmpfile_buffer_nolock

static Character* __cdecl get_tmpfile_buffer_nolock(buffer_id const id) throw(){    Character*& buffer_pointer = get_tmpfile_buffer_pointer_nolock(id, Character());    if (!buffer_pointer)    {        buffer_pointer = _calloc_crt_t(Character, L_tmpnam).detach();    }    return buffer_pointer;}
开发者ID:DinrusGroup,项目名称:DinrusUcrtBased,代码行数:10,


示例19: StringToInteger

int StringToInteger(String S){   int n,i;   n = 0;   for (i = 1; i <= StringLength(S); i++)      n = n * 10 + (int) (Character(S,i)) - 48;    return(n);}
开发者ID:MARFMS,项目名称:chiquitico,代码行数:10,


示例20: common_get_initial_environment

static Character** __cdecl common_get_initial_environment() throw(){    Character**& initial_environment = get_initial_environment(Character());    if (!initial_environment)    {        initial_environment = common_get_or_create_environment_nolock<Character>();    }        return initial_environment;}
开发者ID:DinrusGroup,项目名称:DinrusUcrtBased,代码行数:10,


示例21: TeamMask

int CGameTeams::TeamMask(int Team, int ExceptID){	if(Team == TEAM_SUPER) return -1;	int Mask = 0;	for(int i = 0; i < MAX_CLIENTS; ++i)		if(i != ExceptID)			if((Character(i) && (m_Core.Team(i) == Team || m_Core.Team(i) == TEAM_SUPER))				|| (GameServer()->m_apPlayers[i] && GameServer()->m_apPlayers[i]->GetTeam() == -1))				Mask |= 1 << i;	return Mask;}
开发者ID:Fear-cool,项目名称:dDDRace,代码行数:11,


示例22: Backspace

void CGUIDialogKeyboardGeneric::OnClickButton(int iButtonControl){    if (iButtonControl == CTL_BUTTON_BACKSPACE)    {        Backspace();    }    else if (iButtonControl == CTL_BUTTON_SPACE)    {        Character(" ");    }    else    {        const CGUIControl* pButton = GetControl(iButtonControl);        if (pButton)        {            Character(pButton->GetDescription());            // reset the shift keys            if (m_bShift) OnShift();        }    }}
开发者ID:rlansi,项目名称:Kodi_dualaudio,代码行数:21,


示例23: Fighter

/// <summary>/// Builder of the Enemy class with 3 param/// </summary>/// <param> EnemyToCopy: The enemy to copy, what did you expect? </param>Enemy::Enemy(const Enemy &EnemyToCopy) : Fighter( Character(*(EnemyToCopy.m_name), EnemyToCopy.m_imagePath.at(0), EnemyToCopy.m_imagePath.at(1), 															EnemyToCopy.getSprite().getPosition().x, EnemyToCopy.getSprite().getPosition().y,															EnemyToCopy.m_maxSpeed, EnemyToCopy.m_walkSpeed, EnemyToCopy.m_runSpeed, EnemyToCopy.m_jumpSpeed),												EnemyToCopy.m_healthPoints, EnemyToCopy.m_maxHealthPoints, EnemyToCopy.m_experiencePoints)										, m_level(EnemyToCopy.m_level), m_isActive(EnemyToCopy.m_isActive){	m_enemyUpVision = new sf::FloatRect(*(EnemyToCopy.m_enemyUpVision));	m_enemyGroundVision = new sf::FloatRect(*(EnemyToCopy.m_enemyGroundVision));	m_enemyleftVision = new sf::FloatRect(*(EnemyToCopy.m_enemyleftVision));	m_enemyRightVision = new sf::FloatRect(*(EnemyToCopy.m_enemyRightVision));}
开发者ID:ChristophePigeon,项目名称:Mathematicia,代码行数:16,


示例24: getch

void	snakeclass::movesnake() {  int	tmp = getch();  switch(tmp) {  case KEY_LEFT:    if (direction != 'r')      direction = 'l';    break ;  case KEY_UP:    if (direction != 'd')      direction = 'u';    break ;  case KEY_DOWN:    if (direction != 'u')      direction = 'd';    break ;  case KEY_RIGHT:    if (direction != 'l')      direction = 'r';    break ;  case KEY_BACKSPACE:    direction = 'q';    break ;  }  if (!get) {    Map.map[snake[snake.size() - 1].x][snake[snake.size() - 1].y] = '.'; //attention    snake.pop_back();  }  if (direction == 'l')    snake.insert(snake.begin(), Character(snake[0].x, snake[0].y - 1));  else if (direction == 'r')    snake.insert(snake.begin(), Character(snake[0].x, snake[0].y + 1));  else if (direction == 'u')    snake.insert(snake.begin(), Character(snake[0].x - 1, snake[0].y));  else if (direction == 'd')    snake.insert(snake.begin(), Character(snake[0].x + 1, snake[0].y));  Map.map[snake[0].x][snake[0].y] = 'X'; //attention}
开发者ID:simbaste,项目名称:snake,代码行数:38,


示例25: reachedPortal

Player::Player(TextureHolder *textures,  sf::Font *gameFont, int playerNumber):    reachedPortal(false),    reachedPortalFirst(false),    human(false),    reachPortalMode(false){    number = playerNumber;    frozenLeft = 0;    done = false;    active = false;    this->textures = textures;    characters.push_back(Character (this->textures, playerNumber));    this->pos = playerNumber;    food = 0;    cash = 0;    energy = 0;    faith = 0;    txtCash.setFont(*gameFont);    txtCash.setCharacterSize(20);    txtFood.setFont(*gameFont);    txtEnergy.setFont(*gameFont);    txtFaith.setFont(*gameFont);    txtNextRound.setFont(*gameFont);    txtNextRound.setString("End Turn");    txtNextRound.setCharacterSize(12);    txtNextRound.setPosition(40,(playerNumber*100)+10);    int posX1 = 82;    int posX2 = 962;    int posY1 = 22;    int posY2 = 720;    std::array<std::array<int,2>,4> textPos = {{{        {posX1,posY1}}, {{posX2,posY1}},{{posX1,posY2}}, {{posX2, posY2}    }}};    txtCash.setPosition(textPos[playerNumber][0],textPos[playerNumber][1] );    buttons.insert({"end_turn",rectangle});    setSpriteAI();}
开发者ID:chiefexb,项目名称:deerportal,代码行数:49,


示例26: common_initialize_environment_nolock

static int __cdecl common_initialize_environment_nolock() throw(){    typedef __crt_char_traits<Character> traits;    // We only initialize the environment once.  Once the environment has been    // initialized, all updates and modifications go through the other functions    // that manipulate the environment.    if (get_environment_nolock(Character()))        return 0;    pre_initialize(Character());    __crt_unique_heap_ptr<Character> const os_environment(traits::get_environment_from_os());    if (!os_environment)        return -1;    __crt_unique_heap_ptr<Character*> crt_environment(create_environment(os_environment.get()));    if (!crt_environment)        return -1;    get_initial_environment(Character()) = crt_environment.get();    get_dual_state_environment_nolock(Character()).initialize(crt_environment.detach());    return 0;}
开发者ID:DinrusGroup,项目名称:DinrusUcrtBased,代码行数:24,


示例27: common_get_or_create_environment_nolock

static Character** __cdecl common_get_or_create_environment_nolock() throw(){    typedef __crt_char_traits<Character> traits;    typedef typename traits::other_char_type other_char_type;    // Check to see if the required environment already exists:    Character** const existing_environment = get_environment_nolock(Character());    if (existing_environment)        return existing_environment;    // Check to see if the other environment exists.  We will only initialize    // the environment here if the other environment was already initialized.    other_char_type** const other_environment = get_environment_nolock(other_char_type());    if (!other_environment)        return nullptr;    if (common_initialize_environment_nolock<Character>() != 0)        return nullptr;    if (initialize_environment_by_cloning_nolock<Character>() != 0)        return nullptr;    return get_environment_nolock(Character());}
开发者ID:DinrusGroup,项目名称:DinrusUcrtBased,代码行数:24,


示例28: Load

    void SoundManager::Load()    {		//this->mClientTransmissionManager.GetClientSessionManager().RegisterAudioEventListener(this);		this->mAudioDevice = this->mAudioDeviceFactory.CreateDevice();		if(this->mAudioDevice!=NULL)		{    			this->mAudioDevice->Init(this->margc,this->margv);			this->mAudioDevice->Load();			//set default listener.			this->UpdateListenerValues(Character());		}    }
开发者ID:pazuzu156,项目名称:Enigma,代码行数:16,



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


C++ ChatHandler函数代码示例
C++ CharToWide函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。