Sign in to follow this  

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

This topic is 3154 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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

This topic is 3154 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Guest
This topic is now closed to further replies.
Sign in to follow this