cuboid (empty) → 0.1
raw patch · 4 files changed
+86/−0 lines, 4 filesdep +GLUTdep +Yampadep +basesetup-changed
Dependencies added: GLUT, Yampa, base
Files
- LICENSE +19/−0
- Main.hs +31/−0
- Setup.hs +4/−0
- cuboid.cabal +32/−0
+ LICENSE view
@@ -0,0 +1,19 @@+Copyright (c) 2010 Pedro Martins++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.
+ Main.hs view
@@ -0,0 +1,31 @@+{-# LANGUAGE Arrows #-}+module Main where++import FRP.Yampa+import Graphics.UI.GLUT hiding (Level,Vector3(..),normalize)++import Data.IORef++import Graphics+import Input+import GameLogic++-- | Main, initializes Yampa and sets up reactimation loop+main :: IO ()+main = do+ newInput <- newIORef NoEvent+ rh <- reactInit (initGL >> return NoEvent) (\_ _ b -> b >> return False) + (parseInput >>> calculateState >>> game)+ displayCallback $= return ()+ keyboardMouseCallback $= Just + (\k ks m _ -> writeIORef newInput (Event $ Keyboard k ks m))+ idleCallback $= Just (idle newInput rh) + mainLoop++-- | Reactimation iteration, supplying the input+idle :: IORef (Event Input) -> ReactHandle (Event Input) (IO ()) -> IO ()+idle newInput rh = do+ newInput' <- readIORef newInput+ react rh (1, Just newInput')+ return ()+
+ Setup.hs view
@@ -0,0 +1,4 @@+#!/usr/bin/env runhaskell+import Distribution.Simple+main = defaultMain+
+ cuboid.cabal view
@@ -0,0 +1,32 @@+Name: cuboid +Category: Game+Description:++ A simple 3D puzzle game made with Yampa and GLUT. The objective+ of the game is to get the red sphere to the green sphere, by+ moving the red sphere.+ .+ Use the W and D keys to rotate the cube, and the arrow keys+ (up\/down\/left\/right), to move the red ball (front\/back\/left\/right+ respectively). The red sphere will then move until it hits an+ obstacle (green cube) and then stops.+ .+ In order to add levels check out Game.hs. If you come up with+ a great level do send it to me. I plan to extract the levels+ into a configuration file in the future.++Synopsis: 3D Yampa/GLUT Puzzle Game +Version: 0.1+License: MIT+License-file: LICENSE+Copyright: (C) 2010 Pedro Martins+Author: Pedro Martins <pedromartins.pt@gmail.com>+Maintainer: Pedro Martins <pedromartins.pt@gmail.com>+Stability: experimental+Build-Type: Simple+Cabal-Version: >= 1.4++Executable cuboid + Main-Is: Main.hs+ Build-Depends: base >= 3 && < 5, Yampa, GLUT+