本文整理汇总了C++中SetX函数的典型用法代码示例。如果您正苦于以下问题:C++ SetX函数的具体用法?C++ SetX怎么用?C++ SetX使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SetX函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: switch
void Game_Vehicle::LoadSystemSettings() {
switch (type) {
case None:
break;
case Boat:
SetSpriteName(Data::system.boat_name);
SetSpriteIndex(Data::system.boat_index);
bgm = Data::system.boat_music;
SetMapId(Data::treemap.start.boat_map_id);
SetX(Data::treemap.start.boat_x);
SetY(Data::treemap.start.boat_y);
break;
case Ship:
SetSpriteName(Data::system.ship_name);
SetSpriteIndex(Data::system.ship_index);
bgm = Data::system.ship_music;
SetMapId(Data::treemap.start.ship_map_id);
SetX(Data::treemap.start.ship_x);
SetY(Data::treemap.start.ship_y);
break;
case Airship:
SetSpriteName(Data::system.airship_name);
SetSpriteIndex(Data::system.airship_index);
bgm = Data::system.airship_music;
SetMapId(Data::treemap.start.airship_map_id);
SetX(Data::treemap.start.airship_x);
SetY(Data::treemap.start.airship_y);
break;
}
}
示例2: MSG_DEBUG
void Plane::Shoot(Double speed, const Point2i& target)
{
MSG_DEBUG("weapon.shoot", "Plane Shoot");
nb_dropped_bombs = 0;
last_dropped_bomb = NULL;
cible_x = target.x;
SetY(0);
distance_to_release = (int)(speed * sqrt(TWO * (GetY() + target.y)));
Point2d speed_vector;
if (ActiveCharacter().GetDirection() == DIRECTION_RIGHT) {
image->SetFlipped(false);
speed_vector.SetValues(speed, 0);
SetX(ONE - Double(image->GetWidth()));
//distance_to_release -= obus_dx;
if (distance_to_release > cible_x)
distance_to_release = 0;
} else {
image->SetFlipped(true);
speed_vector.SetValues(-speed, 0) ;
SetX(Double(GetWorld().GetWidth() - 1));
//distance_to_release += obus_dx;
if (distance_to_release > GetWorld().GetWidth()-cible_x - obus_dx)
distance_to_release = 0;
}
SetSpeedXY(speed_vector);
Camera::GetInstance()->FollowObject(this);
ObjectsList::GetRef().AddObject(this);
}
示例3: IterIrredTest
NTL_START_IMPL
long IterIrredTest(const GF2X& f)
{
long df = deg(f);
if (df <= 0) return 0;
if (df == 1) return 1;
GF2XModulus F;
build(F, f);
GF2X h;
SetX(h);
SqrMod(h, h, F);
long i, d, limit, limit_sqr;
GF2X g, X, t, prod;
SetX(X);
i = 0;
g = h;
d = 1;
limit = 2;
limit_sqr = limit*limit;
set(prod);
while (2*d <= df) {
add(t, g, X);
MulMod(prod, prod, t, F);
i++;
if (i == limit_sqr) {
GCD(t, f, prod);
if (!IsOne(t)) return 0;
set(prod);
limit++;
limit_sqr = limit*limit;
i = 0;
}
d = d + 1;
if (2*d <= deg(f)) {
SqrMod(g, g, F);
}
}
if (i > 0) {
GCD(t, f, prod);
if (!IsOne(t)) return 0;
}
return 1;
}
示例4: SetX
void Window_Base::UpdateMovement() {
if (!IsMovementActive()) {
return;
}
current_frame++;
if (IsMovementActive()) {
SetX(old_position[0] + (new_position[0] - old_position[0]) * current_frame / total_frames);
SetY(old_position[1] + (new_position[1] - old_position[1]) * current_frame / total_frames);
} else {
SetX(new_position[0]);
SetY(new_position[1]);
}
}
示例5: SetX
void NaGeVector3D::operator /= (const double &scalar)
{
if(!IsNull())
{
SetX(GetX()/scalar);
SetY(GetY()/scalar);
SetZ(GetZ()/scalar);
}
else
{
SetX(0);
SetY(0);
SetZ(0);
}
}
示例6: TurnLeft
void Game_Character::MoveDownLeft() {
if (!IsDirectionFixed()) {
if (GetDirection() % 2) {
TurnLeft();
} else {
TurnDown();
}
}
if (jumping) {
jump_plus_x--;
jump_plus_y++;
return;
}
if ((IsPassable(GetX(), GetY(), RPG::EventPage::Direction_left)
&& IsPassable(GetX() - 1, GetY(), RPG::EventPage::Direction_down))
|| (IsPassable(GetX(), GetY(), RPG::EventPage::Direction_down)
&& IsPassable(GetX(), GetY() + 1, RPG::EventPage::Direction_left))) {
SetX(GetX() - 1);
SetY(GetY() + 1);
BeginMove();
stop_count = 0;
move_failed = false;
}
}
示例7: SetX
int Game_Character::EndJump(const RPG::MoveRoute* current_route, int current_index) {
jumping = false;
if (!IsLandable(jump_x + jump_plus_x, jump_y + jump_plus_y)) {
// Reset to begin jump command and try again...
move_failed = true;
if (current_route->skippable) {
return current_index;
}
return jump_index;
}
SetX(jump_x + jump_plus_x);
SetY(jump_y + jump_plus_y);
//TODO: C++11 got round() function defined in math.h
float distance = sqrt((float)(jump_plus_x * jump_plus_x + jump_plus_y * jump_plus_y));
if (distance >= floor(distance) + 0.5) distance = ceil(distance);
else distance = floor(distance);
jump_peak = 10 + (int)distance - GetMoveSpeed();
move_count = jump_peak * 2;
stop_count = 0;
move_failed = false;
return current_index;
}
示例8: SetX
bool
ThreeSliceAttributes::CopyAttributes(const AttributeGroup *atts)
{
if(atts->TypeName() == "PointAttributes")
{
if (interactive)
{
const PointAttributes *tmp = (const PointAttributes *)atts;
const double *xyz = tmp->GetPoint();
SetX(xyz[0]);
SetY(xyz[1]);
SetZ(xyz[2]);
return true;
}
}
if(TypeName() != atts->TypeName())
return false;
// Call assignment operator.
const ThreeSliceAttributes *tmp = (const ThreeSliceAttributes *)atts;
*this = *tmp;
return true;
}
示例9: SetX
//Update event
void testEntity::OnUpdate()
{
sinVal+= sinSpeed;
SetX(startX+sin(sinVal)*100);
SetY(startY);
angle+=3;
}
示例10: Opponent
OpponentMisterKuba::OpponentMisterKuba( int x_, int y_ )
: Opponent( "misterkuba" )
, ti( 1 ) {
SetX( x_ );
SetY( y_ );
}
示例11: SetX
void OpponentMisterKuba::Update() {
if( ti.GetTime() ) {
SetX( GetX() + 10 );
ti.Update();
}
}
示例12: SetName
Character::Character(std::string fromString) {
std::vector<std::string> tokens = utils::Tokenfy(fromString, '|');
if (tokens[0] == "PLAYER_OBJECT") {
SetName(tokens[57]);
SetLastname(tokens[58]);
SetRace(tokens[59]);
SetGender(tokens[60]);
SetFace(tokens[61]);
SetSkin(tokens[62]);
SetZone(tokens[63]);
SetLevel(std::stoi(tokens[64]));
SetHp(std::stoi(tokens[65]));
SetMaxHp(std::stoi(tokens[66]));
SetBp(std::stoi(tokens[67]));
SetMaxBp(std::stoi(tokens[68]));
SetMp(std::stoi(tokens[69]));
SetMaxMp(std::stoi(tokens[70]));
SetEp(std::stoi(tokens[71]));
SetMaxEp(std::stoi(tokens[72]));
SetStrength(std::stoi(tokens[73]));
SetConstitution(std::stoi(tokens[74]));
SetIntelligence(std::stoi(tokens[75]));
SetDexterity(std::stoi(tokens[76]));
SetX(std::stof(tokens[77]));
SetY(std::stof(tokens[78]));
SetZ(std::stof(tokens[79]));
SetPitch(std::stof(tokens[80]));
SetYaw(std::stof(tokens[81]));
}
// if (tokens[0] == "NPC_OBJECT") {
//
// }
}
示例13: SetX
void Game_Vehicle::SyncWithPlayer() {
SetX(Main_Data::game_player->GetX());
SetY(Main_Data::game_player->GetY());
remaining_step = Main_Data::game_player->GetRemainingStep();
SetDirection(Main_Data::game_player->GetDirection());
SetSpriteDirection(Main_Data::game_player->GetSpriteDirection());
}
示例14: SetX
void Fire::Initialize(byte* screenPtr, byte screenWidth, byte screenHeight)
{
// fire properties
SetX(0);
SetY(0);
SetHDir(0);
SetVDir(1);
SetSpeed(8);
SetLastUpdate(0);
SetEnabled(false);
Canvas *canvas = GetCanvas();
canvas->SetWidth(1);
canvas->SetHeight(1);
canvas->SetImage(fire);
canvas->SetScreenWidth(screenWidth);
canvas->SetScreenHeight(screenHeight);
canvas->SetScreen(screenPtr);
/*
if ((canvas->GetScreen()) != screenPtr)
{
Serial.println(" test 1 - pointers diferentes");
}
if (*(canvas->GetScreen()) != *screenPtr)
{
Serial.println(" test 2 - valores de pointers diferentes");
}
Serial.println("fim fire init");
*/
}
示例15: TurnRight
void Game_Character::MoveUpRight() {
if (!IsDirectionFixed()) {
if (GetDirection() % 2) {
TurnRight();
} else {
TurnUp();
}
}
if (jumping) {
jump_plus_x++;
jump_plus_y--;
return;
}
if ((IsPassable(GetX(), GetY(), RPG::EventPage::Direction_right)
&& IsPassable(GetX() + 1, GetY(), RPG::EventPage::Direction_up))
|| (IsPassable(GetX(), GetY(), RPG::EventPage::Direction_up)
&& IsPassable(GetX(), GetY() - 1, RPG::EventPage::Direction_right))) {
SetX(GetX() + 1);
SetY(GetY() - 1);
BeginMove();
stop_count = 0;
move_failed = false;
}
}