fixed PRINT_LOG in samples
Signed-off-by: h4570 <sandro.sobczynski@gmail.com>
This commit is contained in:
@@ -17,12 +17,12 @@ class String
|
||||
{
|
||||
|
||||
public:
|
||||
static char *createU32ToString(u32 a);
|
||||
static char *createWithLeadingZeros(char *a);
|
||||
static char *createCopy(char *source);
|
||||
static u32 getLength(char *a);
|
||||
static char *createConcatenated(char *a, char *b);
|
||||
static char *createWithoutExtension(char *source);
|
||||
static char *createU32ToString(const u32 a);
|
||||
static char *createWithLeadingZeros(const char *a);
|
||||
static char *createCopy(const char *source);
|
||||
static u32 getLength(const char *a);
|
||||
static char *createConcatenated(const char *a, const char *b);
|
||||
static char *createWithoutExtension(const char *source);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -49,10 +49,10 @@ void PngLoader::load(Texture &o_texture, char *t_subfolder, char *t_name, char *
|
||||
u32 sig_read = 0, row = 0, i = 0, j = 0;
|
||||
int bit_depth, color_type, interlace_type;
|
||||
|
||||
png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, (png_voidp)NULL, NULL, NULL);
|
||||
assertMsg(png_ptr, "PNG struct info init failed(1)!");
|
||||
png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
|
||||
assertMsg(png_ptr, "PNG read struct init failed!");
|
||||
info_ptr = png_create_info_struct(png_ptr);
|
||||
assertMsg(info_ptr, "PNG struct info init failed(2)!");
|
||||
assertMsg(info_ptr, "PNG info struct init failed!");
|
||||
assertMsg(!setjmp(png_jmpbuf(png_ptr)), "PNG reader fatal error!");
|
||||
|
||||
png_init_io(png_ptr, file);
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include <stdio.h>
|
||||
#define CHAR_BIT 8
|
||||
|
||||
char *String::createU32ToString(u32 a)
|
||||
char *String::createU32ToString(const u32 a)
|
||||
{
|
||||
char *result = new char[(((sizeof a) * CHAR_BIT) + 2) / 3 + 2];
|
||||
sprintf(result, "%d", a);
|
||||
@@ -21,7 +21,7 @@ char *String::createU32ToString(u32 a)
|
||||
}
|
||||
|
||||
/** Converts "123" to "000123". 6 digits length */
|
||||
char *String::createWithLeadingZeros(char *a)
|
||||
char *String::createWithLeadingZeros(const char *a)
|
||||
{
|
||||
const u8 digitsAmount = 6;
|
||||
char *part = createConcatenated("00000000", a);
|
||||
@@ -35,7 +35,7 @@ char *String::createWithLeadingZeros(char *a)
|
||||
return result;
|
||||
}
|
||||
|
||||
char *String::createWithoutExtension(char *source)
|
||||
char *String::createWithoutExtension(const char *source)
|
||||
{
|
||||
u32 length = 0;
|
||||
for (;; length++)
|
||||
@@ -48,7 +48,7 @@ char *String::createWithoutExtension(char *source)
|
||||
return res;
|
||||
}
|
||||
|
||||
char *String::createCopy(char *source)
|
||||
char *String::createCopy(const char *source)
|
||||
{
|
||||
u32 srcLength = getLength(source);
|
||||
char *res = new char[srcLength + 1];
|
||||
@@ -59,7 +59,7 @@ char *String::createCopy(char *source)
|
||||
}
|
||||
|
||||
// For test\0 will return 4
|
||||
u32 String::getLength(char *a)
|
||||
u32 String::getLength(const char *a)
|
||||
{
|
||||
if (a == NULL)
|
||||
return 0;
|
||||
@@ -68,7 +68,7 @@ u32 String::getLength(char *a)
|
||||
return i;
|
||||
}
|
||||
|
||||
char *String::createConcatenated(char *a, char *b)
|
||||
char *String::createConcatenated(const char *a, const char *b)
|
||||
{
|
||||
u32 aLength = getLength(a);
|
||||
u32 bLength = getLength(b);
|
||||
|
||||
@@ -21,9 +21,9 @@ const float CAMERA_Y = 30.0F;
|
||||
|
||||
Camera::Camera(ScreenSettings *t_screen) : CameraBase(t_screen, &position)
|
||||
{
|
||||
PRINT_LOG("Initializing camera");
|
||||
consoleLog("Initializing camera");
|
||||
verticalLevel = 80.0F;
|
||||
PRINT_LOG("Camera initialized!");
|
||||
consoleLog("Camera initialized!");
|
||||
}
|
||||
|
||||
Camera::~Camera() {}
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
Cubes::Cubes(Engine *t_engine)
|
||||
: engine(t_engine), camera(&t_engine->screen)
|
||||
{
|
||||
PRINT_LOG("Initing cubes sample");
|
||||
consoleLog("Initing cubes sample");
|
||||
}
|
||||
|
||||
Cubes::~Cubes()
|
||||
@@ -21,14 +21,16 @@ Cubes::~Cubes()
|
||||
return;
|
||||
}
|
||||
|
||||
void Cubes::onInit(){
|
||||
void Cubes::onInit()
|
||||
{
|
||||
texRepo = engine->renderer->getTextureRepository();
|
||||
cube = new Cube(texRepo);
|
||||
setBgColorAndAmbientColor();
|
||||
engine->renderer->setCameraDefinitions(&camera.view, &camera.unitCirclePosition, camera.planes);
|
||||
}
|
||||
|
||||
void Cubes::onUpdate(){
|
||||
void Cubes::onUpdate()
|
||||
{
|
||||
camera.update(engine->pad, cube->mesh);
|
||||
cube->update(engine->pad, camera);
|
||||
engine->renderer->draw(cube->mesh);
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
PRINT_LOG("INIT");
|
||||
Engine engine = Engine();
|
||||
Cubes game = Cubes(&engine);
|
||||
game.engine->init(&game, 128);
|
||||
|
||||
@@ -17,9 +17,9 @@
|
||||
// Constructors/Destructors
|
||||
// ----
|
||||
|
||||
Cube::Cube( TextureRepository *t_texRepo )
|
||||
Cube::Cube(TextureRepository *t_texRepo)
|
||||
{
|
||||
PRINT_LOG("Creating cube");
|
||||
consoleLog("Creating cube");
|
||||
texRepo = t_texRepo;
|
||||
speed = 1.2F;
|
||||
|
||||
@@ -30,7 +30,7 @@ Cube::Cube( TextureRepository *t_texRepo )
|
||||
|
||||
texRepo->addByMesh("meshes/cube/", mesh, PNG);
|
||||
|
||||
PRINT_LOG("Cube object created!");
|
||||
consoleLog("Cube object created!");
|
||||
}
|
||||
|
||||
void Cube::update(const Pad &t_pad, const Camera &t_camera)
|
||||
@@ -68,10 +68,11 @@ Vector3 *Cube::getNextPosition(const Pad &t_pad, const Camera &t_camera)
|
||||
return result;
|
||||
}
|
||||
|
||||
void Cube::rotate(const Pad &t_pad){
|
||||
void Cube::rotate(const Pad &t_pad)
|
||||
{
|
||||
//if (t_pad.rJoyH >= 200)
|
||||
//else if (t_pad.rJoyH <= 100)
|
||||
mesh.rotation.x += (0.01 * speed);
|
||||
mesh.rotation.y += (0.01 * speed);
|
||||
mesh.rotation.z += (0.01 * speed);
|
||||
mesh.rotation.x += (0.01 * speed);
|
||||
mesh.rotation.y += (0.01 * speed);
|
||||
mesh.rotation.z += (0.01 * speed);
|
||||
}
|
||||
@@ -21,9 +21,9 @@ const float CAMERA_Y = 30.0F;
|
||||
|
||||
Camera::Camera(ScreenSettings *t_screen) : CameraBase(t_screen, &position)
|
||||
{
|
||||
PRINT_LOG("Initializing camera");
|
||||
consoleLog("Initializing camera");
|
||||
verticalLevel = 80.0F;
|
||||
PRINT_LOG("Camera initialized!");
|
||||
consoleLog("Camera initialized!");
|
||||
}
|
||||
|
||||
Camera::~Camera() {}
|
||||
|
||||
@@ -51,7 +51,7 @@ FloorManager::~FloorManager()
|
||||
*/
|
||||
void FloorManager::calcSpiral(int X, int Y)
|
||||
{
|
||||
PRINT_LOG("Calculating square spiral for floors");
|
||||
consoleLog("Calculating square spiral for floors");
|
||||
int x, y, dx;
|
||||
x = y = dx = 0;
|
||||
int dy = -1;
|
||||
@@ -73,7 +73,7 @@ void FloorManager::calcSpiral(int X, int Y)
|
||||
x += dx;
|
||||
y += dy;
|
||||
}
|
||||
PRINT_LOG("Square spiral calculated!");
|
||||
consoleLog("Square spiral calculated!");
|
||||
}
|
||||
|
||||
/** Initialize all floors by:
|
||||
@@ -82,7 +82,7 @@ void FloorManager::calcSpiral(int X, int Y)
|
||||
*/
|
||||
void FloorManager::initFloors()
|
||||
{
|
||||
PRINT_LOG("Initializing floors");
|
||||
consoleLog("Initializing floors");
|
||||
floors[0].mesh.loadObj("meshes/floor/", "floor", 3.0F, false);
|
||||
floors[0].mesh.shouldBeFrustumCulled = true;
|
||||
floors[0].mesh.shouldBeLighted = true;
|
||||
@@ -95,7 +95,7 @@ void FloorManager::initFloors()
|
||||
texRepo->getBySpriteOrMesh(floors[0].mesh.getMaterial(0).getId())->addLink(floors[i].mesh.getMaterial(0).getId());
|
||||
meshes[i] = &floors[i].mesh;
|
||||
}
|
||||
PRINT_LOG("Floors initialized!");
|
||||
consoleLog("Floors initialized!");
|
||||
}
|
||||
|
||||
/** Main floor loop.
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
LightManager::LightManager()
|
||||
{
|
||||
PRINT_LOG("Creating light manager!");
|
||||
consoleLog("Creating light manager!");
|
||||
bulbsCount = 2;
|
||||
|
||||
bulbs = new LightBulb[2];
|
||||
@@ -31,7 +31,7 @@ LightManager::LightManager()
|
||||
|
||||
audioOffset = audioTick = 0;
|
||||
|
||||
PRINT_LOG("Light manager created!");
|
||||
consoleLog("Light manager created!");
|
||||
}
|
||||
|
||||
LightManager::~LightManager()
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
Enemy::Enemy(TextureRepository *t_texRepo)
|
||||
{
|
||||
PRINT_LOG("Creating enemy object");
|
||||
consoleLog("Creating enemy object");
|
||||
|
||||
meshes = new Mesh[getMeshesCount()];
|
||||
drawMeshes = new Mesh *[getMeshesCount()];
|
||||
@@ -48,7 +48,7 @@ Enemy::Enemy(TextureRepository *t_texRepo)
|
||||
|
||||
isKilled = true;
|
||||
|
||||
PRINT_LOG("Enemy object created!");
|
||||
consoleLog("Enemy object created!");
|
||||
}
|
||||
|
||||
Enemy::~Enemy()
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
Player::Player(Audio *t_audio, TextureRepository *t_texRepo)
|
||||
{
|
||||
PRINT_LOG("Creating player object");
|
||||
consoleLog("Creating player object");
|
||||
texRepo = t_texRepo;
|
||||
audio = t_audio;
|
||||
gravity = 0.1F;
|
||||
@@ -53,7 +53,7 @@ Player::Player(Audio *t_audio, TextureRepository *t_texRepo)
|
||||
boomAdpcm = audio->loadADPCM("sounds/boom.adpcm");
|
||||
audio->setADPCMVolume(70, 0);
|
||||
|
||||
PRINT_LOG("Player object created!");
|
||||
consoleLog("Player object created!");
|
||||
}
|
||||
|
||||
Player::~Player()
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
Ui::Ui(TextureRepository *t_texRepo)
|
||||
{
|
||||
PRINT_LOG("Initializing ui");
|
||||
consoleLog("Initializing ui");
|
||||
|
||||
isTask1Done = false;
|
||||
isTask2Done = false;
|
||||
@@ -52,7 +52,7 @@ Ui::Ui(TextureRepository *t_texRepo)
|
||||
grayCheckboxTex->addLink(task1Checkbox.getId());
|
||||
grayCheckboxTex->addLink(task2Checkbox.getId());
|
||||
|
||||
PRINT_LOG("Ui initialized!");
|
||||
consoleLog("Ui initialized!");
|
||||
}
|
||||
|
||||
Ui::~Ui() {}
|
||||
|
||||
Reference in New Issue
Block a user