Sign in to follow this  
Thc-03_Berserk

Please translate this code to C++ and allegro - continued.

Recommended Posts

In response to the last comment, I have a good knowledge of C/C++ but not of the allegro library. However, here is a question:
BITMAP *buf, *tiles[7], *blocks; // this is at the beginning of my main function
newGrid.redraw(tiles, buf); // this is in my main loop

void grid::redraw(BITMAP ** tiles, BITMAP * screen) {
	for (int x = 0; x < 7; x++) {
		for (int y = 0; y < 19; y++) {
			blit(tiles[playground[x][y]], screen, 0, 0, (this->x + x) * 32, (this->y + y) * 32, tiles[playground[x][y]]->w, tiles[playground[x][y]]->h);
		}
	}
}

this code is where I split my image in tiles
	for (int x = 0; x < 4; x++) {
		for (int y = 0; y < 2; y++) {
			tiles[x + y * 4] = create_sub_bitmap(blocks, x * 32, y * 32, 32, 32);
		}
	}
I also added a vsync but all I get is a black screen. Why? Bye, Berserk. .

Share this post


Link to post
Share on other sites
Try [source][/source] instead. (Personally, I also find code easier to read if long lines are broken so that it all fits on one screen-width, more or less.)

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this