Giter Site home page Giter Site logo

gloss's Introduction

gloss

Build Status

Gloss hides the pain of drawing simple vector graphics behind a nice data type and a few display functions.

Example

Getting something on the screen is as easy as:

import Graphics.Gloss
main = display (InWindow "Nice Window" (200, 200) (10, 10)) white (Circle 80)

Explore and run the example projects using stack:

$ stack setup
$ stack build
$ stack exec gloss-boids

Usage

Once the window is open you can use the following:

  • Quit

    • esc-key
  • Move Viewport

    • arrow keys
    • left-click drag
  • Zoom Viewport

    • page up/down-keys
    • control-left-click drag
    • right-click drag
    • mouse wheel
  • Rotate Viewport

    • home/end-keys
    • alt-left-click drag
  • Reset Viewport

    • 'r'-key

More

  • Animations and simulations can be constructed similarly using the 'animate' and 'simulate' functions
  • Games with user input can be constructed with the 'play' function.
  • See the gloss-examples package for more.

PULL REQUESTS

As Gloss is now fairly stable, I typically make releases only when there is a new GHC version. If you have added a new feature or fixed a bug, and want your pull request merged sooner than that, then send email to benl AT ouroborus.net. I don't pay attention to github notifications, but am happy to receive emails from people. If you have changed any internal functionality then please test that all the gloss-examples still work before submitting your pull request.

If you just want to bump a dependency version then get a Hackage trustee to edit the package information directly on Hackage. You don't need to raise a pull request here.

gloss's People

Contributors

acowley avatar banx avatar basile-henry avatar benl23x5 avatar bitonic avatar cdsmith avatar christiaanb avatar christopherking42 avatar damiencourousse avatar dougburke avatar elisehuard avatar esgeh avatar evanrinehart avatar gabriella439 avatar gelisam avatar georgefst avatar glguy avatar housek avatar klao avatar kvanbere avatar lancelet avatar quoteme avatar sgraf812 avatar tfausak avatar thalerjonathan avatar tmcdonell avatar tommd avatar tranma avatar treeowl avatar tuongnm 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  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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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

gloss's Issues

GLFW backend - Holding down a key results in repeated Up events

GLFW repeatedly sends GLFW.KeyState'Repeating when button is held down - https://www.glfw.org/docs/3.3/input_guide.html#input_key.

It gets mapped to Up here:

= do let keystate = keystateglfw == GLFW.KeyState'Pressed

let keystate' = if keystate then Down else Up

GLFW.KeyState'Repeating should be just ignored and mapping should be GLFW.KeyState'Pressed to Down and GLFW.KeyState'Released to UP

Option to turn off character key modifier clever-ness

Holding a modifier key often also changes the character Gloss reports.

Say that I want to perform a certain operation when the L key is pressed, and thus pattern match on EventKey (Char 'l') Down _ _. If I then desire a slight modification in behaviour when the Shift key is pressed, I find that this branch isn't hit at all, since the character is L rather than l.

This behaviour is easy enough to work around, but can be quite annoying, and is fundamentally non-compositional. It would be great if there were an option to always report the same character as when no modifiers are held.

gloss doesn't work on wayland/swaywm *without xwayland

Hello! I've recently started figuring out gloss and was working on a project in xmonad. A couple days ago I switched over to swaywm to check it out, however I got an error ( freeglut (gloss-stuff): failed to open display '' ) whenever I tried to do stack run. Going back to xmonad it runs just fine, same for xfce. Has anyone else encountered this? I'm willing to try another wayland-based de and see if this problem is swaywm-specific or wayland-broad.

running gloss in `ghci`: closing the window with ESC produces "too many hs-exit()s"

I want to use gloss with ghci (either stack repl or cabal repl. The gloss window opens nicely but when I close it, it also closes ghci. In an old but report I saw that the gloss window can be closed with ESC which returns control then to ghci. When I try this I get:

<interactive>: interrupted
<interactive>: warning: too many hs_exit()s

and ghci is closed.

I saw some discussion about running gloss with some flags (??), but could not find a comprehesible and likely up-to-date instruction. What is the correct procedure to run gloss graphics in ghci and how to interact with the windows (especially how to close them without closing ghci ?
Thank you!

I work with ghc 8.10.7 and gloss 1.13.2.1 (lts-18.28

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.