Skip to content

Commit

Permalink
Did lot's things
Browse files Browse the repository at this point in the history
  • Loading branch information
resttime committed Oct 31, 2014
1 parent bb0cd77 commit f638a71
Show file tree
Hide file tree
Showing 29 changed files with 169 additions and 1 deletion.
Binary file removed Demos/Outdated Demos/Random Screenshots/3-shot.gif
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed Demos/Outdated Demos/Random Screenshots/firing.gif
Binary file not shown.
Binary file removed Demos/Outdated Demos/Random Screenshots/offset.gif
Binary file not shown.
Binary file not shown.
Binary file not shown.
9 changes: 9 additions & 0 deletions Demos/Outdated Demos/Screenshots0/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
3-shot.gif: a.pomf.se/rbeyhg.gif
aim-fire-v2.gif: a.pomf.se/otywjt.gif
aim-fire-v3.gif: a.pomf.se/akymqn.gif
aim-firing.gif: a.pomf.se/ktcuvy.gif
better-firing-code.gif: a.pomf.se/rowona.gif
firing.gif: a.pomf.se/vgfvzz.gif
offset.gif: a.pomf.se/fjitpq.gif
simple-bb-collision.gif: a.pomf.se/sutjog.gif
take-damage!.gif: a.pomf.se/dmqsbs.gif
8 changes: 8 additions & 0 deletions Demos/Outdated Demos/Screenshots1/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
20000 entities.gif: a.pomf.se/bnnpxz.gif
collecting game.gif: a.pomf.se/ncsqtm.gif
fixed my timestep.gif: a.pomf.se/tkltdt.gif
higher level lisp api.gif: a.pomf.se/ebvxte.gif
multiple windows.gif: a.pomf.se/zqdcub.gif
opengl.gif: a.pomf.se/dmrjmr.gif
pong.gif: a.pomf.se/dmbxrx.gif
sprite animation.gif: a.pomf.se/npujwk.gif
14 changes: 14 additions & 0 deletions Demos/lispy-interface.lisp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
(ql:quickload "cl-liballegro")
(defclass window (al:system) ()
(:default-initargs :display-flags '(:windowed :opengl :resizable)
:title "Hurray!"))

(defmethod al:render ((sys window))
(al:clear-to-color (al:map-rgb 20 150 100))
(al:flip-display))

(defmethod al:key-down-handler ((sys window))
(print (al:keycode-of (al:event sys))))

(defun main ()
(al:run-system (make-instance 'window)))
82 changes: 82 additions & 0 deletions Demos/modern-opengl.lisp
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
(ql:quickload "cl-liballegro")
(ql:quickload "cl-opengl")


(defparameter *vert-shader*
"#version 330 core
layout(location = 0) in vec3 vertexPosition_modelspace;
void main() {
gl_Position.xyz = vertexPosition_modelspace;
gl_Position.w = 1.0;
}")
(defparameter *frag-shader*
"#version 330 core
out vec3 color;
void main() {
color = vec3(0.5,0.5,0.5);
}")

(defclass game (al:system)
((vao :accessor vao)
(vb :accessor vb)
(vertex-shader :accessor vertex-shader)
(fragment-shader :accessor fragment-shader)
(program :accessor program))
(:default-initargs
:width 300 :height 300
:title "YEAH"
:logic-fps 1
:display-flags '(:opengl :opengl-3-0)
:display-options '((:sample-buffers 1 :suggest)
(:samples 8 :suggest))))

(defmethod al:system-loop :before ((sys game))
(setf (vao sys) (gl:gen-vertex-arrays 1))
(setf (vb sys) (gl:gen-buffers 1))
(gl:bind-vertex-array (first (vao sys)))
(gl:bind-buffer :array-buffer (first (vb sys)))
(let ((vert-data #(-1.0 -1.0 0.0
1.0 -1.0 0.0
0.0 1.0 0.0))
(arr (gl:alloc-gl-array :float 9)))
(dotimes (i (length vert-data))
(setf (gl:glaref arr i) (aref vert-data i)))
(gl:buffer-data :array-buffer :static-draw arr)
(gl:free-gl-array arr))
(let ((vs (gl:create-shader :vertex-shader))
(fs (gl:create-shader :fragment-shader)))
(setf (vertex-shader sys) vs)
(setf (fragment-shader sys) fs)
(gl:shader-source vs *vert-shader*)
(gl:compile-shader vs)
(gl:shader-source fs *frag-shader*)
(gl:compile-shader fs)
(setf (program sys) (gl:create-program))
(gl:attach-shader (program sys) vs)
(gl:attach-shader (program sys) fs)
(print (gl:get-shader-info-log vs))
(print (gl:get-shader-info-log fs))
(gl:link-program (program sys))))

(defmethod al:update ((sys game))
(print 'one-logic-fps))
(defmethod al:render ((sys game))
(gl:clear-color 0.0 0.0 0.0 1.0)
(gl:clear :color-buffer-bit)
(gl:matrix-mode :projection)
(gl:load-identity)
(gl:use-program (program sys))
(gl:enable-vertex-attrib-array 0)
(gl:bind-buffer :array-buffer (first (vb sys)))
(gl:vertex-attrib-pointer 0 3 :float :false 0 (cffi:null-pointer))
(gl:draw-arrays :triangles 0 3)
(gl:disable-vertex-attrib-array 0)
(gl:use-program 0)
(al:flip-display))

(defun main ()
(al:run-system (make-instance 'game)))

Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
(al:set-new-display-flags '(:windowed :resizable :opengl)) ; al_set_new_display_flags(ALLEGRO_WINDOWED | ALLEGRO_RESIZABLE);
(al:set-new-display-option :vsync 1 :require) ; al_set_new_display_option(ALLEGRO_VSYNC, 1, ALLEGRO_REQUIRE);
(setf display (al:create-display 800 600)) ; display = al_create_display(800, 600);
(al:clear-to-color (al:map-rgb 128 128 128)) ; al_clear_to_color(...); //
(al:clear-to-color (al:map-rgb 128 128 128)) ; al_clear_to_color(al_map_rgb(128 128 128);
(al:flip-display) ; al_flip_display();
(al:rest-time 2) ; al_rest(2);
(al:destroy-display display) ; al_destroy_display(display);
Expand Down
Binary file removed Screenshots/20000 entities.gif
Binary file not shown.
Binary file removed Screenshots/collecting game.gif
Binary file not shown.
Binary file removed Screenshots/fixed my timestep.gif
Binary file not shown.
Binary file removed Screenshots/higher level lisp api.gif
Binary file not shown.
Binary file removed Screenshots/multiple windows.gif
Binary file not shown.
Binary file removed Screenshots/opengl.gif
Binary file not shown.
Binary file removed Screenshots/pong.gif
Binary file not shown.
Binary file removed Screenshots/sprite animation.gif
Binary file not shown.
34 changes: 34 additions & 0 deletions Windows DLLs/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
libffi - Copyright (c) 1996-2014 Anthony Green, Red Hat, Inc and others.
See source files for details.

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
``Software''), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Copyright © 2008-2010 the Allegro 5 Development Team

This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.

Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:

The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.

Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.

This notice may not be removed or altered from any source distribution.

File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions Windows DLLs/x86_64/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The allegro5 DLL is actually of 5.1 and not 5.0 like the rest. Keep that in mind if you run into any problems.
Binary file not shown.
Binary file added Windows DLLs/x86_64/libffi-6.dll
Binary file not shown.
20 changes: 20 additions & 0 deletions allegro/package.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,26 @@
;; Generic System Runner
#:run-system

;;; Type Accessors
#:event-type-of
#:event-struct-type-of
#:cffi-event-struct-type-of
#:display-of
#:x-of
#:y-of
#:button-of
#:id-of
#:stick-of
#:axis-of
#:pos-of
#:width-of
#:height-of
#:orientation-of
#:keycode-of
#:unichar-of
#:modifiers-of
#:reapeat-of

;;; Configuration Files
#:create-config
#:destroy-config
Expand Down

0 comments on commit f638a71

Please sign in to comment.