# See the License for the specific language governing permissions and
# limitations under the License.
# See the License for the specific language governing permissions and
# limitations under the License.
module sdl is
cflags exec("sdl-config", "--cflags")
ldflags(exec("sdl-config", "--libs"), "-lSDL_image -lSDL_ttf")
end
module sdl is
cflags exec("sdl-config", "--cflags")
ldflags(exec("sdl-config", "--libs"), "-lSDL_image -lSDL_ttf")
end
# Clear the entire window with given RGB color (integer values)
fun clear_int(r, g, b: Int) `{
# Clear the entire window with given RGB color (integer values)
fun clear_int(r, g, b: Int) `{
- SDL_FillRect(recv, NULL, SDL_MapRGB(recv->format,r,g,b));
+ SDL_FillRect(self, NULL, SDL_MapRGB(self->format,r,g,b));
# Fill a rectangle with given color
fun fill_rect(rect: SDLRectangle, r, g, b: Int) `{
# Fill a rectangle with given color
fun fill_rect(rect: SDLRectangle, r, g, b: Int) `{
- SDL_FillRect(recv, rect, SDL_MapRGB(recv->format,r,g,b));
+ SDL_FillRect(self, rect, SDL_MapRGB(self->format,r,g,b));
- SDL_FillRect(recv, NULL, SDL_MapRGB(recv->format,ri,gi,bi));
+ SDL_FillRect(self, NULL, SDL_MapRGB(self->format,ri,gi,bi));
# Grab or release the input
fun grab_input=(val: Bool) `{ SDL_WM_GrabInput(val? SDL_GRAB_ON: SDL_GRAB_OFF); `}
# Is the input grabbed?
# Grab or release the input
fun grab_input=(val: Bool) `{ SDL_WM_GrabInput(val? SDL_GRAB_ON: SDL_GRAB_OFF); `}
# Is the input grabbed?
- SDL_BlitSurface(img, NULL, recv, &dst);
+ SDL_BlitSurface(img, NULL, self, &dst);
fun save_to_file(path: String) import String.to_cstring `{ `}
# Destroy the image and free the memory
fun save_to_file(path: String) import String.to_cstring `{ `}
# Destroy the image and free the memory
init (x, y, rel_x, rel_y: Float, pressed: Bool)
do
init (x, y, rel_x, rel_y: Float, pressed: Bool)
do
# Create a String with the specified color, return an SDLImage
fun render(text: String, r, g, b: Int): SDLImage import String.to_cstring `{
# Create a String with the specified color, return an SDLImage
fun render(text: String, r, g, b: Int): SDLImage import String.to_cstring `{
`}
# Return the family name of the font
fun family_name: nullable String import String.to_cstring, String.as nullable `{
`}
# Return the family name of the font
fun family_name: nullable String import String.to_cstring, String.as nullable `{
# Return the style name of the font
fun style_name: nullable String import String.to_cstring, String.as nullable `{
# Return the style name of the font
fun style_name: nullable String import String.to_cstring, String.as nullable `{
- if (TTF_SizeText(recv, ctext, &w, NULL))
+ if (TTF_SizeText(self, ctext, &w, NULL))