Questions tagged [gloss]

The Haskell gloss package is a simple vector graphics drawing package.

Source

Gloss hides the pain of drawing simple vector graphics behind a nice data type and a few display functions. Gloss uses OpenGL under the hood, but you won't need to worry about any of that. Get something cool on the screen in under 10 minutes.

102 questions
1
vote
1 answer

How to switch the picture in the update function of the package Graphics.Gloss.Interface.IO.Simulate?

Hello i am using Haskell gloss, to create a picture of a binary tree and simulate the insertion of the values. I was able to create a draw function to create the picture of the tree and it works fine. The problem is on creating a simulation. I have…
1
vote
1 answer

How to draw a chess board in gloss haskell?

I am just started haskell gloss. I learnt a little about it functions. I am trying to draw a chess board in haskell. The main problem is that everything is being drawn in the center. If I used the function translate the board is being draw at random…
Maheer Ali
  • 35,834
  • 5
  • 42
  • 73
1
vote
0 answers

Dificoulties installing gloss and other packages with cabal

I am trying to install gloss but, I dont know why ghci doesn't find the modules. When I do cabal install gloss it says: Up to date Warning: You asked to install executables, but there are no executables in target: gloss. Perhaps you want to use…
Pablo
  • 49
  • 1
  • 5
1
vote
2 answers

Couldn't match type ‘IO’ with ‘[]’

I wrote a function to generate two random numbers, which I then pass to a different function to use them there. The code for this is: randomIntInRange :: (Int, Int, Int, Int) -> Board randomIntInRange (min,max,min2,max2) = do r <- randomRIO (min,…
Thijs van der Heijden
  • 1,147
  • 1
  • 10
  • 25
1
vote
1 answer

Is there a way to merge two sets of pictures into one?

I am trying to display a grid of lines with a set of cells that fill the squares in said lines. I have already tried concatenating them like simple lists. This is the grid of lines. It is displayed correctly on its own. grid = translate…
grimbar
  • 35
  • 4
1
vote
1 answer

Haskell Gloss and STM concurrency integration

I want to update a Haskell Gloss GUI from multiple threads (4 threads). I am looking at an application where an event on the Haskell Gloss GUI triggers a series of steps that end up creating threads each of which can and should change the GUI if…
Gakuo
  • 845
  • 6
  • 26
1
vote
2 answers

IO (Maybe Picture) -> Picture

I'm creating a game with Gloss. I have this function : block :: IO (Maybe Picture) block = loadJuicyPNG "block.png" How do I take this IO (Maybe Picture) and turn it into a Picture?
1
vote
1 answer

haskell random instance of own datatype

I am working on an Asteroid game made in Haskell with Graphics.gloss. Now I have defined a datatype for the asteroids like this: data Asteroid = Asteroid { asteroidPos:: Point, asteroidVel :: Vector, …
1
vote
1 answer

Gloss function `animate` doesnt seem to be doing anything

I am tying to create a simple animation using haskell gloss. I want that at the first 4 seconds, every rectangle will change its color to a darker one. The problem is that after a relatively long time of linking, nothing really happens - All…
Alex Goft
  • 1,114
  • 1
  • 11
  • 23
1
vote
0 answers

'Decodable' is ambiguous for type lookup in this context

I am using Gloss for JSON decoding with Xcode9 beta 1 Swift 4. I am facing following issue: Xcode 9 beta screenshot It was working like charm in Xcode8.3.3 with Swift 3 but since I have upgraded to latest Xcode9, it has stopped working. I am…
1
vote
2 answers

Draw squares for a game board in haskell

I would like to be able to draw something like a chess board using haskell and gloss. In any other language I could do something like for( i=0; i < 10; i++){ for( j=0; j < 10; j++){ drawSquare(radius, i, j) } } and that would be it,…
lesolorzanov
  • 3,536
  • 8
  • 35
  • 53
1
vote
1 answer

Haskell gloss loading .bmp

-- | Main function main :: IO () main = do wall <- loadBMP "wall.bmp" -- loads wall image play initialState drawState reactEvent reactTime -- | Function that creates the game play :: State -> (State -> Picture) -> (Event ->…
Dost
  • 33
  • 7
1
vote
1 answer

Haskell Gloss: random starfield not random?

Using Haskell’s Gloss library, I’m trying to simulate a starfield. The visual aspect (drawing ‘stars’ with various speeds and sizes to the screen) is working. However, for some reason the stars aren’t being randomly distributed, resulting in a…
Felix
  • 147
  • 2
  • 10
1
vote
1 answer

Haskell Gloss: time variable stays constant

I'm trying to rotate a Picture in Haskell, using the current time as a value for a rotate function. I've got the following main function: main :: IO () main = do args <- getArgs time <- round <$> getPOSIXTime let initial' =…
Felix
  • 147
  • 2
  • 10
1
vote
0 answers

Haskell: Failed to load interface for 'Graphics.Gloss'

Haskell Community. I am a newbie in Haskell, can only implement simple Haskell functions. I tried out one Haskell game program that was open source. While running it, GHC gave the following errors: HexDame.hs:1:1: error: Failed to load…
Arghya Dutta
  • 105
  • 1
  • 8