Exemple #1
0
void gdt_hook_initialize() {
	gdt_log(LOG_NORMAL, "start", "gdt_hook_initialize");

	gdt_set_callback_touch(&on_touch);
	game = new Game();
	game->init();
}
void ModifiableTexture::setPixel(int x, int y, GLubyte red, GLubyte green, GLubyte blue) {
	if(x < 0 || x >= mWidth || y < 0 || y >= mHeight)
		gdt_fatal(TAG, "Target coordinates (%d,%d) for setPixel is outside of the texture.", x, y);

	gdt_log(LOG_NORMAL, TAG, "ModifiableTexture %x setting pixel.", this);

	pixel p;
	p.red = red;
	p.green = green;
	p.blue = blue;

	mData[mWidth * y + x] = p;

	mDirty = true;
}
ModifiableTexture::ModifiableTexture(std::string filename) {
	GdtResource res = GdtResource(filename);
	if(!res.isValid()) {
		mTextureID = -1;
		return;
	}

	std::vector<unsigned char> decodedData;
	unsigned long width;
	unsigned long height;
	int decodeStatus = decodePNG(decodedData, width, height, (const unsigned char *) res.getBytes(), res.getLength());

	mWidth = width;
	mHeight = height;

	gdt_log(LOG_NORMAL, TAG, "Decoded PNG with status %d and got data of size %d.", decodeStatus, decodedData.size());

	unsigned char *data = &decodedData[0];

	gdt_log(LOG_NORMAL, TAG, "(1)");

	mData = (pixel *) calloc(width*height, sizeof(pixel));

	gdt_log(LOG_NORMAL, TAG, "(2)");

	memcpy(mData, data, width*height*sizeof(pixel));

	gdt_log(LOG_NORMAL, TAG, "(3)");

	uploadAndCreateTexture();

	gdt_log(LOG_NORMAL, TAG, "(4)");

	sTextures.push_back(this);

	gdt_log(LOG_NORMAL, TAG, "(5)");
}
Exemple #4
0
void gdt_hook_hidden() {
	gdt_log(LOG_NORMAL, "start", "gdt_hook_hidden");
}
Exemple #5
0
void gdt_hook_save_state() {
	gdt_log(LOG_NORMAL, "start", "gdt_hook_save_state");
}
Exemple #6
0
void gdt_hook_inactive() {
	gdt_log(LOG_NORMAL, "start", "gdt_hook_inactive");
}
Exemple #7
0
void gdt_hook_visible(bool newSurface) {
	gdt_log(LOG_NORMAL, "start", "gdt_hook_visible");

	game->visible(newSurface);
}