test/testcursor.c
changeset 1883 2780f547f5e7
parent 1862 fe99535ac064
child 1895 c121d94672cb
child 3912 e7d2858670c1
     1.1 --- a/test/testcursor.c	Sat Jun 24 04:30:01 2006 +0000
     1.2 +++ b/test/testcursor.c	Sat Jun 24 17:36:55 2006 +0000
     1.3 @@ -55,6 +55,10 @@
     1.4  	0xff00
     1.5  };
     1.6  
     1.7 +/* another test cursor: smaller than 16x16, and with an odd height */
     1.8 +
     1.9 +Uint8 small_cursor_data[11] = { 0x00, 0x18, 0x08, 0x38, 0x44, 0x54, 0x44, 0x38, 0x20, 0x20, 0x00 };
    1.10 +Uint8 small_cursor_mask[11] = { 0x3C, 0x3C, 0x3C, 0x7C, 0xC6, 0xC6, 0xC6, 0x7C, 0x78, 0x70, 0x70 };
    1.11  
    1.12  /* XPM */
    1.13  static const char *arrow[] = {
    1.14 @@ -139,7 +143,7 @@
    1.15  {
    1.16  	SDL_Surface *screen;
    1.17  	SDL_bool quit = SDL_FALSE, first_time = SDL_TRUE;
    1.18 -	SDL_Cursor *cursor[2];
    1.19 +	SDL_Cursor *cursor[3];
    1.20  	int current;
    1.21  
    1.22  	/* Load the SDL library */
    1.23 @@ -170,6 +174,13 @@
    1.24  		SDL_Quit();
    1.25  		return(1);
    1.26  	}
    1.27 +	cursor[2] = SDL_CreateCursor(small_cursor_data, small_cursor_mask,
    1.28 +		8, 11, 3, 5);
    1.29 +	if (cursor[2]==NULL) {
    1.30 +		fprintf(stderr, "Couldn't initialize test cursor: %s\n",SDL_GetError());
    1.31 +		SDL_Quit();
    1.32 +		return(1);
    1.33 +	}
    1.34  
    1.35  	current = 0;
    1.36  	SDL_SetCursor(cursor[current]);
    1.37 @@ -179,7 +190,7 @@
    1.38  		while (SDL_PollEvent(&event)) {
    1.39  			switch(event.type) {
    1.40  				case SDL_MOUSEBUTTONDOWN:
    1.41 -					current = !current;
    1.42 +					current = (current + 1)%3;
    1.43  					SDL_SetCursor(cursor[current]);
    1.44  					break;
    1.45  				case SDL_KEYDOWN: