Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6536477
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T10:29:54+00:00 2026-05-25T10:29:54+00:00

I want to use Haskell’s SDL-binding for drawing simple objects (triangle, circles and the

  • 0

I want to use Haskell’s SDL-binding for drawing simple objects (triangle, circles and the like). There is a function for drawing rectangles in Graphics.UI.SDL.Video that works ok. But I can’t get the functions I found for drawing other primitives (in Graphics.UI.SDL.Primitives) to work. The following code only draws a rectangle. Any ideas what I missed?

module Main where

import Graphics.UI.SDL as SDL
import Graphics.UI.SDL.Color
import Graphics.UI.SDL.Primitives

main = do
    SDL.init [SDL.InitVideo]
    screen <- SDL.setVideoMode 500 500 32 [SDL.HWSurface]

    SDL.fillRect screen Nothing (SDL.Pixel 0x0000FF) 

    fillRect screen (Just (SDL.Rect 10 10 30 30)) (SDL.Pixel 0x00FF0000)
    filledCircle screen 40 40 50 (SDL.Pixel 0x00FF0000)

    SDL.flip screen

    delay 2000

    SDL.quit
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T10:29:55+00:00Added an answer on May 25, 2026 at 10:29 am

    The pixel color you give filledCircle and fillRect has its alpha component set to zero; try SDL.Pixel 0x00FF00FF instead. filledCircle seems to respect the color’s alpha component whereas fillRect apparently does not.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to use a Haskell function with the following type :: string ->
I read this: http://hackage.haskell.org/trac/ghc/wiki/ViewPatterns I like the idea, want to use the extension. I
I want use Haskell higher order function Foldr to calculate the length of a
I want to use the Publish.GacRemove function to remove an assembly from GAC. However,
I want to call haskell functions out of C++ and did use the tutorial
I've got a name clash between two different Haskell modules that want to use
I am teaching myself Haskell. I want to write a function that recursively finds
I want to use some Haskell libraries (e.g. Darcs, Pandoc) from Python, but it
I have this function in Haskell (I am using the Haskell-SDL library): pixel ::
Simple question: Is there a linux-style terminal widget for GTK? Preferably for Haskell, too,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.