@@ -59,22 +59,22 @@ static ALenum get_openal_format(const SDL_AudioSpec *spec)
5959typedef struct
6060{
6161 ALuint sid ;
62- int x ;
63- int y ;
62+ float x ;
63+ float y ;
6464} obj ;
6565
6666/* !!! FIXME: eventually, add more sources and sounds. */
6767static obj objects [2 ]; /* one listener, one source. */
6868static int draggingobj = -1 ;
6969
70- static int obj_under_mouse (const int x , const int y )
70+ static int obj_under_mouse (const float x , const float y )
7171{
72- const SDL_Point p = { x , y };
72+ const SDL_FPoint p = { x , y };
7373 const obj * o = objects ;
7474 int i ;
7575 for (i = 0 ; i < SDL_arraysize (objects ); i ++ , o ++ ) {
76- const SDL_Rect r = { o -> x - 25 , o -> y - 25 , 50 , 50 };
77- if (SDL_PointInRect (& p , & r )) {
76+ const SDL_FRect r = { o -> x - 25.0f , o -> y - 25.0f , 50.0f , 50.0f };
77+ if (SDL_PointInRectFloat (& p , & r )) {
7878 return i ;
7979 }
8080 }
@@ -113,8 +113,8 @@ static int mainloop(SDL_Renderer *renderer)
113113 case SDL_EVENT_MOUSE_MOTION :
114114 if (draggingobj != -1 ) {
115115 obj * o = & objects [draggingobj ];
116- o -> x = SDL_min (800 , SDL_max (0 , e .motion .x ));
117- o -> y = SDL_min (600 , SDL_max (0 , e .motion .y ));
116+ o -> x = SDL_min (800.0f , SDL_max (0.0f , e .motion .x ));
117+ o -> y = SDL_min (600.0f , SDL_max (0.0f , e .motion .y ));
118118 /* we are treating the 2D view as the X and Z coordinate, as if we're looking at it from above.
119119 From this configuration, the Y coordinate would be depth, and we leave that at zero.
120120 the listener's default "at" orientation is towards the north in this configuration, with its
@@ -214,14 +214,14 @@ static void spatialize(SDL_Renderer *renderer, const char *fname)
214214
215215 /* the listener. */
216216 o -> sid = 0 ;
217- o -> x = 400 ;
218- o -> y = 300 ;
217+ o -> x = 400.0f ;
218+ o -> y = 300.0f ;
219219 alListener3f (AL_POSITION , ((o -> x / 400.0f ) - 1.0f ) * 10.0f , 0.0f , ((o -> y / 300.0f ) - 1.0f ) * 10.0f );
220220 o ++ ;
221221
222222 o -> sid = sid ;
223- o -> x = 400 ;
224- o -> y = 50 ;
223+ o -> x = 400.0f ;
224+ o -> y = 50.0f ;
225225 alSource3f (o -> sid , AL_POSITION , ((o -> x / 400.0f ) - 1.0f ) * 10.0f , 0.0f , ((o -> y / 300.0f ) - 1.0f ) * 10.0f );
226226 o ++ ;
227227
0 commit comments