;;; ;;; sdl-gfx-lib.stub - glue functions for SDL_gfx ;;; ;;; Copyright(C) 2003 by Michael Vess (mvess@michaelvess.com) ;;; ;;; Permission to use, copy, modify, distribute this software and ;;; accompanying documentation for any purpose is hereby granted, ;;; provided that existing copyright notices are retained in all ;;; copies and that this notice is included verbatim in all ;;; distributions. ;;; This software is provided as is, without express or implied ;;; warranty. In no circumstances the author(s) shall be liable ;;; for any damages arising out of the use of this software. ;;; ;;; $Id: sdl-gfx-lib.stub,v 1.2 2003/02/03 09:31:14 mikiso Exp $ ;;; " #include \"gauche-sdl-gfx.h\" " ;;============================================================= ;; Miscellaneous ;; (define-type "ScmU16Vector*" "u16vector" "SCM_U16VECTORP" "SCM_U16VECTOR") ;;============================================================= ;; Surface ;; (define-type "SDL_Surface*" #f "SCM_SDL_SURFACE_P" "SCM_SDL_SURFACE") (define-type -or-null "SDL_Surface*" #f "SCM_SDL_SURFACE_OR_NULL_P" "SCM_SDL_SURFACE_OR_NULL") (define-cproc sdl-surface? (obj) (return "SCM_SDL_SURFACE_P")) ;;============================================================= ;; Fpsmanagers ;; (define-type "SDL_FPSmanager*" #f "SCM_SDL_FPSMANAGER_P" "SCM_SDL_FPSMANAGER") (define-type -or-null "SDL_FPSmanager*" #f "SCM_SDL_FPSMANAGER_OR_NULL_P" "SCM_SDL_FPSMANAGER_OR_NULL") (define-cproc sdl-fpsmanager? (obj) (return "SCM_SDL_FPSMANAGER_P")) ;;============================================================= ;; Functions ;; (define-cproc sdl-init-framerate () "ScmSdlFPSmanager *f = SCM_NEW(ScmSdlFPSmanager); SCM_SET_CLASS(f, SCM_CLASS_SDL_FPSMANAGER); SDL_initFramerate(SCM_SDL_FPSMANAGER(f)); SCM_RETURN(SCM_OBJ(f));") (define-cproc sdl-set-framerate (manager:: rate::) "int result = SDL_setFramerate(manager, rate); if (result < 0) SCM_RETURN(SCM_UNDEFINED); SCM_RETURN(SCM_MAKE_INT(result));") (define-cproc sdl-get-framerate (manager::) "SCM_RETURN(SCM_MAKE_INT(SDL_getFramerate(manager)));") (define-cproc sdl-fpsmanager-delay (manager::) (return "SDL_framerateDelay")) (define-cproc pixel-color (dst:: x:: y:: color::) (return "pixelColor")) (define-cproc pixel-rgba (dst:: x:: y:: r:: g:: b:: a::) (return "pixelRGBA")) (define-cproc hline-color (dst:: x1:: x2:: y:: color::) (return "hlineColor")) (define-cproc hline-rgba (dst:: x1:: x2:: y:: r:: g:: b:: a::) (return "hlineRGBA")) (define-cproc vline-color (dst:: x:: y1:: y2:: color::) (return "vlineColor")) (define-cproc vline-rgba (dst:: x:: y1:: y2:: r:: g:: b:: a::) (return "vlineRGBA")) (define-cproc rectangle-color (dst:: x1:: y1:: x2:: y2:: color::) (return "rectangleColor")) (define-cproc rectangle-rgba (dst:: x1:: y1:: x2:: y2:: r:: g:: b:: a::) (return "rectangleRGBA")) (define-cproc box-color (dst:: x1:: y1:: x2:: y2:: color::) (return "boxColor")) (define-cproc box-rgba (dst:: x1:: y1:: x2:: y2:: r:: g:: b:: a::) (return "boxRGBA")) (define-cproc line-color (dst:: x1:: y1:: x2:: y2:: color::) (return "lineColor")) (define-cproc line-rgba (dst:: x1:: y1:: x2:: y2:: r:: g:: b:: a::) (return "lineRGBA")) (define-cproc aaline-color (dst:: x1:: y1:: x2:: y2:: color::) (return "aalineColor")) (define-cproc aaline-rgba (dst:: x1:: y1:: x2:: y2:: r:: g:: b:: a::) (return "aalineRGBA")) (define-cproc circle-color (dst:: x:: y:: r:: color::) (return "circleColor")) (define-cproc circle-rgba (dst:: x:: y:: rad:: r:: g:: b:: a::) (return "circleRGBA")) (define-cproc aacircle-color (dst:: x:: y:: r:: color::) (return "aacircleColor")) (define-cproc aacircle-rgba (dst:: x:: y:: rad:: r:: g:: b:: a::) (return "aacircleRGBA")) (define-cproc filled-circle-color (dst:: x:: y:: r:: color::) (return "filledCircleColor")) (define-cproc filled-circle-rgba (dst:: x:: y:: rad:: r:: g:: b:: a::) (return "filledCircleRGBA")) (define-cproc ellipse-color (dst:: x:: y:: rx:: ry:: color::) (return "ellipseColor")) (define-cproc ellipse-rgba (dst:: x:: y:: rx:: ry:: r:: g:: b:: a::) (return "ellipseRGBA")) (define-cproc aaellipse-color (dst:: x:: y:: rx:: ry:: color::) (return "aaellipseColor")) (define-cproc aaellipse-rgba (dst:: x:: y:: rx:: ry:: r:: g:: b:: a::) (return "aaellipseRGBA")) (define-cproc filled-ellipse-color (dst:: x:: y:: rx:: ry:: color::) (return "filledEllipseColor")) (define-cproc filled-ellipse-rgba (dst:: x:: y:: rx:: ry:: r:: g:: b:: a::) (return "filledEllipseRGBA")) (define-cproc filled-pie-color (dst:: x:: y:: rad:: start:: end:: color::) (return "filledPieColor")) (define-cproc filled-pie-rgba (dst:: x:: y:: rad:: start:: end:: r:: g:: b:: a::) (return "filledPieRGBA")) (define-cproc polygon-color (dst:: vx:: vy:: n:: color::) "SCM_RETURN(SCM_MAKE_INT(polygonColor(dst, SCM_U16VECTOR_ELEMENTS(vx), SCM_U16VECTOR_ELEMENTS(vy), n, color)));") (define-cproc polygon-rgba (dst:: vx:: vy:: n:: r:: g:: b:: a::) "SCM_RETURN(SCM_MAKE_INT(polygonRGBA(dst, SCM_U16VECTOR_ELEMENTS(vx), SCM_U16VECTOR_ELEMENTS(vy), n, r, g, b, a)));") (define-cproc aapolygon-color (dst:: vx:: vy:: n:: color::) "SCM_RETURN(SCM_MAKE_INT(aapolygonColor(dst, SCM_U16VECTOR_ELEMENTS(vx), SCM_U16VECTOR_ELEMENTS(vy), n, color)));") (define-cproc aapolygon-rgba (dst:: vx:: vy:: n:: r:: g:: b:: a::) "SCM_RETURN(SCM_MAKE_INT(aapolygonRGBA(dst, SCM_U16VECTOR_ELEMENTS(vx), SCM_U16VECTOR_ELEMENTS(vy), n, r, g, b, a)));") (define-cproc filled-polygon-color (dst:: vx:: vy:: n:: color::) "SCM_RETURN(SCM_MAKE_INT(filledPolygonColor(dst, SCM_U16VECTOR_ELEMENTS(vx), SCM_U16VECTOR_ELEMENTS(vy), n, color)));") (define-cproc filled-polygon-rgba (dst:: vx:: vy:: n:: r:: g:: b:: a::) "SCM_RETURN(SCM_MAKE_INT(filledPolygonRGBA(dst, SCM_U16VECTOR_ELEMENTS(vx), SCM_U16VECTOR_ELEMENTS(vy), n, r, g, b, a)));") (define-cproc character-color (dst:: x:: y:: c:: color::) "SCM_RETURN(SCM_MAKE_INT(characterColor(dst, x, y, SCM_CHAR_VALUE(c), color)));") (define-cproc character-rgba (dst:: x:: y:: c:: r:: g:: b:: a::) "SCM_RETURN(SCM_MAKE_INT(characterRGBA(dst, x, y, SCM_CHAR_VALUE(c), r, g, b, a)));") (define-cproc string-color (dst:: x:: y:: c:: color::) "SCM_RETURN(SCM_MAKE_INT(stringColor(dst, x, y, Scm_GetStringConst(c), color)));") (define-cproc string-rgba (dst:: x:: y:: c:: r:: g:: b:: a::) "SCM_RETURN(SCM_MAKE_INT(stringRGBA(dst, x, y, Scm_GetStringConst(c), r, g, b, a)));") ;; Local variables: ;; mode: scheme ;; end: