Skip to content

Instantly share code, notes, and snippets.

View funrep's full-sized avatar

Karl-Oskar Rikås funrep

View GitHub Profile
@funrep
funrep / game.hs
Last active December 29, 2015 10:59
{-# LANGUAGE Rank2Types #-}
import qualified Graphics.UI.SDL as SDL
import Reactive.Banana
import Reactive.Banana.Frameworks
{------------------------------------------------------------------------------
Main
---------------------------------------------------------------------------}
-- I'm currently trying to translate this code https://github.com/bernstein/breakout/blob/master/src/ReactiveUtils.hs
-- to use linear package instead of vector-space, and I'm not sure if I've understood diffE completely.
import Linear.Vector
import Reactive.Banana
type Time = Double
integral :: (Additive f, Num a) => Event t Time -> Behavior t (f a)
-> Behavior t (f a)
integral :: Additive a => Event t Time -> Behavior t a -> Behavior t a
integral t b = sumB $ (\v dt -> dt *^ v) <$> b <@> diffE t
// Nexuiz version (formatted for humans)
set g_nexuizversion "2.1"
// Nexuiz version (formatted for machines)
// used to determine if a client version is compatible
// this doesn't have to be bumped with every release
// bump when clients become incompatible or any other perfectly good reason
// (e.g. game data incompatibility, engine version incompatibility, etc
// note: this automatically filters the server browser, clients of the new
// version won't see old servers, and clients of the old version won't see new
module Main where
import Hell
import DotHellRC
main = startHell def { configImports = "import DotHellRC" : configImports def }
name: dothellrc
version: 0.1.0.0
synopsis: My personal ".hellrc"
license: WTFPL
license-file: COPYING
author: Karl-Oskar "klrr" Rikås
maintainer: karloskarrikaas@gmail.com
copyright: (C) 2013, Karl-Oskar Rikås
category: System
build-type: Simple
-- some stuff taken from ocharle's SDL and netwire tutorial, https://github.com/ocharles/ocharles.org.uk--Getting-Started-with-Netwire-and-SDL/blob/master/Challenge3.hs
{-# LANGUAGE StandaloneDeriving #-}
import Data.Word (Word16)
import Data.Set (Set)
import qualified Data.Set as Set
import qualified Graphics.UI.SDL as SDL
import Reactive.Banana
import Reactive.Banana.Frameworks
main = do
import Data.Bits
import Data.Word
import Data.IORef
import qualified Graphics.UI.SDL as SDL
import qualified Graphics.UI.SDL.Primitives as SDL
main = do
SDL.init [SDL.InitEverything]
SDL.setVideoMode 640 480 32 []
var <- newIORef (0, 0)
@funrep
funrep / sdl.hs
Created November 13, 2013 17:32
import Data.Bits
import Data.Word
import Data.IORef
import qualified Graphics.UI.SDL as SDL
import qualified Graphics.UI.SDL.Primitives as SDL
main = do
SDL.init [SDL.InitEverything]
SDL.setVideoMode 640 480 32 []
var <- newIORef (0, 0)
import qualified Graphics.UI.SDL as SDL
import qualified Graphics.UI.SDL.Primitives as SDL
main = do
SDL.init [SDL.InitEverything]
SDL.setVideoMode 640 480 32 [] >>= loop
loop screen = do
SDL.rectangle screen (SDL.Rect 50 50 100 100) (SDL.Pixel 101)
SDL.flip screen