void ETHPhysicsEntityController::Update(const float lastFrameElapsedTime, ETHBucketManager& buckets) { if (!m_body) return; if (!m_body->IsActive()) return; GS2D_UNUSED_ARGUMENT(lastFrameElapsedTime); const Vector2 pos = ETHPhysicsSimulator::ScaleFromBox2D(m_body->GetPosition()); const Vector2 oldPos = Vector2(m_pos.x, m_pos.y); if (oldPos != pos) { m_pos = Vector3(pos, GetPos().z); buckets.RequestBucketMove(static_cast<ETHEntity*>(m_body->GetUserData()), oldPos, pos); } m_angle =-RadianToDegree(m_body->GetAngle()); }
bool ETHVertexLightDiffuse::BeginLightPass(ETHSpriteEntity *pRender, Vector3 &v3LightPos, const Vector2 &v2Size, const ETHLight* light, const float maxHeight, const float minHeight, const float lightIntensity, const bool drawToTarget) { GS2D_UNUSED_ARGUMENT(drawToTarget); const Vector2 &v2Origin = pRender->ComputeOrigin(v2Size); const Vector3 &v3EntityPos = pRender->GetPosition(); m_video->SetPixelShader(ShaderPtr()); ShaderPtr pLightShader; if (pRender->GetType() == ETH_VERTICAL) { m_vVertexLightVS->SetConstant(GS_L("spaceLength"), (maxHeight-minHeight)); m_vVertexLightVS->SetConstant(GS_L("topLeft3DPos"), v3EntityPos-(Vector3(v2Origin.x, 0, -v2Origin.y))); pLightShader = m_vVertexLightVS; } else { m_hVertexLightVS->SetConstant(GS_L("topLeft3DPos"), v3EntityPos-Vector3(v2Origin, 0)); pLightShader = m_hVertexLightVS; } m_video->SetVertexShader(pLightShader); m_lastAM = m_video->GetAlphaMode(); m_video->SetAlphaMode(GSAM_ADD); // Set a depth value depending on the entity type pRender->SetDepth(maxHeight, minHeight); pLightShader->SetConstant(GS_L("pivotAdjust"), pRender->GetProperties()->pivotAdjust); pLightShader->SetConstant(GS_L("lightPos"), v3LightPos); pLightShader->SetConstant(GS_L("lightRange"), light->range); pLightShader->SetConstant(GS_L("lightColor"), light->color); pLightShader->SetConstant(GS_L("lightIntensity"), lightIntensity); return true; }
bool GLES2UniformParameter::IsEqualToAlreadyDefinedParam(const GLuint& program, const int& location, const GLES2UniformParameter* param, const Platform::FileLogger& logger) { GS2D_UNUSED_ARGUMENT(logger); std::map<GLuint, std::map<int, boost::shared_ptr<GLES2UniformParameter> > >::iterator mapIter = m_params.find(program); if (mapIter != m_params.end()) { std::map<int, boost::shared_ptr<GLES2UniformParameter> >::iterator iter = mapIter->second.find(location); if (iter != mapIter->second.end()) { return param->IsEqual((iter->second).get()); } else { return false; } } else { return false; } }
bool ETHRectangleDrawer::Draw(const unsigned long lastFrameElapsedTimeMS) { GS2D_UNUSED_ARGUMENT(lastFrameElapsedTimeMS); return provider->GetVideo()->DrawRectangle(v2Pos, v2Size, color0, color1, color2, color3, 0.0f); }
ETHNoDynamicBackBuffer::ETHNoDynamicBackBuffer(const gs2d::VideoPtr& video, const gs2d::math::Vector2& size) : m_video(video) { GS2D_UNUSED_ARGUMENT(size); }
bool ETHParticleManager::CreateParticleSystem( const ETHParticleSystem& partSystem, const Vector2& v2Pos, const Vector3& v3Pos, const float angle, const float entityVolume, const float scale) { GS2D_UNUSED_ARGUMENT(v3Pos); if (partSystem.nParticles <= 0) { ETH_STREAM_DECL(ss) << GS_L("ETHParticleManager::CreateParticleSystem: The number of particles must be greater than 0."); m_provider->Log(ss.str(), Platform::FileLogger::ERROR); return false; } m_finished = false; m_killed = false; m_nActiveParticles = 0; m_soundVolume = 1.0f; m_isSoundLooping = false; m_isSoundStopped = false; m_generalVolume = 1.0f; m_system = partSystem; m_entityVolume = entityVolume; m_system.Scale(scale); if (m_system.bitmapFile.empty()) { m_system.bitmapFile = ETH_DEFAULT_PARTICLE_BITMAP; } ETHGraphicResourceManagerPtr graphics = m_provider->GetGraphicResourceManager(); ETHAudioResourceManagerPtr samples = m_provider->GetAudioResourceManager(); Platform::FileIOHubPtr fileIOHub = m_provider->GetFileIOHub(); Platform::FileManagerPtr fileManager = m_provider->GetFileManager(); // if there's no resource path, search the current module's path const str_type::string& resourcePath = fileIOHub->GetResourceDirectory(); const str_type::string& programPath = fileIOHub->GetProgramDirectory(); const str_type::string currentPath = (resourcePath.empty() && !fileManager->IsPacked()) ? programPath : resourcePath; m_pBMP = graphics->GetPointer(m_provider->GetVideo(), m_system.bitmapFile, currentPath, ETHDirectories::GetParticlesDirectory(), (m_system.alphaMode == Video::AM_ADD)); // find the particle sound effect if (m_system.soundFXFile != GS_L("")) { m_pSound = samples->GetPointer(m_provider->GetAudio(), m_provider->GetFileIOHub(), m_system.soundFXFile, ETHDirectories::GetSoundFXDirectory(), Audio::SOUND_EFFECT); } if (m_system.allAtOnce) { m_nActiveParticles = m_system.nParticles; } else { m_nActiveParticles = 0; } m_particles.resize(m_system.nParticles); Matrix4x4 rot = RotateZ(DegreeToRadian(angle)); for (int t = 0; t < m_system.nParticles; t++) { m_particles[t].id = t; m_particles[t].released = false; ResetParticle(t, v2Pos, Vector3(v2Pos,0), angle, rot); } return true; }
GS2D_API InputPtr CreateInput(boost::any data, const bool showJoystickWarnings) { GS2D_UNUSED_ARGUMENT(data); return InputPtr(new SDLInput(showJoystickWarnings)); }
GS_KEY_STATE SDLInput::GetTouchState(const unsigned int n, WindowPtr pWindow) const { GS2D_UNUSED_ARGUMENT(n); GS2D_UNUSED_ARGUMENT(pWindow); return GetLeftClickState(); }
math::Vector2 SDLInput::GetTouchPos(const unsigned int n, WindowPtr pWindow) const { GS2D_UNUSED_ARGUMENT(n); return GetCursorPositionF(pWindow); }
math::Vector2 SDLInput::GetCursorPositionF(WindowPtr pWindow) const { GS2D_UNUSED_ARGUMENT(pWindow); return math::ToVector2(m_cursorPos); }
math::Vector2i SDLInput::GetCursorPosition(WindowPtr pWindow) const { GS2D_UNUSED_ARGUMENT(pWindow); return m_cursorPos; }
void ETHDestructionListener::SayGoodbye(b2Fixture* fixture) { GS2D_UNUSED_ARGUMENT(fixture); // Let's not say goodbye to these guys }
void ETHRawEntityController::Update(const unsigned long lastFrameElapsedTime, ETHBucketManager& buckets) { GS2D_UNUSED_ARGUMENT(lastFrameElapsedTime); GS2D_UNUSED_ARGUMENT(buckets); // TODO/TO-DO }
void ETHRawEntityController::Scale(const Vector2& scale, ETHEntity* entity) { GS2D_UNUSED_ARGUMENT(scale); GS2D_UNUSED_ARGUMENT(entity); }
bool ETHEntityDefaultChooser::Choose(ETHEntity* entity) const { GS2D_UNUSED_ARGUMENT(entity); return true; }