1"====================================================================== 2| 3| SDL declarations 4| 5| 6 ======================================================================" 7 8 9"====================================================================== 10| 11| Copyright 2006, 2008 Free Software Foundation, Inc. 12| Written by Brad Watson 13| 14| This file is part of the GNU Smalltalk class library. 15| 16| The GNU Smalltalk class library is free software; you can redistribute it 17| and/or modify it under the terms of the GNU Lesser General Public License 18| as published by the Free Software Foundation; either version 2.1, or (at 19| your option) any later version. 20| 21| The GNU Smalltalk class library is distributed in the hope that it will be 22| useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 23| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 24| General Public License for more details. 25| 26| You should have received a copy of the GNU Lesser General Public License 27| along with the GNU Smalltalk class library; see the file COPYING.LIB. 28| If not, write to the Free Software Foundation, 59 Temple Place - Suite 29| 330, Boston, MA 02110-1301, USA. 30| 31 ======================================================================" 32 33 34"====================================================================== 35| 36| Notes: implemented without callbacks. 37| 38 ======================================================================" 39 40Object subclass: #SdlTimer 41 instanceVariableNames: '' 42 classVariableNames: '' 43 poolDictionaries: '' 44 category: 'LibSDL-Core'! ! 45 46!SdlTimer class methodsFor: 'Constants'! 47 48sdlTimeSlice 49 ^10! 50 51timerResolution 52 ^10! 53 54!SdlTimer class methodsFor: 'C call-outs'! 55 56sdlGetTicks 57 "I answer the number of milliseconds since the SDL library 58 initialization. My C function call prototype: 59 60 extern DECLSPEC Uint32 SDLCALL SDL_GetTicks(void);" 61 <cCall: 'SDL_GetTicks' returning: #uInt 62 args: #( )>! 63 64sdlDelay: aUint 65 "I wait a specified number of milliseconds. My C function call 66 prototype: 67 68 extern DECLSPEC void SDLCALL SDL_Delay(Uint32 ms);" 69 <cCall: 'SDL_Delay' returning: #void 70 args: #( #uInt )>! 71 72sdlSetTimer: aUint callback: aCobject2 73 "I set a callback to run after the specified number of 74 milliseconds has elapsed. My C function call prototype: 75 76 extern DECLSPEC int SDLCALL SDL_SetTimer(Uint32 interval, 77 SDL_TimerCallback callback);" 78 <cCall: 'SDL_SetTimer' returning: #int 79 args: #( #int #cObject )>! 80 81sdlAddTimer: aUint0 callback: aCobject1 param: aCobject2 82 "I add a new timer to the pool of timers already running. My C 83 function call prototype: 84 85 extern DECLSPEC SDL_TimerID SDLCALL SDL_AddTimer(Uint32 interval, 86 SDL_NewTimerCallback callback, void *param);" 87 <cCall: 'SDL_AddTimer' returning: #cObject 88 args: #( #uInt #cObject #cObject )>! 89 90sdlRemoveTimer: aCobject0 91 "I remove the timer with the ID given to me. My C function call 92 prototype: 93 94 extern DECLSPEC SDL_bool SDLCALL SDL_RemoveTimer(SDL_TimerID t);" 95 <cCall: 'SDL_RemoveTimer' returning: #boolean 96 args: #( #cObject )>! ! 97