<commit_before>(in-package :sdl2-examples)

(require :sdl2)

(defun basic-test ()
  (sdl2:with-init (:video)
    (let* ((win (sdl2:create-window :flags '(:shown :opengl)))
           (gl-context (sdl2:gl-create-context win)))
      (sdl2:gl-make-current win gl-context)
      (sdl2:with-event-loop (:method :poll)
        (:keyup ()
                (sdl2:push-event :quit))
        (:mousemotion (:x x :y y :xrel xrel :yrel yrel :state state)
                      (print (format
                              nil
                              "Mouse motion abs(rel): ~a (~a), ~a (~a)~%Mouse state: ~a~%"
                              x xrel y yrel state)))
        (:idle ()
               (sdl2:gl-swap-window win))
        (:quit ()
               t))
      (sdl2:gl-delete-context gl-context)
      (sdl2:destroy-window win))))<commit_msg>- basic test is now at least a bit more interesting visually<commit_after>(in-package :sdl2-examples)

(require :sdl2)
(require :cl-opengl)

(defun basic-test ()
  (sdl2:with-init (:video)
    (let* ((win (sdl2:create-window :flags '(:shown :opengl)))
           (gl-context (sdl2:gl-create-context win)))
      (sdl2:gl-make-current win gl-context)
      (gl:viewport 0 0 800 600)
      (gl:matrix-mode :projection)
      (gl:ortho -2 2 -2 2 -2 2)
      (gl:matrix-mode :modelview)
      (gl:load-identity)
      (gl:clear-color 0.0 0.0 1.0 1.0)
      (gl:clear :color-buffer)
      (sdl2:with-event-loop (:method :poll)
        (:keyup ()
                (sdl2:push-event :quit))
        (:mousemotion (:x x :y y :xrel xrel :yrel yrel :state state)
                      (print (format
                              nil
                              "Mouse motion abs(rel): ~a (~a), ~a (~a)~%Mouse state: ~a"
                              x xrel y yrel state)))
        (:idle ()
               (gl:clear :color-buffer)
               (gl:begin :triangles)
               (gl:color 1.0 0.0 0.0)
               (gl:vertex 0.0 1.0)
               (gl:vertex -1.0 -1.0)
               (gl:vertex 1.0 -1.0)
               (gl:end)
               (gl:flush)
               (sdl2:gl-swap-window win))
        (:quit ()
               t))
      (sdl2:gl-delete-context gl-context)
      (sdl2:destroy-window win))))
{'fraction_non_alphanumeric': 0.151797603195739, 'fraction_numerical': 0.027518863737239236, 'mean_word_length': 1.5497737556561086, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3905412', 'n_tokens_mistral': 815, 'n_tokens_neox': 740, 'n_words': 181}