annotate test/testeyes.c @ 4770:cf7976fd3258

Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
author Eli Gottlieb <eligottlieb@gmail.com>
date Mon, 31 May 2010 21:23:06 -0400
parents
children ef8b32ef9793
rev   line source
4770
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
1 #include <stdlib.h>
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
2 #include <math.h>
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
3 #include <SDL_events.h>
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
4 #include <SDL_rect.h>
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
5 #include <SDL_pixels.h>
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
6 #include <SDL_video.h>
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
7 #include <SDL_shape.h>
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
8 #include "testeyes_bitmap.h"
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
9 #include "testeyes_mask_bitmap.h"
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
10
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
11 /* The following code for the calculation of pupil positions has been taken and rewritten from the original xeyes. The
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
12 copyright notice is included as follows, and the code is now under the same license as the rest of this file. */
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
13 /*
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
14
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
15 Copyright (c) 1991 X Consortium
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
16
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
17 Permission is hereby granted, free of charge, to any person obtaining
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
18 a copy of this software and associated documentation files (the
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
19 "Software"), to deal in the Software without restriction, including
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
20 without limitation the rights to use, copy, modify, merge, publish,
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
21 distribute, sublicense, and/or sell copies of the Software, and to
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
22 permit persons to whom the Software is furnished to do so, subject to
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
23 the following conditions:
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
24
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
25 The above copyright notice and this permission notice shall be included
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
26 in all copies or substantial portions of the Software.
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
27
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
28 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
29 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
30 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
31 IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
32 OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
33 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
34 OTHER DEALINGS IN THE SOFTWARE.
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
35
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
36 Except as contained in this notice, the name of the X Consortium shall
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
37 not be used in advertising or otherwise to promote the sale, use or
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
38 other dealings in this Software without prior written authorization
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
39 from the X Consortium.
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
40
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
41 */
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
42 # define NUM_EYES 2
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
43 # define EYE_X(n) ((n) * 2.0)
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
44 # define EYE_Y(n) (0.0)
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
45 # define EYE_THICK (0.175) /* thickness of eye rim */
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
46 # define EYE_OFFSET (0.1) /* padding between eyes */
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
47 # define EYE_WIDTH (2.0 - (EYE_THICK + EYE_OFFSET) * 2)
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
48 # define EYE_HEIGHT EYE_WIDTH
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
49 # define EYE_HWIDTH (EYE_WIDTH / 2.0)
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
50 # define EYE_HHEIGHT (EYE_HEIGHT / 2.0)
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
51 # define BALL_WIDTH (0.3)
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
52 # define BALL_HEIGHT BALL_WIDTH
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
53 # define BALL_PAD (0.05)
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
54 # define BALL_DIST ((EYE_WIDTH - BALL_WIDTH) / 2.0 - BALL_PAD)
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
55
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
56 SDL_Point computePupil (int num,SDL_Point mouse) {
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
57 double dx = mouse.x - EYE_X(num);
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
58 double dy = mouse.y - EYE_Y(num);
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
59 double cx = 0.0,cy = 0.0;
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
60 if(dx == 0 && dy == 0) {
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
61 cx = EYE_X(num);
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
62 cy = EYE_Y(num);
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
63 }
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
64 else {
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
65 double angle = atan2((double)dy,(double)dx);
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
66 double cosa = cos(angle);
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
67 double sina = sin(angle);
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
68 double hypotenuse = hypot(EYE_HHEIGHT * cosa, EYE_HWIDTH * sina);
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
69 double dist = BALL_DIST * hypot((EYE_HWIDTH * EYE_HHEIGHT) * cosa / hypotenuse,
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
70 (EYE_HWIDTH * EYE_HHEIGHT) * sina / hypotenuse);
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
71 if(dist > hypot((double)dx,(double)dy)) {
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
72 cx = dx + EYE_X(num);
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
73 cy = dy + EYE_Y(num);
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
74 }
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
75 else {
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
76 cx = dist * cosa + EYE_X(num);
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
77 cy = dist * sina + EYE_Y(num);
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
78 }
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
79 }
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
80 SDL_Point ret = {cx,cy};
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
81 return ret;
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
82 }
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
83
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
84 /* Here begins the code exclusively and entirely written by Eli Gottlieb in May 2010. */
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
85 typedef struct {
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
86 SDL_Rect left;
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
87 SDL_Rect right;
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
88 } Pupil_Pair;
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
89 typedef struct {
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
90 SDL_Point left;
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
91 SDL_Point right;
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
92 } Pupil_Points;
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
93
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
94 Pupil_Pair compute_pupil_positions(SDL_Point target) {
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
95 Pupil_Pair result;
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
96 Pupil_Points points;
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
97 points.left = computePupil(0,target);
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
98 points.right = computePupil(1,target);
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
99 result.left.x = points.left.x - BALL_WIDTH / 2.0;
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
100 result.left.y = points.left.y - BALL_HEIGHT / 2.0;
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
101 result.right.x = points.right.x - BALL_WIDTH / 2.0;
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
102 result.right.y = points.right.y - BALL_HEIGHT / 2.0;
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
103 result.left.w = result.right.w = BALL_WIDTH;
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
104 result.left.h = result.left.w = BALL_HEIGHT;
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
105 return result;
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
106 }
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
107
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
108 void render_eyes(SDL_Window *window,SDL_Texture *eyes_texture,Pupil_Pair pupils) {
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
109 SDL_SelectRenderer(window);
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
110
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
111 //Clear render-target to blue.
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
112 SDL_SetRenderDrawColor(0x00,0x00,0xff,0xff);
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
113 SDL_RenderClear();
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
114
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
115 //Render the whites of the eyes.
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
116 SDL_Rect srcdestrect = {0,0,eyes_width,eyes_height};
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
117 SDL_RenderCopy(eyes_texture,&srcdestrect,&srcdestrect);
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
118
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
119 //Render the pupils.
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
120 SDL_SetRenderDrawColor(0x00,0x00,0x00,0xff);
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
121 const SDL_Rect eyes[2] = {pupils.left,pupils.right};
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
122 SDL_RenderFillRects((const SDL_Rect**)&eyes,2);
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
123
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
124 SDL_RenderPresent();
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
125 }
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
126
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
127 int main(int argc,char** argv) {
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
128 if(SDL_VideoInit(NULL,0) == -1) {
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
129 printf("Could not initialize SDL video.\n");
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
130 exit(-1);
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
131 }
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
132
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
133 SDL_Window *window = SDL_CreateShapedWindow("Big Brother is watching you.",eyes_x_hot,eyes_y_hot,eyes_width,eyes_height,SDL_WINDOW_RESIZABLE);
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
134 if(window == NULL) {
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
135 SDL_VideoQuit();
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
136 printf("Could not create shaped window for eyes.\n");
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
137 exit(-2);
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
138 }
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
139 if(SDL_CreateRenderer(window,-1,SDL_RENDERER_PRESENTFLIP2) == -1) {
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
140 SDL_DestroyWindow(window);
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
141 SDL_VideoQuit();
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
142 printf("Could not create rendering context for SDL_Eyes window.\n");
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
143 exit(-3);
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
144 }
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
145
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
146 SDL_Color bnw_palette[2] = {{0,0,0,0},{255,255,255,255}};
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
147 SDL_Texture *eyes_texture = SDL_CreateTexture(SDL_PIXELFORMAT_INDEX1LSB,SDL_TEXTUREACCESS_STREAMING,eyes_width,eyes_height);
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
148 if(eyes_texture == NULL) {
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
149 SDL_DestroyRenderer(window);
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
150 SDL_DestroyWindow(window);
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
151 SDL_VideoQuit();
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
152 printf("Could not create eyes texture.\n");
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
153 exit(-4);
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
154 }
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
155 SDL_SetTexturePalette(eyes_texture,bnw_palette,0,2);
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
156
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
157 void *pixels = NULL;
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
158 int pitch = 0;
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
159 SDL_Rect rect = {0,0,eyes_width,eyes_height};
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
160 SDL_LockTexture(eyes_texture,&rect,1,&pixels,&pitch);
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
161 for(int row = 0;row<eyes_height;row++)
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
162 memcpy(pixels+pitch*row,eyes_bits+(eyes_width/8)*row,eyes_width/8);
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
163 SDL_UnlockTexture(eyes_texture);
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
164
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
165 SDL_Texture *mask_texture = SDL_CreateTexture(SDL_PIXELFORMAT_INDEX1LSB,SDL_TEXTUREACCESS_STREAMING,eyesmask_width,eyesmask_height);
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
166 if(mask_texture == NULL) {
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
167 SDL_DestroyTexture(eyes_texture);
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
168 SDL_DestroyRenderer(window);
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
169 SDL_DestroyWindow(window);
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
170 SDL_VideoQuit();
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
171 printf("Could not create shape mask texture.\n");
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
172 exit(-5);
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
173 }
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
174 SDL_SetTexturePalette(mask_texture,bnw_palette,0,2);
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
175
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
176 rect.x = rect.y = 0;
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
177 rect.w = eyesmask_width;
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
178 rect.h = eyesmask_height;
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
179 SDL_LockTexture(mask_texture,&rect,1,&pixels,&pitch);
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
180 for(int row = 0;row<eyesmask_height;row++)
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
181 memcpy(pixels+pitch*row,eyesmask_bits+(eyesmask_width/8)*row,eyesmask_width/8);
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
182 SDL_UnlockTexture(mask_texture);
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
183
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
184 SDL_SelectShapeRenderer(window);
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
185 SDL_RenderCopy(mask_texture,&rect,&rect);
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
186 SDL_RenderPresent();
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
187
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
188 SDL_Event event;
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
189 int event_pending = 0;
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
190 event_pending = SDL_PollEvent(&event);
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
191 SDL_Point mouse_position;
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
192 Pupil_Pair pupil_positions;
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
193 SDL_SelectMouse(0);
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
194 SDL_GetMouseState(&mouse_position.x,&mouse_position.y);
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
195 pupil_positions = compute_pupil_positions(mouse_position);
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
196 while(event.type != SDL_QUIT) {
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
197 if(event.type == SDL_MOUSEMOTION) {
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
198 mouse_position.x = event.motion.x;
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
199 mouse_position.y = event.motion.y;
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
200 pupil_positions = compute_pupil_positions(mouse_position);
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
201 }
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
202 render_eyes(window,eyes_texture,pupil_positions);
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
203 event_pending = SDL_PollEvent(&event);
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
204 }
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
205
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
206 //Call SDL_VideoQuit() before quitting.
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
207 SDL_VideoQuit();
cf7976fd3258 Moved the SDL_Eyes test program for shaped windows into the Hg repository and got it building and linking as a test.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
208 }