Set up small static-init test in Ballfield app
This commit is contained in:
@@ -54,7 +54,7 @@ SDL_Surface *clean_alpha(SDL_Surface *s)
|
||||
}
|
||||
|
||||
SDL_LockSurface(work);
|
||||
pixels = work->pixels;
|
||||
pixels = (Uint32 *)work->pixels;
|
||||
pp = work->pitch / sizeof(Uint32);
|
||||
for(y = 0; y < work->h; ++y)
|
||||
for(x = 0; x < work->w; ++x)
|
||||
@@ -179,7 +179,7 @@ void print_num(SDL_Surface *dst, SDL_Surface *font, int x, int y, float value)
|
||||
ballfield_t *ballfield_init(void)
|
||||
{
|
||||
int i;
|
||||
ballfield_t *bf = calloc(sizeof(ballfield_t), 1);
|
||||
ballfield_t *bf = (ballfield_t *)calloc(sizeof(ballfield_t), 1);
|
||||
if(!bf)
|
||||
return NULL;
|
||||
for(i = 0; i < BALLS; ++i)
|
||||
@@ -210,7 +210,7 @@ static int ballfield_init_frames(ballfield_t *bf)
|
||||
/*
|
||||
* Set up source rects for all frames
|
||||
*/
|
||||
bf->frames = calloc(sizeof(SDL_Rect), bf->gfx[0]->w);
|
||||
bf->frames = (SDL_Rect *)calloc(sizeof(SDL_Rect), bf->gfx[0]->w);
|
||||
if(!bf->frames)
|
||||
{
|
||||
fprintf(stderr, "No memory for frame rects!\n");
|
||||
|
||||
18
project/jni/application/ballfield/test.cpp
Normal file
18
project/jni/application/ballfield/test.cpp
Normal file
@@ -0,0 +1,18 @@
|
||||
#include <stdio.h>
|
||||
#include "test.h"
|
||||
|
||||
int test::initCount = 0;
|
||||
int test::initCount2 = 12345;
|
||||
|
||||
test::test()
|
||||
{
|
||||
initCount++;
|
||||
__android_log_print(ANDROID_LOG_INFO, "==TEST==", "test::test(): initCount %d initCount2 %d", initCount, initCount2);
|
||||
}
|
||||
|
||||
test::~test()
|
||||
{
|
||||
initCount--;
|
||||
__android_log_print(ANDROID_LOG_INFO, "==TEST==", "test::~test(): initCount %d initCount2 %d", initCount, initCount2);
|
||||
}
|
||||
|
||||
15
project/jni/application/ballfield/test.h
Normal file
15
project/jni/application/ballfield/test.h
Normal file
@@ -0,0 +1,15 @@
|
||||
#include <stdio.h>
|
||||
#include <android/log.h>
|
||||
|
||||
class test
|
||||
{
|
||||
public:
|
||||
test();
|
||||
~test();
|
||||
|
||||
public:
|
||||
static int initCount;
|
||||
static int initCount2;
|
||||
};
|
||||
|
||||
|
||||
7
project/jni/application/ballfield/test2.cpp
Normal file
7
project/jni/application/ballfield/test2.cpp
Normal file
@@ -0,0 +1,7 @@
|
||||
#include <stdio.h>
|
||||
#include "test.h"
|
||||
|
||||
|
||||
test t;
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
fheroes2
|
||||
ballfield
|
||||
Reference in New Issue
Block a user