summaryrefslogtreecommitdiff
path: root/sdl3/bindings/video.scm
blob: a9c55ac93f4aa916dcc570b71c3a9d64b9cf309a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
;;; guile-sdl3 -- Scheme bindings for SDL3
;;; Copyright © 2024 David Thompson <dthompson2@worcester.edu>
;;;
;;; Licensed under the Apache License, Version 2.0 (the "License");
;;; you may not use this file except in compliance with the License.
;;; You may obtain a copy of the License at
;;;
;;;    http://www.apache.org/licenses/LICENSE-2.0
;;;
;;; Unless required by applicable law or agreed to in writing, software
;;; distributed under the License is distributed on an "AS IS" BASIS,
;;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
;;; See the License for the specific language governing permissions and
;;; limitations under the License.

;;; Commentary:
;;
;; Low-level bindings for SDL_video.h.
;;
;;; Code:

(define-module (sdl3 bindings video)
  #:use-module (sdl3 bindings utils)
  #:use-module (system foreign)
  #:export (SDL_WindowFlags
            SDL_WINDOW_FULLSCREEN
            SDL_WINDOW_OPENGL
            SDL_WINDOW_OCCLUDED
            SDL_WINDOW_HIDDEN
            SDL_WINDOW_BORDERLESS
            SDL_WINDOW_RESIZABLE
            SDL_WINDOW_MINIMIZED
            SDL_WINDOW_MAXIMIZED
            SDL_WINDOW_MOUSE_GRABBED
            SDL_WINDOW_INPUT_FOCUS
            SDL_WINDOW_MOUSE_FOCUS
            SDL_WINDOW_EXTERNAL
            SDL_WINDOW_MODAL
            SDL_WINDOW_HIGH_PIXEL_DENSITY
            SDL_WINDOW_MOUSE_CAPTURE
            SDL_WINDOW_MOUSE_RELATIVE_MODE
            SDL_WINDOW_ALWAYS_ON_TOP
            SDL_WINDOW_UTILITY
            SDL_WINDOW_TOOLTIP
            SDL_WINDOW_POPUP_MENU
            SDL_WINDOW_KEYBOARD_GRABBED
            SDL_WINDOW_VULKAN
            SDL_WINDOW_METAL
            SDL_WINDOW_TRANSPARENT
            SDL_WINDOW_NOT_FOCUSABLE

            window?
            wrap-window
            unwrap-window
            window-destroyed?
            set-window-destroyed!

            SDL_CreateWindow
            SDL_DestroyWindow))

(define SDL_WindowFlags uint64)
(define SDL_WINDOW_FULLSCREEN          #x0000000000000001)
(define SDL_WINDOW_OPENGL              #x0000000000000002)
(define SDL_WINDOW_OCCLUDED            #x0000000000000004)
(define SDL_WINDOW_HIDDEN              #x0000000000000008)
(define SDL_WINDOW_BORDERLESS          #x0000000000000010)
(define SDL_WINDOW_RESIZABLE           #x0000000000000020)
(define SDL_WINDOW_MINIMIZED           #x0000000000000040)
(define SDL_WINDOW_MAXIMIZED           #x0000000000000080)
(define SDL_WINDOW_MOUSE_GRABBED       #x0000000000000100)
(define SDL_WINDOW_INPUT_FOCUS         #x0000000000000200)
(define SDL_WINDOW_MOUSE_FOCUS         #x0000000000000400)
(define SDL_WINDOW_EXTERNAL            #x0000000000000800)
(define SDL_WINDOW_MODAL               #x0000000000001000)
(define SDL_WINDOW_HIGH_PIXEL_DENSITY  #x0000000000002000)
(define SDL_WINDOW_MOUSE_CAPTURE       #x0000000000004000)
(define SDL_WINDOW_MOUSE_RELATIVE_MODE #x0000000000008000)
(define SDL_WINDOW_ALWAYS_ON_TOP       #x0000000000010000)
(define SDL_WINDOW_UTILITY             #x0000000000020000)
(define SDL_WINDOW_TOOLTIP             #x0000000000040000)
(define SDL_WINDOW_POPUP_MENU          #x0000000000080000)
(define SDL_WINDOW_KEYBOARD_GRABBED    #x0000000000100000)
(define SDL_WINDOW_VULKAN              #x0000000010000000)
(define SDL_WINDOW_METAL               #x0000000020000000)
(define SDL_WINDOW_TRANSPARENT         #x0000000040000000)
(define SDL_WINDOW_NOT_FOCUSABLE       #x0000000080000000)

(define-sdl-pointer-type <window>
  window? wrap-window unwrap-window
  window-destroyed? set-window-destroyed!
  (lambda (window port)
    (display "#<window>" port)))

(define-sdl SDL_CreateWindow '* int int SDL_WindowFlags -> '*)
(define-sdl SDL_DestroyWindow '*)