bool LIB_TEXT::Save( OUTPUTFORMATTER& aFormatter ) { wxString text = m_Text; if( text.Contains( wxT( "~" ) ) || text.Contains( wxT( "\"" ) ) ) { // convert double quote to similar-looking two apostrophes text.Replace( wxT( "\"" ), wxT( "''" ) ); text = wxT( "\"" ) + text + wxT( "\"" ); } else { // Spaces are not allowed in text because it is not double quoted: // changed to '~' text.Replace( wxT( " " ), wxT( "~" ) ); } aFormatter.Print( 0, "T %g %d %d %d %d %d %d %s ", GetOrientation(), m_Pos.x, m_Pos.y, m_Size.x, m_Attributs, m_Unit, m_Convert, TO_UTF8( text ) ); aFormatter.Print( 0, " %s %d", m_Italic ? "Italic" : "Normal", ( m_Bold > 0 ) ? 1 : 0 ); char hjustify = 'C'; if( m_HJustify == GR_TEXT_HJUSTIFY_LEFT ) hjustify = 'L'; else if( m_HJustify == GR_TEXT_HJUSTIFY_RIGHT ) hjustify = 'R'; char vjustify = 'C'; if( m_VJustify == GR_TEXT_VJUSTIFY_BOTTOM ) vjustify = 'B'; else if( m_VJustify == GR_TEXT_VJUSTIFY_TOP ) vjustify = 'T'; aFormatter.Print( 0, " %c %c\n", hjustify, vjustify ); return true; }
void Transport::TeleportTransport(uint32 newMapid, float x, float y, float z) { Map const* oldMap = GetMap(); Relocate(x, y, z); // we need to create and save new Map object with 'newMapid' because if not done -> lead to invalid Map object reference... // player far teleport would try to create same instance, but we need it NOW for transport... RemoveFromWorld(); ResetMap(); Map* newMap = sMapMgr->CreateBaseMap(newMapid); SetMap(newMap); ASSERT(GetMap()); AddToWorld(); for (UnitSet::iterator itr = _passengers.begin(); itr != _passengers.end();) { Unit* passenger = *itr; ++itr; switch (passenger->GetTypeId()) { case TYPEID_UNIT: passenger->ToCreature()->FarTeleportTo(newMap, x, y, z, passenger->GetOrientation()); break; case TYPEID_PLAYER: if (passenger->isDead() && !passenger->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST)) passenger->ToPlayer()->ResurrectPlayer(1.0f); passenger->ToPlayer()->TeleportTo(newMapid, x, y, z, GetOrientation(), TELE_TO_NOT_LEAVE_TRANSPORT); break; } } if (oldMap != newMap) { UpdateForMap(oldMap); UpdateForMap(newMap); } MoveToNextWayPoint(); }
void Transport::TeleportTransport(uint32 newMapid, float x, float y, float z) { Map const* oldMap = GetMap(); SetMapId(newMapid); Relocate(x, y, z); for (PlayerSet::iterator itr = m_passengers.begin(); itr != m_passengers.end();) { PlayerSet::iterator it2 = itr; ++itr; Player *plr = *it2; if (!plr) { m_passengers.erase(it2); continue; } if (plr->isDead() && !plr->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST)) { plr->ResurrectPlayer(1.0); } plr->TeleportTo(newMapid, x, y, z, GetOrientation(), TELE_TO_NOT_LEAVE_TRANSPORT); //WorldPacket data(SMSG_811, 4); //data << uint32(0); //plr->BroadcastPacketToSelf(&data); } Map* newMap = sMapMgr.CreateMap(newMapid, this); SetMap(newMap); if (oldMap != newMap) { UpdateForMap(oldMap); UpdateForMap(newMap); } }
void Transport::TeleportTransport(uint32 newMapid, float x, float y, float z) { Map const* oldMap = GetMap(); Relocate(x, y, z); for (PlayerSet::iterator itr = m_passengers.begin(); itr != m_passengers.end();) { PlayerSet::iterator it2 = itr; ++itr; Player* plr = *it2; if (!plr) { m_passengers.erase(it2); continue; } if (plr->isDead() && !plr->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST)) { plr->ResurrectPlayer(1.0); } plr->TeleportTo(newMapid, x, y, z, GetOrientation(), TELE_TO_NOT_LEAVE_TRANSPORT); // WorldPacket data(SMSG_811, 4); // data << uint32(0); // plr->GetSession()->SendPacket(&data); } // we need to create and save new Map object with 'newMapid' because if not done -> lead to invalid Map object reference... // player far teleport would try to create same instance, but we need it NOW for transport... // correct me if I'm wrong O.o Map* newMap = sMapMgr.CreateMap(newMapid, this); SetMap(newMap); if (oldMap != newMap) { UpdateForMap(oldMap); UpdateForMap(newMap); } }
void SCH_TEXT::MirrorX( int aXaxis_position ) { // Text is NOT really mirrored; it is moved to a suitable position // which is the closest position for a true mirrored text // The center position is mirrored and the text is moved for half // horizontal len int py = m_Pos.y; int dy; switch( GetOrientation() ) { case 0: /* horizontal text */ dy = -m_Size.y / 2; break; case 1: /* Vert Orientation UP */ dy = -LenSize( m_Text ) / 2; break; case 2: /* invert horizontal text*/ dy = m_Size.y / 2; // how to calculate text height? break; case 3: /* Vert Orientation BOTTOM */ dy = LenSize( m_Text ) / 2; break; default: dy = 0; break; } py += dy; py -= aXaxis_position; NEGATE( py ); py += aXaxis_position; py -= dy; m_Pos.y = py; }
void SCH_TEXT::MirrorY( int aYaxis_position ) { // Text is NOT really mirrored; it is moved to a suitable position // which is the closest position for a true mirrored text // The center position is mirrored and the text is moved for half // horizontal len int px = m_Pos.x; int dx; switch( GetOrientation() ) { case 0: /* horizontal text */ dx = LenSize( m_Text ) / 2; break; case 1: /* Vert Orientation UP */ dx = -m_Size.x / 2; break; case 2: /* invert horizontal text*/ dx = -LenSize( m_Text ) / 2; break; case 3: /* Vert Orientation BOTTOM */ dx = m_Size.x / 2; break; default: dx = 0; break; } px += dx; px -= aYaxis_position; NEGATE( px ); px += aYaxis_position; px -= dx; m_Pos.x = px; }
void SCH_HIERLABEL::MirrorY( int aYaxis_position ) { /* The hierarchical label is NOT really mirrored for an horizontal label, the schematic * orientation is changed. For a vertical label, the schematic orientation is not changed * and the label is moved to a suitable position. */ switch( GetOrientation() ) { case 0: /* horizontal text */ SetOrientation( 2 ); break; case 2: /* invert horizontal text*/ SetOrientation( 0 ); break; } m_Pos.x -= aYaxis_position; NEGATE( m_Pos.x ); m_Pos.x += aYaxis_position; }
void ProgressBar::OnRender(suic::DrawingContext * drawing) { // 先绘制背景 suic::Rect elemrect(0, 0, RenderSize().cx, RenderSize().cy); suic::TriggerPtr trg(suic::UIRender::GetTriggerByStatus(this, GetStyle())); suic::UIRender::DrawBackground(drawing, trg, &elemrect); // // 绘制进度条状态 // suic::ImageBrushPtr bkgnd(trg->GetValue(_T("Thumb"))); if (bkgnd) { suic::Rect rcdraw(elemrect); // 水平 if (GetOrientation() == CoreFlags::Horizontal) { LONG iOff = (LONG)((GetValue() - Minimum()) * (double)(rcdraw.right - rcdraw.left) / (Maximum() - Minimum())); rcdraw.right = rcdraw.left + iOff; } else { LONG iOff = (LONG)((double)(rcdraw.bottom - rcdraw.top) * (GetValue() - Minimum()) / (Maximum() - Minimum())); rcdraw.top = rcdraw.bottom - iOff; } if (!rcdraw.Empty()) { bkgnd->Draw(drawing, &rcdraw); } } suic::UIRender::DrawText(drawing, GetText(), trg, &elemrect , GetHorizontalContentAlignment(), GetVerticalContentAlignment()); }
void AngularlyOrderedGraph::Initialize(vector<Vertex<FragmentInfo>*>& v, vector<ContourEQW>& contours, FragmentInfo& start, FragmentInfo& end) { for(int i=0; i<vertices.size(); ++i) { delete vertices[i]; } vertices.clear(); for(int i=0; i<v.size(); ++i) { Vertex<FragmentInfo>* u = new Vertex<FragmentInfo>(v[i]->key); *u = *(v[i]); vertices.push_back(u); } vertices = orderVertices(vertices, contours, click); source = findVertex(vertices, start); assert(source); dest = findVertex(vertices, end); assert(dest); if(GetOrientation(start, end, click, contours)==false) { swap(source, dest); } vertices = arrangeVertices(vertices, source); for(int i=0; i<vertices.size(); ++i) { vertices[i]->Reset(); } source->d = 0; iter = 1; }
void AreaTrigger::UpdatePolygonOrientation() { float newOrientation = GetOrientation(); // No need to recalculate, orientation didn't change if (G3D::fuzzyEq(_previousCheckOrientation, newOrientation)) return; _polygonVertices.assign(GetTemplate()->PolygonVertices.begin(), GetTemplate()->PolygonVertices.end()); float angleSin = std::sin(newOrientation); float angleCos = std::cos(newOrientation); // This is needed to rotate the vertices, following orientation for (Position& vertice : _polygonVertices) { float x = vertice.GetPositionX() * angleCos - vertice.GetPositionY() * angleSin; float y = vertice.GetPositionY() * angleCos + vertice.GetPositionX() * angleSin; vertice.Relocate(x, y); } _previousCheckOrientation = newOrientation; }
void ScrollBar::InternalInit() { if (GetOrientation() == CoreFlags::Horizontal) { if (GetHeight() > 0) { _decreaseBtn.SetWidth(GetHeight()); _decreaseBtn.SetHeight(GetHeight()); _increaseBtn.SetWidth(GetHeight()); _increaseBtn.SetHeight(GetHeight()); } } else { if (GetWidth() > 0) { _decreaseBtn.SetWidth(GetWidth()); _decreaseBtn.SetHeight(GetWidth()); _increaseBtn.SetWidth(GetWidth()); _increaseBtn.SetHeight(GetWidth()); } } }
void GameObject::SaveToDB() { std::stringstream ss; ss << "REPLACE INTO gameobject_spawns VALUES(" << ((m_spawn == NULL) ? 0 : m_spawn->id) << "," << GetEntry() << "," << GetMapId() << "," << GetPositionX() << "," << GetPositionY() << "," << GetPositionZ() << "," << GetOrientation() << "," << GetUInt64Value(GAMEOBJECT_ROTATION) << "," << GetFloatValue(GAMEOBJECT_PARENTROTATION) << "," << GetFloatValue(GAMEOBJECT_PARENTROTATION + 2) << "," << GetFloatValue(GAMEOBJECT_PARENTROTATION + 3) << "," << ( GetByte(GAMEOBJECT_BYTES_1, 0)? 1 : 0 ) << "," << GetUInt32Value(GAMEOBJECT_FLAGS) << "," << GetUInt32Value(GAMEOBJECT_FACTION) << "," << GetFloatValue(OBJECT_FIELD_SCALE_X) << "," << m_phaseMode << "," << m_phaseMode << ")"; WorldDatabase.Execute(ss.str().c_str()); }
void D_PAD::Flip( const wxPoint& aCentre ) { int y = GetPosition().y; MIRROR( y, aCentre.y ); // invert about x axis. SetY( y ); MIRROR( m_Pos0.y, 0 ); MIRROR( m_Offset.y, 0 ); MIRROR( m_DeltaSize.y, 0 ); SetOrientation( -GetOrientation() ); // flip pads layers // PADS items are currently on all copper layers, or // currently, only on Front or Back layers. // So the copper layers count is not taken in account SetLayerSet( FlipLayerMask( m_layerMask ) ); // Flip the basic shapes, in custom pads FlipPrimitives(); // m_boundingRadius = -1; the shape has not been changed }
suic::Size ScrollBar::MeasureOverride(const suic::Size& availableSize) { suic::Size size(availableSize); //InternalInit(); _decreaseBtn.Measure(size); _increaseBtn.Measure(size); _thumb.Measure(size); _decreasePage.Measure(size); _increasePage.Measure(size); if (GetOrientation() == CoreFlags::Horizontal) { size.cy = _decreaseBtn.GetDesiredSize().cy; } else { size.cx = _decreaseBtn.GetDesiredSize().cx; } return size; }
void Node::Translate(const Vector3& delta, TransformSpace space) { switch (space) { case TS_LOCAL: // Note: local space translation disregards local scale for scale-independent movement speed position_ += GetOrientation() * delta; break; case TS_PARENT: position_ += delta; break; case TS_WORLD: { PNode parent = parent_.lock(); position_ += (parent == scene_.lock() || !parent) ? delta : Vector3(parent->GetGlobalModelInvMatrix() * Vector4(delta, 0.0f)); break; } } MarkAsDirty(); }
void Slider::OnKeyDown(suic::KeyEventArg& e) { if (GetOrientation() == CoreFlags::Horizontal) { if (e.IsLeftArrow()) { if (GetValue() > Minimum()) { SetValue((int)GetValue() - 1); } } else if (e.IsRightArrow()) { if (GetValue() < Maximum()) { SetValue((int)GetValue() + 1); } } } else { if (e.IsUpArrow()) { if (GetValue() > Minimum()) { SetValue((int)GetValue() - 1); } } else if (e.IsDownArrow()) { if (GetValue() < Maximum()) { SetValue((int)GetValue() + 1); } } } }
void Transporter::TeleportTransport(uint32 newMapid, uint32 oldmap, float x, float y, float z) { //sEventMgr.RemoveEvents(this, EVENT_TRANSPORTER_NEXT_WAYPOINT); RemoveFromWorld(false); SetMapId(newMapid); SetPosition(x, y, z, m_position.o, false); AddToWorld(); WorldPacket packet(SMSG_TRANSFER_PENDING, 12); packet << newMapid; packet << getEntry(); packet << oldmap; for (auto passengerGuid : m_passengers) { auto passenger = objmgr.GetPlayer(passengerGuid); if (passenger == nullptr) continue; passenger->GetSession()->SendPacket(&packet); bool teleport_successful = passenger->Teleport(LocationVector(x, y, z, passenger->GetOrientation()), this->GetMapMgr()); if (!teleport_successful) { passenger->RepopAtGraveyard(passenger->GetPositionX(), passenger->GetPositionY(), passenger->GetPositionZ(), passenger->GetMapId()); } else { if (!passenger->HasUnitMovementFlag(MOVEFLAG_TRANSPORT)) { passenger->AddUnitMovementFlag(MOVEFLAG_TRANSPORT); } } } this->RespawnCreaturePassengers(); }
void RPG_DestructibleEntity::SetDestroyed() { m_isDestroyed = true; // remove the attackable component RPG_AttackableComponent* attackableComponent = static_cast<RPG_AttackableComponent*>(Components().GetComponentOfType(V_RUNTIME_CLASS(RPG_AttackableComponent))); if (attackableComponent) { RemoveComponent(attackableComponent); } vHavokRigidBody* rigidBodyComponent = static_cast<vHavokRigidBody*>(Components().GetComponentOfType(V_RUNTIME_CLASS(vHavokRigidBody))); if (rigidBodyComponent) { RemoveComponent(rigidBodyComponent); } // stop the ambient effect StopEffect(DEFX_Ambient); CreateEffect(DEFX_Destroy, GetPosition(), GetOrientation()); // remove collision if so instructed //if (m_removeCollisionAfterDestruction) { RemoveObstacle(); } if(!m_postDestructionMeshFilename.IsEmpty()) { // swap the mesh SetMesh(m_postDestructionMeshFilename); } else { DisposeObject(); } }
void PrintManager::InformTerOfCurrentPrinterSelection(CWSPrintRevisionReportDlg& dlgPrint) { TERTCHAR device[MAX_WIDTH + 1]; TERTCHAR driver[MAX_WIDTH + 1]; TERTCHAR port[MAX_WIDTH + 1]; PRINTDLG pdlg=dlgPrint.m_pd; // Get the new orietation PDEVMODE pDevMode= (PDEVMODE) GlobalLock(pdlg.hDevMode); m_NewOrient=pDevMode->dmOrientation; GlobalUnlock(pdlg.hDevMode); CString PortName = dlgPrint.GetPortName(); CString DriverName = dlgPrint.GetDriverName(); CString DeviceName = dlgPrint.GetDeviceName(); ASSERT( PortName.GetLength() <= MAX_WIDTH ); ASSERT( DriverName.GetLength() <= MAX_WIDTH ); ASSERT( DeviceName.GetLength() <= MAX_WIDTH ); tertstrcpyn((LPTSTR)device, DeviceName, MAX_WIDTH); tertstrcpyn((LPTSTR)driver, DriverName, MAX_WIDTH); tertstrcpyn((LPTSTR)port, PortName, MAX_WIDTH); // update printer selection for this view TerSetPrinter(this->m_hWnd, device, driver, port, pdlg.hDevMode); // Get the current orientation m_SaveOrient = GetOrientation(); m_iCurSectOrient = TerGetSectOrient(this->m_hWnd, -1); if(m_SaveOrient!=m_NewOrient && m_iCurSectOrient!=m_NewOrient) { TerSetSectOrient(this->m_hWnd, m_NewOrient, TRUE); } }
// Called when a pin properties changes void DIALOG_LIB_EDIT_PIN::OnPropertiesChange( wxCommandEvent& event ) { if( ! IsShown() ) // do nothing at init time return; int pinNameSize = ValueFromString( g_UserUnit, GetPinNameTextSize() ); int pinNumSize = ValueFromString( g_UserUnit, GetPadNameTextSize()); int pinOrient = LIB_PIN::GetOrientationCode( GetOrientation() ); int pinLength = ValueFromString( g_UserUnit, GetLength() ); GRAPHIC_PINSHAPE pinShape = GetStyle(); ELECTRICAL_PINTYPE pinType = GetElectricalType(); m_dummyPin->SetName( GetPinName() ); m_dummyPin->SetNameTextSize( pinNameSize ); m_dummyPin->SetNumber( GetPadName() ); m_dummyPin->SetNumberTextSize( pinNumSize ); m_dummyPin->SetOrientation( pinOrient ); m_dummyPin->SetLength( pinLength ); m_dummyPin->SetShape( pinShape ); m_dummyPin->SetVisible( GetVisible() ); m_dummyPin->SetType( pinType ); m_panelShowPin->Refresh(); }
void Corpse::SaveToDB() { // bones should not be saved to DB (would be deleted on startup anyway) MANGOS_ASSERT(GetType() != CORPSE_BONES); // prevent DB data inconsistence problems and duplicates CharacterDatabase.BeginTransaction(); DeleteFromDB(); std::ostringstream ss; ss << "INSERT INTO corpse (guid,player,position_x,position_y,position_z,orientation,map,time,corpse_type,instance) VALUES (" << GetGUIDLow() << ", " << GetOwnerGuid().GetCounter() << ", " << GetPositionX() << ", " << GetPositionY() << ", " << GetPositionZ() << ", " << GetOrientation() << ", " << GetMapId() << ", " << uint64(m_time) << ", " << uint32(GetType()) << ", " << int(GetInstanceId()) << ")"; CharacterDatabase.Execute(ss.str().c_str()); CharacterDatabase.CommitTransaction(); }
void Corpse::SaveToDB() { // prevent DB data inconsistence problems and duplicates SQLTransaction trans = CharacterDatabase.BeginTransaction(); DeleteFromDB(trans); uint16 index = 0; PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CORPSE); stmt->setUInt64(index++, GetOwnerGUID().GetCounter()); // guid stmt->setFloat (index++, GetPositionX()); // posX stmt->setFloat (index++, GetPositionY()); // posY stmt->setFloat (index++, GetPositionZ()); // posZ stmt->setFloat (index++, GetOrientation()); // orientation stmt->setUInt16(index++, GetMapId()); // mapId stmt->setUInt32(index++, GetUInt32Value(CORPSE_FIELD_DISPLAY_ID)); // displayId stmt->setString(index++, _ConcatFields(CORPSE_FIELD_ITEM, EQUIPMENT_SLOT_END)); // itemCache stmt->setUInt32(index++, GetUInt32Value(CORPSE_FIELD_BYTES_1)); // bytes1 stmt->setUInt32(index++, GetUInt32Value(CORPSE_FIELD_BYTES_2)); // bytes2 stmt->setUInt8 (index++, GetUInt32Value(CORPSE_FIELD_FLAGS)); // flags stmt->setUInt8 (index++, GetUInt32Value(CORPSE_FIELD_DYNAMIC_FLAGS)); // dynFlags stmt->setUInt32(index++, uint32(m_time)); // time stmt->setUInt8 (index++, GetType()); // corpseType stmt->setUInt32(index++, GetInstanceId()); // instanceId trans->Append(stmt); for (uint32 phaseId : GetPhases()) { index = 0; stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CORPSE_PHASES); stmt->setUInt64(index++, GetOwnerGUID().GetCounter()); // OwnerGuid stmt->setUInt32(index++, phaseId); // PhaseId trans->Append(stmt); } CharacterDatabase.CommitTransaction(trans); }
void Creature::SaveToDB() { sDatabase.BeginTransaction(); sDatabase.PExecuteLog("DELETE FROM `creature` WHERE `guid` = '%u'", m_DBTableGuid); std::ostringstream ss; ss << "INSERT INTO `creature` VALUES (" << m_DBTableGuid << "," << GetEntry() << "," << GetMapId() <<"," << GetPositionX() << "," << GetPositionY() << "," << GetPositionZ() << "," << GetOrientation() << "," << m_respawnDelay << "," //respawn time << (float) 0 << "," //spawn distance (float) << (uint32) (0) << "," //currentwaypoint << respawn_cord[0] << "," //spawn_position_x << respawn_cord[1] << "," //spawn_position_y << respawn_cord[2] << "," //spawn_position_z << (float)(0) << "," //spawn_orientation << GetHealth() << "," //curhealth << GetPower(POWER_MANA) << "," //curmana << (uint32)(m_deathState) << "," // is it really death state or just state? //or //<< (uint32)(m_state) << "," // is it really death state or just state? << GetDefaultMovementType() << "," // default movement generator type << "'')"; // should save auras sDatabase.PExecuteLog( ss.str( ).c_str( ) ); sDatabase.CommitTransaction(); }
void boss_lethonAI::SpellHitTarget(Unit* pTarget, const SpellEntry* pSpell) { if (pSpell->Id == SPELL_DRAW_SPIRIT) { auto pPlayer = pTarget->ToPlayer(); if (!pPlayer) return; float x, y, z, o; pPlayer->GetPosition(x, y, z); o = pPlayer->GetOrientation(); if (auto pShade = m_creature->SummonCreature(NPC_SPIRIT_SHADE, x, y, z, o, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, MINUTE*IN_MILLISECONDS)) { pShade->SetUInt32Value(UNIT_FIELD_BYTES_0, pPlayer->GetUInt32Value(UNIT_FIELD_BYTES_0)); pShade->InitPlayerDisplayIds(); pShade->SetDisplayId(pPlayer->GetDisplayId()); if (auto pShadeAI = static_cast<npc_spirit_shadeAI*>(pShade->AI())) pShadeAI->m_lethonGuid = m_creature->GetObjectGuid(); } } }
void D_PAD::Flip( const wxPoint& aCentre ) { int y = GetPosition().y - aCentre.y; y = -y; // invert about x axis. y += aCentre.y; SetY( y ); m_Pos0.y = -m_Pos0.y; m_Offset.y = -m_Offset.y; m_DeltaSize.y = -m_DeltaSize.y; SetOrientation( -GetOrientation() ); // flip pads layers // PADS items are currently on all copper layers, or // currently, only on Front or Back layers. // So the copper layers count is not taken in account SetLayerSet( FlipLayerMask( m_layerMask ) ); // m_boundingRadius = -1; the shape has not been changed }
float OrientationToDegrees(int orientation) { switch (GetOrientation()) { case ORIENTATION_DONT_CARE: return 0; case ORIENTATION_PORTRAIT: return 0; break; case ORIENTATION_PORTRAIT_UPSIDE_DOWN: return 180; case ORIENTATION_LANDSCAPE_RIGHT: return 90; case ORIENTATION_LANDSCAPE_LEFT: return -90; break; } assert(0); return 0; }
const sf::FloatRect Scrollbar::GetSliderRect() const { float mimimum_slider_length( Context::Get().GetEngine().GetProperty<float>( "SliderMinimumLength", shared_from_this() ) ); Adjustment::Ptr adjustment( GetAdjustment() ); auto value_range = std::max( adjustment->GetUpper() - adjustment->GetLower() - adjustment->GetPageSize(), .0f ); auto pages = std::max( ( adjustment->GetPageSize() > .0f ) ? ( ( adjustment->GetUpper() - adjustment->GetLower() ) / adjustment->GetPageSize() ) : 1.f, 1.f ); if( GetOrientation() == Orientation::HORIZONTAL ) { auto stepper_length = GetAllocation().height; auto trough_length = GetAllocation().width - 2.f * stepper_length; auto slider_length = std::max( mimimum_slider_length, trough_length / pages ); auto slider_x = stepper_length; auto slider_y = 0.f; if( value_range > .0f ) { slider_x = stepper_length + ( trough_length - slider_length ) * ( adjustment->GetValue() - adjustment->GetLower() ) / value_range; } return sf::FloatRect( slider_x, slider_y, slider_length, GetAllocation().height ); } auto stepper_length = GetAllocation().width; auto trough_length = GetAllocation().height - 2.f * stepper_length; auto slider_length = std::max( mimimum_slider_length, trough_length / pages ); auto slider_x = 0.f; auto slider_y = stepper_length; if( value_range > .0f ) { slider_y = stepper_length + ( trough_length - slider_length ) * ( adjustment->GetValue() - adjustment->GetLower() ) / value_range; } return sf::FloatRect( slider_x, slider_y, GetAllocation().width, slider_length ); }
vec3 MayaCamera::GetRightDirection() { return Quaternion::Rotate(GetOrientation(), vec3::XAxis()); }
vec3 MayaCamera::GetForwardDirection() { return Quaternion::Rotate(GetOrientation(), -vec3::ZAxis()); }
void Corpse::SaveToDB() { //save corpse to DB std::stringstream ss; ss << "DELETE FROM corpses WHERE guid = " << GetLowGUID(); CharacterDatabase.Execute(ss.str().c_str()); ss.rdbuf()->str(""); ss << "INSERT INTO corpses (guid, positionX, positionY, positionZ, orientation, zoneId, mapId, data, instanceId) VALUES (" << GetLowGUID() << ", '" << GetPositionX() << "', '" << GetPositionY() << "', '" << GetPositionZ() << "', '" << GetOrientation() << "', '" << GetZoneId() << "', '" << GetMapId() << "', '"; for (uint16 i = 0; i < m_valuesCount; i++) ss << GetUInt32Value(i) << " "; ss << "', " << GetInstanceID() << " )"; CharacterDatabase.Execute(ss.str().c_str()); }