Code Monkey home page Code Monkey logo

odin's Introduction

odin

odin-engine is a high level 2d game and application engine. It provides a number of composable GUI widgets and glue code to various useful libraries. It is written on top of reflex-sdl2, an FRP over SDL2.

batteries included

  • reflex-sdl2 provides the main loop and the control scheme is familiar FRP if you've used any reflex based hosts.

  • gelatin-sdl2 is the OpenGL/SDL2 rendering backend. It supports 2d rendering through colors and textures.

  • varying provides smooth FRP-based animation.

  • shapes provides a purely function 2d collision detection and physics system.

installation

odin-engine depends on

You can install them with the following platform specific steps.

Mac OS X

Using homebrew...

brew install freetype
brew install sdl2

Ubuntu

First install freetype2

apt-get install libfreetype6

The sdl2 bindings require an sdl2 install >= 2.0.4, or for special instructions to be followed. Assuming you're on Ubuntu >= 16.04, you can simply run

apt-get install libsdl2-dev

otherwise please visit the link above and install via their README.

Windows

Coming soon

building source

The easiest way to get up and running on the Haskell toolchain is to download stack. All of odin's projects are spec'd out with stack.yaml build files, so picking the correct versions of libraries is not needed if you follow the stack path.

git clone https://github.com/schell/odin.git

cd odin

If you just installed stack, run

stack setup

Go make some ☕ and then...

stack build

Drink your ☕, take a walk and then run...

stack exec mapMaker

contributions

I welcome any and all contributions. This means bug reports, pull requests or even donations through patreon. This game and engine will always be free.

odin's People

Contributors

schell avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

odin's Issues

Move a bunch of this stuff into the backend.


A Layer is an offscreen buffer that can be rendered to, and then
transformed and rendered separately. It is used for GUI elements like Pane
and Panel.
Located in "schell/odin/odin-engine/src/Odin/Engine/GUI/Layer.hs" on line 20

build failures (using lts-8.17)

After fixing the issues with building the gl dependency, it looks like the Tiled support is broken:

[18 of 23] Compiling Odin.Engine.Tiled ( src/Odin/Engine/Tiled.hs, .stack-work/dist/x86_64-osx/Cabal-1.24.2.0/build/Odin/Engine/Tiled.o )

/Users/chuck/proj/hs/odin/odin-engine/src/Odin/Engine/Tiled.hs:31:30: error:
    Not in scope: type constructor or class ‘TileIndex’

/Users/chuck/proj/hs/odin/odin-engine/src/Odin/Engine/Tiled.hs:81:63: error:
    Not in scope: type constructor or class ‘TileIndex’

/Users/chuck/proj/hs/odin/odin-engine/src/Odin/Engine/Tiled.hs:85:5: error:
    Not in scope: data constructor ‘LayerContentsTiles’

/Users/chuck/proj/hs/odin/odin-engine/src/Odin/Engine/Tiled.hs:88:44: error:
    Not in scope: type constructor or class ‘TileIndex’

/Users/chuck/proj/hs/odin/odin-engine/src/Odin/Engine/Tiled.hs:97:10: error:
    Not in scope: data constructor ‘TileIndex’

/Users/chuck/proj/hs/odin/odin-engine/src/Odin/Engine/Tiled.hs:97:21: error: Not in scope: ‘tileIndexGid’

/Users/chuck/proj/hs/odin/odin-engine/src/Odin/Engine/Tiled.hs:98:21: error:
    Not in scope: ‘tileIndexIsDiagFlipped’
    Perhaps you meant ‘tileIsDiagFlipped’ (imported from Data.Tiled)

/Users/chuck/proj/hs/odin/odin-engine/src/Odin/Engine/Tiled.hs:99:21: error:
    Not in scope: ‘tileIndexIsHFlipped’
    Perhaps you meant ‘tileIsHFlipped’ (imported from Data.Tiled)

/Users/chuck/proj/hs/odin/odin-engine/src/Odin/Engine/Tiled.hs:100:21: error:
    Not in scope: ‘tileIndexIsVFlipped’
    Perhaps you meant ‘tileIsVFlipped’ (imported from Data.Tiled)

/Users/chuck/proj/hs/odin/odin-engine/src/Odin/Engine/Tiled.hs:103:40: error:
    Not in scope: type constructor or class ‘TileIndex’

/Users/chuck/proj/hs/odin/odin-engine/src/Odin/Engine/Tiled.hs:111:38: error:
    Not in scope: type constructor or class ‘TileIndex’

/Users/chuck/proj/hs/odin/odin-engine/src/Odin/Engine/Tiled.hs:130:48: error:
    Not in scope: type constructor or class ‘Animation’

/Users/chuck/proj/hs/odin/odin-engine/src/Odin/Engine/Tiled.hs:150:35: error:
    Not in scope: type constructor or class ‘TileIndex’

/Users/chuck/proj/hs/odin/odin-engine/src/Odin/Engine/Tiled.hs:151:33: error:
    Not in scope: data constructor ‘TileIndex’

/Users/chuck/proj/hs/odin/odin-engine/src/Odin/Engine/Tiled.hs:156:33: error:
    Not in scope: type constructor or class ‘TileIndex’

/Users/chuck/proj/hs/odin/odin-engine/src/Odin/Engine/Tiled.hs:160:37: error:
    Not in scope: type constructor or class ‘TileIndex’

/Users/chuck/proj/hs/odin/odin-engine/src/Odin/Engine/Tiled.hs:174:6: error:
    Not in scope: type constructor or class ‘TileIndex’

/Users/chuck/proj/hs/odin/odin-engine/src/Odin/Engine/Tiled.hs:249:6: error:
    Not in scope: type constructor or class ‘Animation’

/Users/chuck/proj/hs/odin/odin-engine/src/Odin/Engine/Tiled.hs:251:51: error:
    Not in scope: data constructor ‘Animation’

/Users/chuck/proj/hs/odin/odin-engine/src/Odin/Engine/Tiled.hs:252:16: error:
    Not in scope: data constructor ‘Frame’

`stack build` fails due to relative paths outside of repo in stack.yaml

stack build fails with the following error:

/home/tripped/src/odin/../gelatin/gelatin-core: canonicalizePath: does not exist (No such file or directory)

It looks like this was introduced in commit cd59ca10, when the stack.yaml dependencies were replaced with relative paths outside of the repo. I was going to try fixing the dependencies myself and submitting a PR along with this issue, but as the change appears deliberate I'm not sure if there was a specific way you were planning to get the dependencies in a working order.

Change this to 'getFontMapVar'

getTVarFontMap :: Odin r t m => m (TVar FontMap)
Located in "schell/odin/odin-engine/src/Odin/Engine/New.hs" on line 265

Configurable widget z-index.

Currently a widget simply renders in the order it was written in the Odin r t m monad. This should instead be configurable so widgets that depend on other widgets don't always have to be rendered on top.

stack build fails

Stack build fails with the following error message:

The same package name is used in multiple local packages

QuadTree used in:
- PLIndex "QuadTree-0.11.0"
- PLOther (PLRepo (Repo {repoUrl = "https://github.com/schell/QuadTree", repoCommit = "bd11166e50e5f2f4ade87613520aaf82e23cc9eb", repoType = RepoGit, repoSubdirs = "."}))

build failure with current stack.yaml

After a fresh clone followed by stack build, the gl dependency will not build. If I remove the gl repo from stack.yaml and update the resolver to lts-8.17, the dependency builds fine (though Odin itself still fails to build, which I'll file separately)

Here's the relevant error:

--  While building package gl-0.8.0 using:
  /Users/chuck/.stack/programs/x86_64-osx/ghc-8.0.2/bin/ghc --make -odir /Users/chuck/proj/hs/odin/.stack-work/downloaded/Zpw1QwqLgZxs/.stack-work/dist/x86_64-osx/Cabal-1.24.2.0/setup -hidir /Users/chuck/proj/hs/odin/.stack-work/downloaded/Zpw1QwqLgZxs/.stack-work/dist/x86_64-osx/Cabal-1.24.2.0/setup -i -i. -clear-package-db -global-package-db -package-db=/Users/chuck/.stack/snapshots/x86_64-osx/lts-8.0/8.0.2/pkgdb -package-db=/Users/chuck/proj/hs/odin/.stack-work/install/x86_64-osx/lts-8.0/8.0.2/pkgdb -hide-all-packages -package-id=Cabal-1.24.2.0 -package-id=base-4.9.1.0 -package-id=directory-1.3.0.0 -package-id=filepath-1.4.1.1 -package-id=hxt-9.3.1.16-C6pOQ0xFGQt4YvlUY7LC4u -optP-include -optP/Users/chuck/proj/hs/odin/.stack-work/downloaded/Zpw1QwqLgZxs/.stack-work/dist/x86_64-osx/Cabal-1.24.2.0/setup/setup_macros.h /Users/chuck/proj/hs/odin/.stack-work/downloaded/Zpw1QwqLgZxs/Setup.hs /Users/chuck/.stack/setup-exe-src/setup-shim-mPHDZzAJ.hs -main-is StackSetupShim.mainOverride -o /Users/chuck/proj/hs/odin/.stack-work/downloaded/Zpw1QwqLgZxs/.stack-work/dist/x86_64-osx/Cabal-1.24.2.0/setup/setup -threaded
Process exited with code: ExitFailure 1
Logs have been written to: /Users/chuck/proj/hs/odin/.stack-work/logs/gl-0.8.0.log

[1 of 7] Compiling Utils            ( Utils.hs, /Users/chuck/proj/hs/odin/.stack-work/downloaded/Zpw1QwqLgZxs/.stack-work/dist/x86_64-osx/Cabal-1.24.2.0/setup/Utils.o )
[2 of 7] Compiling Registry         ( Registry.hs, /Users/chuck/proj/hs/odin/.stack-work/downloaded/Zpw1QwqLgZxs/.stack-work/dist/x86_64-osx/Cabal-1.24.2.0/setup/Registry.o )
[3 of 7] Compiling Parser           ( Parser.hs, /Users/chuck/proj/hs/odin/.stack-work/downloaded/Zpw1QwqLgZxs/.stack-work/dist/x86_64-osx/Cabal-1.24.2.0/setup/Parser.o )
[4 of 7] Compiling Module           ( Module.hs, /Users/chuck/proj/hs/odin/.stack-work/downloaded/Zpw1QwqLgZxs/.stack-work/dist/x86_64-osx/Cabal-1.24.2.0/setup/Module.o )
[5 of 7] Compiling Generator        ( Generator.hs, /Users/chuck/proj/hs/odin/.stack-work/downloaded/Zpw1QwqLgZxs/.stack-work/dist/x86_64-osx/Cabal-1.24.2.0/setup/Generator.o )

Generator.hs:16:1: error:
    Failed to load interface for ‘Control.Monad.Trans.State’
    It is a member of the hidden package ‘transformers-0.5.2.0’.
    Use -v to see a list of the files searched for.

Generator.hs:21:1: error:
    Failed to load interface for ‘Data.Map’
    It is a member of the hidden package ‘containers-0.5.7.1’.
    Use -v to see a list of the files searched for.

Generator.hs:22:1: error:
    Failed to load interface for ‘Data.Map’
    It is a member of the hidden package ‘containers-0.5.7.1’.
    Use -v to see a list of the files searched for.

Generator.hs:23:1: error:
    Failed to load interface for ‘Data.Set’
    It is a member of the hidden package ‘containers-0.5.7.1’.
    Use -v to see a list of the files searched for.

Generator.hs:24:1: error:
    Failed to load interface for ‘Data.Set’
    It is a member of the hidden package ‘containers-0.5.7.1’.
    Use -v to see a list of the files searched for.

Move a bunch of this stuff into the backend


A Layer is an offscreen buffer that can be rendered to, and then
transformed and rendered separately. It is used for GUI elements like Pane
and Panel.
Located in "schell/odin/odin-engine/src/Odin/Engine/GUI/Layer.hs" on line 20

Create a text layout mechanism for interacting with large-ish bodies of text.

When working with larger bodies of text (like > 4 words), measuring the bounds of text gets really expensive. You can see here how slow the prog gets while editing text.

thu-aug-18-09-57-01-pdt-2016

I think I could write a layout "engine" that only re-renders and re-measures each new word, and saves each processed word in a map keyed by the word itself.

Attached are the prof and ps files from a similar run.

Thu-Aug-18-09:48:52-PDT-2016 copy.txt
Thu-Aug-18-09:48:52-PDT-2016 copy.pdf

could not create window

Got odin to build, but all I get when I run it is "could not create window". GHC 7.10.3 on Debian amd64. Suggestions welcome.

^ Change this to V2 Float

-> m (a, PanelState)
Located in "schell/odin/odin-engine/src/Odin/Engine/GUI/Panel.hs" on line 86

Create layer widget

A layer widget is a composite of a bunch of other widgets, fenced off by a boundary. It only receives events when the user is interacting with that layer within the boundary.

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.