summaryrefslogtreecommitdiff
path: root/progs/demo/X11/animation/r_constants.hs
blob: f36e3f28d29123ec882844b9020321333a716c36 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
{-****************************************************************
   MODULE R_CONSTANTS

     This module sets up all the constants used in this functional
   animation package.
     Defined here are the basic units of movement, scale and rotation.
   The screen height and width are set, and the various parts of
   the screen such as the top-middle, lower-left and center are
   all set. Finally the color values used by xcshow, the c-program
   that displays the movies in X, are set.

******************************************************************-}

module R_Constants (fps, unit, hf, qt, scaleunit, rotunit,
                    nullpic, nullseq,
                    sinunit,cosunit,
                    screenwid, screenht, botl, leftm, topl, topm, topr,
                    rightm, botr, botm, center,
		    white,black,red,green,darkblue,lightblue,brown,yellow,
		    colorName, allColors
			) where

import R_Ptypes

  -- units are set. The scaleunit is in 11th, so that the 12 is
  -- actually 12/11'ths
fps :: Int
unit :: Int
hf :: Int
qt :: Int
scaleunit :: Int
fps = 25
unit = 15
hf =  unit `div` 2
qt =  unit `div`4
scaleunit = 12
  --scaleunit is div'ed by 12 later

rotunit :: Float
rotunit  = pi/18
sinunit  = sin rotunit
cosunit  = cos rotunit


nullpic :: Pic
nullpic = []
nullseq :: Movie
nullseq= nullpic : [ nullseq2 | nullseq2 <- nullseq]

  -- Screen Parameters
screenwid :: Int
screenwid = 800
screenht :: Int
screenht  = 800

botl :: Vec
leftm :: Vec
topl :: Vec
topm :: Vec
topr :: Vec
rightm :: Vec
botr :: Vec
botm :: Vec
center :: Vec

leftmb :: Vec
leftmt :: Vec
topml :: Vec
topmr :: Vec
rightmt :: Vec
rightmb :: Vec
botml :: Vec
botmr :: Vec

botl   = ( 0, 0 )
leftm  = ( 0, screenht `div` 2)
topl   = ( 0, screenht )
topm   = ( screenwid `div` 2, screenht )
topr   = ( screenwid, screenht )
rightm = ( screenwid, screenht `div` 2 )
botr   = ( screenwid, 0 )
botm   = ( screenwid `div` 2, 0 )
center = ( screenwid `div` 2, screenht `div` 2 )

leftmb  = ( 0, screenht `div` 4 )
leftmt  = ( 0, (screenht*3) `div` 4 )
topml   = ( screenwid `div` 4, screenht )
topmr   = ( (screenwid*3) `div` 4, screenht )
rightmt = ( screenwid, (screenht*3) `div` 4 )
rightmb = ( screenwid, screenht `div` 4 )
botml   = ( screenwid `div` 4, 0 )
botmr   = ( (screenwid*3) `div` 4, 0 )

  -- Colors values set to names

white :: Color
white = 1
black :: Color
black = 2
red :: Color
red = 4
green :: Color
green = 6
darkblue :: Color
darkblue = 8
lightblue :: Color
lightblue = 10
yellow :: Color
yellow = 12
brown :: Color
brown = 14

colorName :: Color -> String
colorName 1 = "white"
colorName 2 = "black"
colorName 4 = "red"
colorName 6 = "green"
colorName 8 = "blue"
colorName 10 = "lightblue"
colorName 12 = "yellow"
colorName 14 = "brown"

allColors :: [Color]
allColors = [1,2,4,6,8,10,12,14]