From 003c9957946589a996416ee82022d0dfdb73c663 Mon Sep 17 00:00:00 2001 From: Stefan Dresselhaus Date: Tue, 21 Jun 2016 11:04:02 +0200 Subject: [PATCH] added Beispielcode for GUI --- Beispiele/animatedGUI.hs | 13 +++++++++++++ Beispiele/staticGUI.hs | 9 +++++++++ 2 files changed, 22 insertions(+) create mode 100644 Beispiele/animatedGUI.hs create mode 100644 Beispiele/staticGUI.hs diff --git a/Beispiele/animatedGUI.hs b/Beispiele/animatedGUI.hs new file mode 100644 index 0000000..939fe6f --- /dev/null +++ b/Beispiele/animatedGUI.hs @@ -0,0 +1,13 @@ +import Data.Monoid +import Graphics.Gloss +import Graphics.Gloss.Data.Color (makeColor, red) + +main :: IO () +main = animate (InWindow "Spin around" (500,500) (100,100)) + (makeColor 0.9 0.9 0.9 1) + (\time -> + Pictures [ Color red $ ThickCircle 500 1000 + , Rotate (time/60*360) + $ Text + $ show (round time) <> " Seconds" + ]) diff --git a/Beispiele/staticGUI.hs b/Beispiele/staticGUI.hs new file mode 100644 index 0000000..6ab5367 --- /dev/null +++ b/Beispiele/staticGUI.hs @@ -0,0 +1,9 @@ +import Graphics.Gloss +import Graphics.Gloss.Data.Color (makeColor, red) + +main :: IO () +main = display (InWindow "Hello World" (500,500) (100,100)) + (makeColor 0.9 0.9 0.9 1) + (Pictures [ Color red (Circle 1000) + , Text "Hello World Text" + ])