From: jsancho Date: Fri, 25 Sep 2009 14:05:36 +0000 (+0000) Subject: (no commit message) X-Git-Url: https://git.jsancho.org/?a=commitdiff_plain;h=a559c9a47d17f1a7ca0a4dff3edcd39449d1821e;p=gacela.git --- diff --git a/gacela_GL.lisp b/gacela_GL.lisp index 38e03ca..961a29a 100644 --- a/gacela_GL.lisp +++ b/gacela_GL.lisp @@ -21,66 +21,66 @@ (clines "#include ") ;;; Data types -(defconstant GL_UNSIGNED_BYTE #x1401) +(mapcconst int "int" "GL_UNSIGNED_BYTE") ;;; Primitives -(defconstant GL_POINTS #x0000) -(defconstant GL_LINES #x0001) -(defconstant GL_LINE_LOOP #x0002) -(defconstant GL_LINE_STRIP #x0003) -(defconstant GL_TRIANGLES #x0004) -(defconstant GL_TRIANGLE_STRIP #x0005) -(defconstant GL_TRIANGLE_FAN #x0006) -(defconstant GL_QUADS #x0007) -(defconstant GL_QUAD_STRIP #x0008) -(defconstant GL_POLYGON #x0009) +(mapcconst int "int" "GL_POINTS") +(mapcconst int "int" "GL_LINES") +(mapcconst int "int" "GL_LINE_LOOP") +(mapcconst int "int" "GL_LINE_STRIP") +(mapcconst int "int" "GL_TRIANGLES") +(mapcconst int "int" "GL_TRIANGLE_STRIP") +(mapcconst int "int" "GL_TRIANGLE_FAN") +(mapcconst int "int" "GL_QUADS") +(mapcconst int "int" "GL_QUAD_STRIP") +(mapcconst int "int" "GL_POLYGON") ;;; Matrix Mode -(defconstant GL_MODELVIEW #x1700) -(defconstant GL_PROJECTION #x1701) +(mapcconst int "int" "GL_MODELVIEW") +(mapcconst int "int" "GL_PROJECTION") ;;; Depth buffer -(defconstant GL_LEQUAL #x0203) -(defconstant GL_DEPTH_TEST #x0B71) +(mapcconst int "int" "GL_LEQUAL") +(mapcconst int "int" "GL_DEPTH_TEST") ;;; Lighting -(defconstant GL_LIGHTING #x0B50) -(defconstant GL_LIGHT1 #x4001) -(defconstant GL_AMBIENT #x1200) -(defconstant GL_DIFFUSE #x1201) -(defconstant GL_POSITION #x1203) -(defconstant GL_SMOOTH #x1D01) +(mapcconst int "int" "GL_LIGHTING") +(mapcconst int "int" "GL_LIGHT1") +(mapcconst int "int" "GL_AMBIENT") +(mapcconst int "int" "GL_DIFFUSE") +(mapcconst int "int" "GL_POSITION") +(mapcconst int "int" "GL_SMOOTH") ;;; Blending -(defconstant GL_BLEND #x0BE2) -(defconstant GL_ONE #x1) -(defconstant GL_SRC_ALPHA #x0302) +(mapcconst int "int" "GL_BLEND") +(mapcconst int "int" "GL_ONE") +(mapcconst int "int" "GL_SRC_ALPHA") ;;; Fog -(defconstant GL_LINEAR #x2601) +(mapcconst int "int" "GL_LINEAR") ;;; Buffers, Pixel Drawing/Reading -(defconstant GL_RGB #x1907) -(defconstant GL_RGBA #x1908) +(mapcconst int "int" "GL_RGB") +(mapcconst int "int" "GL_RGBA") ;;; Hints -(defconstant GL_PERSPECTIVE_CORRECTION_HINT #x0C50) -(defconstant GL_NICEST #x1102) +(mapcconst int "int" "GL_PERSPECTIVE_CORRECTION_HINT") +(mapcconst int "int" "GL_NICEST") ;;; Texture mapping -(defconstant GL_TEXTURE_2D #x0DE1) -(defconstant GL_TEXTURE_MAG_FILTER #x2800) -(defconstant GL_TEXTURE_MIN_FILTER #x2801) -(defconstant GL_LINEAR_MIPMAP_NEAREST #x2701) -(defconstant GL_NEAREST #x2600) +(mapcconst int "int" "GL_TEXTURE_2D") +(mapcconst int "int" "GL_TEXTURE_MAG_FILTER") +(mapcconst int "int" "GL_TEXTURE_MIN_FILTER") +(mapcconst int "int" "GL_LINEAR_MIPMAP_NEAREST") +(mapcconst int "int" "GL_NEAREST") ;;; glPush/PopAttrib bits -(defconstant GL_DEPTH_BUFFER_BIT #x00000100) -(defconstant GL_COLOR_BUFFER_BIT #x00004000) +(mapcconst int "int" "GL_DEPTH_BUFFER_BIT") +(mapcconst int "int" "GL_COLOR_BUFFER_BIT") ;;; OpenGL 1.2 -(defconstant GL_BGR #x80E0) -(defconstant GL_BGRA #x80E1) +(mapcconst int "int" "GL_BGR") +(mapcconst int "int" "GL_BGRA") ;;; OpenGL Functions (defcfun "void gacela_glBegin (int mode)" 0 diff --git a/gacela_SDL.lisp b/gacela_SDL.lisp index 1a2a02c..af72bf1 100644 --- a/gacela_SDL.lisp +++ b/gacela_SDL.lisp @@ -23,49 +23,39 @@ (clines "#include ") (clines "#include ") -(defmacro mapcconst (type name) - `(let ((header (concatenate 'string ,type " gacela_" ,name " (void)")) - (body (concatenate 'string "return " ,name ";")) - (cfun (concatenate 'string "gacela_" ,name))) - (defcfun header 0 body) - (defentry - -(defentry SDL_GetTicks () (int "gacela_SDL_GetTicks")) - ;;; SDL constants as functions -(defcfun "int gacela_SDL_INIT_TIMER (void)" 0 "return SDL_INIT_TIMER;") -(defcfun "int gacela_SDL_INIT_AUDIO (void)" 0 "return SDL_INIT_AUDIO;") -(defcfun "int gacela_SDL_INIT_VIDEO (void)" 0 "return SDL_INIT_VIDEO;") -(defcfun "int gacela_SDL_INIT_CDROM (void)" 0 "return SDL_INIT_CDROM;") -(defcfun "int gacela_SDL_INIT_JOYSTICK (void)" 0 "return SDL_INIT_JOYSTICK;") -(defcfun "int gacela_SDL_INIT_NOPARACHUTE (void)" 0 "return SDL_INIT_NOPARACHUTE;") -(defcfun "int gacela_SDL_INIT_EVENTTHREAD (void)" 0 "return SDL_INIT_EVENTTHREAD;") -(defcfun "int gacela_SDL_INIT_EVERYTHING (void)" 0 "return SDL_INIT_EVERYTHING;") - -(defcfun "int gacela_SDL_SWSURFACE (void)" 0 "return SDL_SWSURFACE;") -(defcfun "int gacela_SDL_HWSURFACE (void)" 0 "return SDL_HWSURFACE;") -(defcfun "int gacela_SDL_ASYNCBLIT (void)" 0 "return SDL_ASYNCBLIT;") - -(defcfun "int gacela_SDL_ANYFORMAT (void)" 0 "return SDL_ANYFORMAT;") -(defcfun "int gacela_SDL_HWPALETTE (void)" 0 "return SDL_HWPALETTE;") -(defcfun "int gacela_SDL_DOUBLEBUF (void)" 0 "return SDL_DOUBLEBUF;") -(defcfun "int gacela_SDL_FULLSCREEN (void)" 0 "return SDL_FULLSCREEN;") -(defcfun "int gacela_SDL_OPENGL (void)" 0 "return SDL_OPENGL;") -(defcfun "int gacela_SDL_OPENGLBLIT (void)" 0 "return SDL_OPENGLBLIT;") -(defcfun "int gacela_SDL_RESIZABLE (void)" 0 "return SDL_RESIZABLE;") -(defcfun "int gacela_SDL_NOFRAME (void)" 0 "return SDL_NOFRAME;") - -(defcfun "int gacela_SDL_HWACCEL (void)" 0 "return SDL_HWACCEL;") -(defcfun "int gacela_SDL_SRCCOLORKEY (void)" 0 "return SDL_SRCCOLORKEY;") - -(defcfun "int gacela_SDL_GL_DOUBLEBUFFER (void)" 0 "return SDL_GL_DOUBLEBUFFER;") - -(defcfun "int gacela_SDL_DEFAULT_REPEAT_DELAY (void)" 0 "return DEFAULT_REPEAT_DELAY;") -(defcfun "int gacela_SDL_DEFAULT_REPEAT_INTERVAL (void)" 0 "return DEFAULT_REPEAT_INTERVAL;") - -(defcfun "int gacela_SDL_LIL_ENDIAN (void)" 0 "return SDL_LIL_ENDIAN;") -(defcfun "int gacela_SDL_BIG_ENDIAN (void)" 0 "return SDL_BIG_ENDIAN;") - +(mapcconst int "int" "SDL_INIT_TIMER") +(mapcconst int "int" "SDL_INIT_AUDIO") +(mapcconst int "int" "SDL_INIT_VIDEO") +(mapcconst int "int" "SDL_INIT_CDROM") +(mapcconst int "int" "SDL_INIT_JOYSTICK") +(mapcconst int "int" "SDL_INIT_NOPARACHUTE") +(mapcconst int "int" "SDL_INIT_EVENTTHREAD") +(mapcconst int "int" "SDL_INIT_EVERYTHING") + +(mapcconst int "int" "SDL_SWSURFACE") +(mapcconst int "int" "SDL_HWSURFACE") +(mapcconst int "int" "SDL_ASYNCBLIT") + +(mapcconst int "int" "SDL_ANYFORMAT") +(mapcconst int "int" "SDL_HWPALETTE") +(mapcconst int "int" "SDL_DOUBLEBUF") +(mapcconst int "int" "SDL_FULLSCREEN") +(mapcconst int "int" "SDL_OPENGL") +(mapcconst int "int" "SDL_OPENGLBLIT") +(mapcconst int "int" "SDL_RESIZABLE") +(mapcconst int "int" "SDL_NOFRAME") + +(mapcconst int "int" "SDL_HWACCEL") +(mapcconst int "int" "SDL_SRCCOLORKEY") + +(mapcconst int "int" "SDL_GL_DOUBLEBUFFER") + +(mapcconst int "int" "SDL_DEFAULT_REPEAT_DELAY") +(mapcconst int "int" "SDL_DEFAULT_REPEAT_INTERVAL") + +(mapcconst int "int" "SDL_LIL_ENDIAN") +(mapcconst int "int" "SDL_BIG_ENDIAN") ;;; SDL Functions (defcfun "int gacela_SDL_Init (int flags)" 0 diff --git a/gacela_misc.lisp b/gacela_misc.lisp index 8a7c2e4..ac7b479 100755 --- a/gacela_misc.lisp +++ b/gacela_misc.lisp @@ -69,6 +69,14 @@ (t (power (* p 2) n))))) (power 1 n))) +(defmacro mapcconst (type c-type name) + `(progn + (defcfun ,(concatenate 'string c-type " gacela_" name " (void)") 0 + ,(concatenate 'string "return " name ";")) + (defentry ,(intern (string-upcase name)) () + (,type ,(concatenate 'string "gacela_" name))))) + + ;Geometry (defun dotp (dot) (match-pattern dot '(0 0)))