Merge remote-tracking branch 'origin/master' into LevelSystemAndSuch.

This commit is contained in:
PlatinumSkink
2015-09-29 11:21:35 +02:00
10 changed files with 36 additions and 30 deletions
+1
View File
@@ -3,3 +3,4 @@
/lib/ /lib/
# CLion # CLion
.idea/ .idea/
.orig
@@ -1,6 +1,6 @@
# Blender v2.75 (sub 0) OBJ File: 'submarine.blend' # Blender v2.75 (sub 0) OBJ File: 'submarine.blend'
# www.blender.org # www.blender.org
mtllib submarine2.mtl mtllib Submarine2.mtl
o Cube o Cube
v -0.378953 -0.002680 -0.065172 v -0.378953 -0.002680 -0.065172
v 0.212611 0.044805 -0.044067 v 0.212611 0.044805 -0.044067
-1
View File
@@ -34,7 +34,6 @@
#include "Game/PadSystem.h" #include "Game/PadSystem.h"
#include <fstream> #include <fstream>
#include <iostream> #include <iostream>
#include <intrin.h>
namespace dd namespace dd
{ {
+2 -2
View File
@@ -57,8 +57,8 @@ public:
private: private:
b2Vec2 m_Gravity; b2Vec2 m_Gravity;
b2World* m_PhysicsWorld; b2World* m_PhysicsWorld;
float m_TimeStep; double m_TimeStep;
float m_Accumulator; double m_Accumulator;
int m_VelocityIterations, m_PositionIterations; int m_VelocityIterations, m_PositionIterations;
+3 -3
View File
@@ -13,9 +13,9 @@ void dd::Systems::BallSystem::RegisterComponents(ComponentFactory *cf)
void dd::Systems::BallSystem::Initialize() void dd::Systems::BallSystem::Initialize()
{ {
EVENT_SUBSCRIBE_MEMBER(m_Contact, BallSystem::Contact); EVENT_SUBSCRIBE_MEMBER(m_Contact, &BallSystem::Contact);
EVENT_SUBSCRIBE_MEMBER(m_ELifeLost, BallSystem::OnLifeLost); EVENT_SUBSCRIBE_MEMBER(m_ELifeLost, &BallSystem::OnLifeLost);
EVENT_SUBSCRIBE_MEMBER(m_EMultiBallLost, BallSystem::OnMultiBallLost); EVENT_SUBSCRIBE_MEMBER(m_EMultiBallLost, &BallSystem::OnMultiBallLost);
EVENT_SUBSCRIBE_MEMBER(m_EResetBall, &BallSystem::OnResetBall); EVENT_SUBSCRIBE_MEMBER(m_EResetBall, &BallSystem::OnResetBall);
EVENT_SUBSCRIBE_MEMBER(m_EMultiBall, &BallSystem::OnMultiBall); EVENT_SUBSCRIBE_MEMBER(m_EMultiBall, &BallSystem::OnMultiBall);
} }
+7 -7
View File
@@ -9,13 +9,13 @@
void dd::Systems::LevelSystem::Initialize() void dd::Systems::LevelSystem::Initialize()
{ {
EVENT_SUBSCRIBE_MEMBER(m_EContact, LevelSystem::OnContact); EVENT_SUBSCRIBE_MEMBER(m_EContact, &LevelSystem::OnContact);
EVENT_SUBSCRIBE_MEMBER(m_EScoreEvent, LevelSystem::OnScoreEvent); EVENT_SUBSCRIBE_MEMBER(m_EScoreEvent, &LevelSystem::OnScoreEvent);
EVENT_SUBSCRIBE_MEMBER(m_EMultiBall, LevelSystem::OnMultiBall); EVENT_SUBSCRIBE_MEMBER(m_EMultiBall, &LevelSystem::OnMultiBall);
EVENT_SUBSCRIBE_MEMBER(m_EMultiBallLost, LevelSystem::OnMultiBallLost); EVENT_SUBSCRIBE_MEMBER(m_ECreatePowerUp, &LevelSystem::OnCreatePowerUp);
EVENT_SUBSCRIBE_MEMBER(m_ECreatePowerUp, LevelSystem::OnCreatePowerUp); EVENT_SUBSCRIBE_MEMBER(m_EMultiBallLost, &LevelSystem::OnMultiBallLost);
EVENT_SUBSCRIBE_MEMBER(m_EPowerUpTaken, LevelSystem::OnPowerUpTaken); EVENT_SUBSCRIBE_MEMBER(m_EPowerUpTaken, &LevelSystem::OnPowerUpTaken);
EVENT_SUBSCRIBE_MEMBER(m_EStageCleared, LevelSystem::OnStageCleared); EVENT_SUBSCRIBE_MEMBER(m_EStageCleared, &LevelSystem::OnStageCleared);
/*for (int i = 0; i < Lives(); i++) { /*for (int i = 0; i < Lives(); i++) {
CreateLife(i); CreateLife(i);
+5 -5
View File
@@ -15,16 +15,16 @@ void dd::Systems::PhysicsSystem::Initialize()
m_Gravity = b2Vec2(0.f, -9.82f); m_Gravity = b2Vec2(0.f, -9.82f);
m_PhysicsWorld = new b2World(m_Gravity); m_PhysicsWorld = new b2World(m_Gravity);
m_TimeStep = 1.f/60.f; m_TimeStep = 1.0/60.0;
m_VelocityIterations = 6; m_VelocityIterations = 6;
m_PositionIterations = 2; m_PositionIterations = 2;
m_Accumulator = 0.f; m_Accumulator = 0.0;
m_PhysicsWorld->SetContactListener(m_ContactListener); m_PhysicsWorld->SetContactListener(m_ContactListener);
InitializeWater(); InitializeWater();
EVENT_SUBSCRIBE_MEMBER(m_SetImpulse, PhysicsSystem::SetImpulse); EVENT_SUBSCRIBE_MEMBER(m_SetImpulse, &PhysicsSystem::SetImpulse);
} }
void dd::Systems::PhysicsSystem::InitializeWater() void dd::Systems::PhysicsSystem::InitializeWater()
@@ -268,7 +268,7 @@ void dd::Systems::PhysicsSystem::CreateBody(EntityID entity)
if(physicsComponent->Static) { if(physicsComponent->Static) {
body->CreateFixture(&fixtureDef); //Density kanske ska vara 0 på statiska kroppar body->CreateFixture(&fixtureDef); //Density kanske ska vara 0 p statiska kroppar
} }
else { else {
fixtureDef.shape = pShape; fixtureDef.shape = pShape;
@@ -289,7 +289,7 @@ void dd::Systems::PhysicsSystem::CreateBody(EntityID entity)
void dd::Systems::PhysicsSystem::CreateParticleGroup(EntityID e) void dd::Systems::PhysicsSystem::CreateParticleGroup(EntityID e)
{ {
//TODO: Lägg alla pd i en lista //TODO: Lgg alla pd i en lista
auto transform = m_World->GetComponent<Components::Transform>(e); auto transform = m_World->GetComponent<Components::Transform>(e);
if (!transform) { if (!transform) {
LOG_ERROR("No Transform component in CreateParticleGroup"); LOG_ERROR("No Transform component in CreateParticleGroup");
+10 -10
View File
@@ -26,7 +26,7 @@ ALuint dd::Sound::LoadFile(std::string path)
return 0; return 0;
} }
fread(&m_Size, sizeof(unsigned long), 1, fp); fread(&m_Size, 4*sizeof(char), 1, fp);
fread(m_Type, sizeof(char), 4, fp); fread(m_Type, sizeof(char), 4, fp);
if (m_Type[0] != 'W' || m_Type[1] != 'A' || m_Type[2] != 'V' || m_Type[3]!= 'E') { if (m_Type[0] != 'W' || m_Type[1] != 'A' || m_Type[2] != 'V' || m_Type[3]!= 'E') {
LOG_ERROR("ERROR: Not WAVE-file"); LOG_ERROR("ERROR: Not WAVE-file");
@@ -40,13 +40,13 @@ ALuint dd::Sound::LoadFile(std::string path)
} }
//READ THE DATA FROM WAVE-FILE //READ THE DATA FROM WAVE-FILE
fread(&m_ChunkSize, sizeof(unsigned long), 1, fp); fread(&m_ChunkSize, 4*sizeof(char), 1, fp);
fread(&m_FormatType, sizeof(short), 1, fp); fread(&m_FormatType, 2*sizeof(char), 1, fp);
fread(&m_Channels, sizeof(short), 1, fp); fread(&m_Channels, 2*sizeof(char), 1, fp);
fread(&m_SampleRate, sizeof(unsigned long), 1, fp); fread(&m_SampleRate, 4*sizeof(char), 1, fp);
fread(&m_AvgBytesPerSec, sizeof(unsigned long), 1, fp); fread(&m_AvgBytesPerSec, 4*sizeof(char), 1, fp);
fread(&m_BytesPerSample, sizeof(short), 1, fp); fread(&m_BytesPerSample, 2*sizeof(char), 1, fp);
fread(&m_BitsPerSample, sizeof(short), 1, fp); fread(&m_BitsPerSample, 2*sizeof(char), 1, fp);
fread(m_Type, sizeof(char), 4, fp); fread(m_Type, sizeof(char), 4, fp);
if (m_Type[0] !='d' || m_Type[1] != 'a' || m_Type[2] != 't' || m_Type[3] != 'a') { if (m_Type[0] !='d' || m_Type[1] != 'a' || m_Type[2] != 't' || m_Type[3] != 'a') {
@@ -54,10 +54,10 @@ ALuint dd::Sound::LoadFile(std::string path)
return 0; return 0;
} }
fread(&m_DataSize, sizeof(unsigned long), 1, fp); fread(&m_DataSize, 4*sizeof(char), 1, fp);
unsigned char* buf = new unsigned char[m_DataSize]; unsigned char* buf = new unsigned char[m_DataSize];
fread(buf, sizeof(unsigned char), m_DataSize, fp); fread(buf, sizeof(char), m_DataSize, fp);
fclose(fp); fclose(fp);
// Create buffer // Create buffer
+6
View File
@@ -1,6 +1,12 @@
#ifndef NAMESPACE_FILENAME_H__ #ifndef NAMESPACE_FILENAME_H__
#define NAMESPACE_FILENAME_H__ #define NAMESPACE_FILENAME_H__
#include <standard_library>
#include <external_dependency>
#include "Internal/Header.h"
namespace dd namespace dd
{ {