particle hit effect
This commit is contained in:
1 parent
2b875dfc2d
commit
6bd38df453
13 files changed
+427
-18
No files matched your search
@@ -323,6 +323,11 @@ void TBall::Go()
|
||||
void TBall::ReflectToLeft()
|
||||
{
|
||||
*SE::Console << "TBall::ReflectToLeft";
|
||||
|
||||
Application->lsparkler.setCoords({Pos(0),Pos(1),0});
|
||||
Application->lsparkler.stopSpawn();
|
||||
Application->lsparkler.startSpawn();
|
||||
|
||||
if (Velocity(0) > 0.f)
|
||||
{
|
||||
Velocity(0) = - Velocity(0);
|
||||
@@ -332,6 +337,11 @@ void TBall::ReflectToLeft()
|
||||
void TBall::ReflectToRight()
|
||||
{
|
||||
*SE::Console << "TBall::ReflectToRight";
|
||||
|
||||
Application->rsparkler.setCoords({ Pos(0),Pos(1),0 });
|
||||
Application->rsparkler.stopSpawn();
|
||||
Application->rsparkler.startSpawn();
|
||||
|
||||
if (Velocity(0) < 0.f)
|
||||
{
|
||||
Velocity(0) = - Velocity(0);
|
||||
@@ -341,6 +351,11 @@ void TBall::ReflectToRight()
|
||||
void TBall::ReflectToUp()
|
||||
{
|
||||
*SE::Console << "TBall::ReflectToUp";
|
||||
|
||||
Application->tsparkler.setCoords({ Pos(0),Pos(1),0 });
|
||||
Application->tsparkler.stopSpawn();
|
||||
Application->tsparkler.startSpawn();
|
||||
|
||||
if (Velocity(1) < 0.f)
|
||||
{
|
||||
Velocity(1) = - Velocity(1);
|
||||
@@ -350,6 +365,11 @@ void TBall::ReflectToUp()
|
||||
void TBall::ReflectToDown()
|
||||
{
|
||||
*SE::Console << "TBall::ReflectToDown";
|
||||
|
||||
Application->bsparkler.setCoords({ Pos(0),Pos(1),0 });
|
||||
Application->bsparkler.stopSpawn();
|
||||
Application->bsparkler.startSpawn();
|
||||
|
||||
if (Velocity(1) > 0.f)
|
||||
{
|
||||
Velocity(1) = - Velocity(1);
|
||||
|
||||
+63
-3
@@ -85,11 +85,19 @@ void TMyApplication::InnerInit()
|
||||
GameState = CONST_GAMESTATE_PRELOADING;
|
||||
StateTimer = 0.f;
|
||||
|
||||
|
||||
/*
|
||||
ResourceManager->ShaderManager.AddShader("DefaultShader", "shader1vertex.txt", "shader1fragment.txt");
|
||||
ResourceManager->ShaderManager.AddShader("FrameShader", "frameshader_vertex.txt", "frameshader_fragment.txt");
|
||||
ResourceManager->ShaderManager.AddShader("BrickShader", "brickshader_vertex.txt", "brickshader_fragment.txt");
|
||||
Renderer->PushShader("DefaultShader");
|
||||
*/
|
||||
|
||||
ResourceManager->ShaderManager.AddShader("DefaultShader", "shaders/texture-shader.vertex", "shaders/texture-shader.fragment");
|
||||
ResourceManager->ShaderManager.AddShader("ColorShader", "shaders/color-shader.vertex", "shaders/color-shader.fragment");
|
||||
ResourceManager->ShaderManager.AddShader("FrameShader", "shaders/frameshader_vertex.txt", "shaders/frameshader_fragment.txt");
|
||||
ResourceManager->ShaderManager.AddShader("BrickShader", "shaders/brickshader_vertex.txt", "shaders/brickshader_fragment.txt");
|
||||
ResourceManager->ShaderManager.AddShader(ParticleEffect::PARTICLE_SHADER, "shaders/particle-shader.vertex", "shaders/particle-shader.fragment");
|
||||
Renderer->PushShader("DefaultShader");
|
||||
|
||||
ResourceManager->TexList.AddTexture(CONST_LOADING_BACKGROUND_BLACK + ".png", CONST_LOADING_BACKGROUND_BLACK);
|
||||
ResourceManager->TexList.AddTexture(CONST_LOADING_TEXTURE + ".png", CONST_LOADING_TEXTURE);
|
||||
@@ -108,6 +116,7 @@ void TMyApplication::InnerInit()
|
||||
Renderer->SetFullScreenViewport();
|
||||
Application->SetGameLevelScreenScale();
|
||||
//GameLevel.SetLevelScale();
|
||||
EffectsInit();
|
||||
|
||||
}
|
||||
|
||||
@@ -327,10 +336,10 @@ void TMyApplication::InnerDraw()
|
||||
{
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
|
||||
sparkler.draw();
|
||||
|
||||
OnDrawSignal();
|
||||
|
||||
EffectsDraw();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -376,6 +385,7 @@ void TMyApplication::InnerUpdate(size_t dt)
|
||||
{
|
||||
*SE::Console << "3CONST_GAMESTATE_LEVEL";
|
||||
GameLevel.Update(dt);
|
||||
EffectsUpdate(dt);
|
||||
}
|
||||
else if (GameState == CONST_GAMESTATE_MENU)
|
||||
{
|
||||
@@ -544,3 +554,53 @@ void TMyApplication::InnerOnMouseDown(TMouseState& mouseState) {
|
||||
void TMyApplication::InnerOnMouseMove(TMouseState& mouseState) {
|
||||
|
||||
}
|
||||
|
||||
void TMyApplication::EffectsInit() {
|
||||
|
||||
boost::property_tree::ptree JSONsource;
|
||||
boost::property_tree::ptree JSONconfig;
|
||||
std::string effectJSON;
|
||||
boost::property_tree::json_parser::read_json(ST::PathToResources + "config.json", JSONconfig);
|
||||
|
||||
// LEFT
|
||||
effectJSON = JSONconfig.get<std::string>("lefteffect");
|
||||
boost::property_tree::json_parser::read_json(ST::PathToResources + effectJSON, JSONsource);
|
||||
lsparkler.parse(JSONsource); // parse JSON
|
||||
lsparkler.load(); // load textures
|
||||
// RIGHT
|
||||
effectJSON = JSONconfig.get<std::string>("righteffect");
|
||||
boost::property_tree::json_parser::read_json(ST::PathToResources + effectJSON, JSONsource);
|
||||
rsparkler.parse(JSONsource);
|
||||
rsparkler.load();
|
||||
// TOP
|
||||
effectJSON = JSONconfig.get<std::string>("topeffect");
|
||||
boost::property_tree::json_parser::read_json(ST::PathToResources + effectJSON, JSONsource);
|
||||
tsparkler.parse(JSONsource);
|
||||
tsparkler.load();
|
||||
// BOTTOM
|
||||
effectJSON = JSONconfig.get<std::string>("boteffect");
|
||||
boost::property_tree::json_parser::read_json(ST::PathToResources + effectJSON, JSONsource);
|
||||
bsparkler.parse(JSONsource);
|
||||
bsparkler.load();
|
||||
|
||||
float width = Renderer->GetScreenWidth();
|
||||
float height = Renderer->GetScreenHeight();
|
||||
|
||||
lsparkler.setCoords({ width / 2, height / 2, 0 });
|
||||
rsparkler.setCoords({ width / 2, height / 2, 0 });
|
||||
tsparkler.setCoords({ width / 2, height / 2, 0 });
|
||||
bsparkler.setCoords({ width / 2, height / 2, 0 });
|
||||
}
|
||||
|
||||
void TMyApplication::EffectsUpdate(size_t dt) {
|
||||
lsparkler.update(dt / 1000.f);
|
||||
rsparkler.update(dt / 1000.f);
|
||||
tsparkler.update(dt / 1000.f);
|
||||
bsparkler.update(dt / 1000.f);
|
||||
}
|
||||
void TMyApplication::EffectsDraw() {
|
||||
lsparkler.draw();
|
||||
rsparkler.draw();
|
||||
tsparkler.draw();
|
||||
bsparkler.draw();
|
||||
}
|
||||
+6
-1
@@ -114,15 +114,18 @@ protected:
|
||||
void ApplySignalsToCredits();
|
||||
void DisapplySignalsToCredits();
|
||||
|
||||
void EffectsInit();
|
||||
|
||||
// Mouse new methods
|
||||
virtual void InnerOnMouseDown(TMouseState& mouseState);
|
||||
virtual void InnerOnMouseMove(TMouseState& mouseState);
|
||||
|
||||
ParticleEffect sparkler;
|
||||
|
||||
public:
|
||||
bool Loaded;
|
||||
|
||||
ParticleEffect lsparkler, rsparkler, tsparkler, bsparkler; // Diffrent directed reflection effects
|
||||
|
||||
TMyApplication() : TApplication(), Loaded(false), Inited(false) { }
|
||||
|
||||
virtual void InnerInit();
|
||||
@@ -139,6 +142,8 @@ public:
|
||||
void GoFromCreditsToMenu();
|
||||
void MarkSetGameLevelPause();
|
||||
void MarkReleaseGameLevelPause();
|
||||
void EffectsUpdate(size_t dt);
|
||||
void EffectsDraw();
|
||||
|
||||
void OpenNextLevel();
|
||||
|
||||
|
||||
Reference in new issue
Block a user