Coder Social home page Coder Social logo

guile-allegro5's Introduction

Guile Bindings for Allegro 5

Allegro 5 is a cross-platform, open source, game programming library written in C. Guile-allegro5 is a collection of modules that provides bindings for Guile.

Example

(use-modules (allegro system)
             (allegro display)
             (allegro events)
             (allegro keyboard)
             (allegro timer)
             (allegro graphics)
             (allegro addons image))

(define timer #f)
(define events #f)
(define running #t)
(define redraw #t)
(define image #f)
(define window #f)

(al-init)
(al-init-image-addon)
(al-install-keyboard)

(define (game-loop)
  (set! window (al-create-display 640 480))
  (set! timer (al-create-timer (/ 1 60)))
  (set! events (al-create-event-queue))
  (set! image (al-load-bitmap "player.png"))
  (al-register-event-source events (al-get-timer-event-source timer))
  (al-register-event-source events (al-get-keyboard-event-source))

  (set! running #t)
  (set! redraw #t)
  (al-start-timer timer)
  (while running
    (let ((event (al-wait-for-event events)))
      (cond ((= (al-get-event-type event) allegro-event-key-up)
             (set! running #f))
            ((= (al-get-event-type event) allegro-event-timer)
             (set! redraw #t)))
      (when (and redraw (al-is-event-queue-empty? events))
        (set! redraw #f)
        (al-clear-to-color 0 0 0)
        (al-draw-bitmap image 100 100 0)
        (al-flip-display))))
  (al-destroy-bitmap image)
  (al-destroy-event-queue events)
  (al-destroy-timer timer)
  (al-destroy-display window))

(game-loop)

Installing

./autogen.sh
./configure --prefix=/usr
make
sudo make install

Hacking

The bindings are incomplete. Please help fill in the gaps.

License

GNU LGPL v3

guile-allegro5's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.