The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.
SDL
Simple Directmedia Layer Forums
How to get one of nine tiles to blit in Tic Tac Toe?
dtaqee88
Joined: 13 Sep 2012
Posts: 3
Posted: Sat Sep 15, 2012 2:12 am
Hi all. I'm somewhat new to SDL and have set out to create a bunch of basic games to get a good grasp of SDL. I am currently working on Tic Tac Toe but ran into a problem. The problem is there are nine tiles and I'm trying to get each tile to light up with a question mark when the user rolls over the square....and it works for all the squares.....except the leftmost/uppermost square will not blit a question mark until all the other eight squares have blitted [or until I have rolled over all the other squares] ....kind of weird. I am using SDL_Blitsurface to blit the question marks. Is there something I am doing wrong using SDL_Blitsurface or should I be using another function to blit pictures? Thanks for any feedback!
Here is how I blit one of the nine squares:
Code:
if((x > 0 && x < 212) && (y > 0 && y < 160))//Finding out where the mouse is via SDL_mousemotion
{
offset[0].x = 0;
offset[0].y = 0;
SDL_BlitSurface(tileHighlight, NULL, screen, &offset[0]);//this blits the question mark
}
else
SDL_BlitSurface(one, NULL, screen, &offset[0]);//this blits whitespace if a user does not click the square