setTileAndTileSize.tcl
9.52 KB
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
#------------------ Set Tile --------------------------------------------------
set numTiles 8
set setTileOptions { .setTileTileNoL .setTileFormatL .setTileTexelSizeL .setTileLineL .setTileAddrsL .setTileWrapMirsL .setTileClampsL .setTileMasksL .setTileShiftsL .setTileWrapMirtL .setTileClamptL .setTileMasktL .setTileShifttL .setTilePalttL .setTileSizeSlL .setTileSizeShL .setTileSizeTlL .setTileSizeThL}
set setTileEntries {.setTileTileNo .setTileFormatMB .setTileTexelSizeMB .setTileLineE .setTileAddrsE .setTileWrapMirsMB .setTileClampsCB .setTileMasksE .setTileShiftsE .setTileWrapMirtMB .setTileClamptCB .setTileMasktE .setTileShifttE .setTilePalttE .setTileSizeSlE .setTileSizeShE .setTileSizeTlE .setTileSizeThE }
for {set i 0} {$i < [llength $setTileOptions]} {incr i 1} {
frame .setTileFrame$i
}
frame .setTileFrame$i
label .setTileL -text "setTile" -relief groove
label .setTileTileNoL -text "tile" -width 10 -relief groove
for {set tile 0} {$tile < $numTiles} {incr tile 1} {
label .setTileTileNo$tile -text $tile -width 4 -relief groove
}
label .setTileFormatL -text "texFmt" -width 10 -relief raised -bg LightGray
for {set tile 0} {$tile < $numTiles} {incr tile 1} {
menubutton .setTileFormatMB$tile -textvariable LsetTileFormat$tile -width 4 -relief raised \
-menu .setTileFormatMB$tile.menu -bg LightGray -activebackground LightGray
menu .setTileFormatMB$tile.menu
.setTileFormatMB$tile.menu add radiobutton -label RGBA -command CsetTileFormat -variable setTileFormat$tile -value 0
.setTileFormatMB$tile.menu add radiobutton -label YUV -command CsetTileFormat -variable setTileFormat$tile -value 1
.setTileFormatMB$tile.menu add radiobutton -label CI -command CsetTileFormat -variable setTileFormat$tile -value 2
.setTileFormatMB$tile.menu add radiobutton -label IA -command CsetTileFormat -variable setTileFormat$tile -value 3
.setTileFormatMB$tile.menu add radiobutton -label I -command CsetTileFormat -variable setTileFormat$tile -value 4
#set setTileFormat$tile 0
#set LsetTileFormat$tile rgba
}
proc CsetTileFormat {} {
global numTiles
for {set tile 0} {$tile < $numTiles} {incr tile 1} {
global setTileFormat$tile
global LsetTileFormat$tile
}
for {set tile 0} {$tile < $numTiles} {incr tile 1} {
set first setTileFormat
set next $tile
upvar #0 $first$next x
switch $x {
0 {set LsetTileFormat$tile rgba}
1 {set LsetTileFormat$tile yuv}
2 {set LsetTileFormat$tile ci}
3 {set LsetTileFormat$tile ia}
4 {set LsetTileFormat$tile i}
}
}
}
label .setTileTexelSizeL -text "texSiz" -width 10 -relief raised -bg LightGray
for {set tile 0} {$tile < $numTiles } {incr tile 1} {
menubutton .setTileTexelSizeMB$tile -textvariable LsetTileTexelSize$tile -width 4 -relief raised -menu \
.setTileTexelSizeMB$tile.menu -bg LightGray -activebackground LightGray
menu .setTileTexelSizeMB$tile.menu
.setTileTexelSizeMB$tile.menu add radiobutton -command CsetTileTexelSize -label 4 -variable setTileTexelSize$tile -value 0
.setTileTexelSizeMB$tile.menu add radiobutton -command CsetTileTexelSize -label 8 -variable setTileTexelSize$tile -value 1
.setTileTexelSizeMB$tile.menu add radiobutton -command CsetTileTexelSize -label 16 -variable setTileTexelSize$tile -value 2
.setTileTexelSizeMB$tile.menu add radiobutton -command CsetTileTexelSize -label 32 -variable setTileTexelSize$tile -value 3
#set setTileTexelSize$tile 2
#set LsetTileTexelSize$tile 16
}
proc CsetTileTexelSize {} {
global numTiles
for {set tile 0} {$tile < $numTiles} {incr tile 1} {
global setTileTexelSize$tile
global LsetTileTexelSize$tile
}
for {set tile 0} {$tile < $numTiles} {incr tile 1} {
set first setTileTexelSize
set next $tile
upvar #0 $first$next x
switch $x {
0 {set LsetTileTexelSize$tile 4}
1 {set LsetTileTexelSize$tile 8}
2 {set LsetTileTexelSize$tile 16}
3 {set LsetTileTexelSize$tile 32}
}
}
}
label .setTileLineL -width 10 -text "lineSiz" -relief groove
for {set tile 0} {$tile < $numTiles} {incr tile 1} {
entry .setTileLineE$tile -width 4 -relief sunken -bd 3 -textvariable setTileLine$tile
#set setTileLine$tile 32
}
label .setTileAddrsL -width 10 -text "tmemAddr" -relief groove
for {set tile 0} {$tile < $numTiles} {incr tile 1} {
entry .setTileAddrsE$tile -width 4 -relief sunken -bd 3 -text setTileAddrs$tile
#set setTileAddrs$tile 256
}
label .setTileWrapMirsL -width 10 -text "wrapMirrS" -relief raised -bg LightGray
for {set tile 0} {$tile < $numTiles} {incr tile 1} {
menubutton .setTileWrapMirsMB$tile -width 4 -textvariable LsetTileWrapMirs$tile -relief raised -menu \
.setTileWrapMirsMB$tile.menu -bg LightGray -activebackground LightGray
menu .setTileWrapMirsMB$tile.menu
.setTileWrapMirsMB$tile.menu add radiobutton -command CsetTileWrapMirs -label WrapS -variable setTileWrapMirs$tile -value 0
.setTileWrapMirsMB$tile.menu add radiobutton -command CsetTileWrapMirs -label MirrorS -variable setTileWrapMirs$tile -value 1
#set LsetTileWrapMirs$tile wrS
#set setTileWrapMirs$tile 0
}
proc CsetTileWrapMirs {} {
global numTiles
for {set tile 0} {$tile < $numTiles} {incr tile 1} {
global setTileWrapMirs$tile
global LsetTileWrapMirs$tile
}
for {set tile 0} {$tile < $numTiles} {incr tile 1} {
set first setTileWrapMirs
set next $tile
upvar #0 $first$next x
switch $x {
0 {set LsetTileWrapMirs$tile wrS}
1 {set LsetTileWrapMirs$tile miS}
}
}
}
label .setTileClampsL -width 10 -text "clampS" -relief raised -bg LightGray
for {set tile 0} {$tile < $numTiles} {incr tile 1} {
checkbutton .setTileClampsCB$tile -width 1 -padx 2p -variable setTileClamps$tile
# set setTileClamps$tile 1
}
label .setTileMasksL -width 10 -text "maskS" -relief groove
for {set tile 0} {$tile < $numTiles} {incr tile 1} {
entry .setTileMasksE$tile -width 4 -relief sunken -bd 3 -textvariable setTileMaskS$tile
#set setTileMaskS$tile 5
}
label .setTileShiftsL -width 10 -text "shiftS" -relief groove
for {set tile 0} {$tile < $numTiles} {incr tile 1} {
entry .setTileShiftsE$tile -width 4 -relief sunken -bd 3 -textvariable setTileShiftS$tile
#set setTileShiftS$tile 5
}
label .setTileWrapMirtL -width 10 -text "wrapMirrT" -relief raised -bg LightGray
for {set tile 0} {$tile < $numTiles} {incr tile 1} {
menubutton .setTileWrapMirtMB$tile -width 4 -textvariable LsetTileWrapMirt$tile -relief raised -menu \
.setTileWrapMirtMB$tile.menu -bg LightGray -activebackground LightGray
menu .setTileWrapMirtMB$tile.menu
.setTileWrapMirtMB$tile.menu add radiobutton -label WrapT -command CsetTileWrapMirt -variable setTileWrapMirt$tile -value 0
.setTileWrapMirtMB$tile.menu add radiobutton -label MirrorT -command CsetTileWrapMirt -variable setTileWrapMirt$tile -value 1
#set LsetTileWrapMirt$tile wrT
#set setTileWrapMirt$tile 0
}
proc CsetTileWrapMirt {} {
global numTiles
for {set tile 0} {$tile < $numTiles} {incr tile 1} {
global setTileWrapMirt$tile
global LsetTileWrapMirt$tile
}
for {set tile 0} {$tile < $numTiles} {incr tile 1} {
set first setTileWrapMirt
set next $tile
upvar #0 $first$next x
switch $x {
0 {set LsetTileWrapMirt$tile wrT}
1 {set LsetTileWrapMirt$tile miT}
}
}
}
label .setTileClamptL -width 10 -text "clampT" -relief raised -bg LightGray
for {set tile 0} {$tile < $numTiles} {incr tile 1} {
checkbutton .setTileClamptCB$tile -width 1 -padx 2p -variable setTileClampt$tile
#set setTileClampt$tile 1
}
label .setTileMasktL -width 10 -text "maskT" -relief groove
for {set tile 0} {$tile < $numTiles} {incr tile 1} {
entry .setTileMasktE$tile -width 4 -relief sunken -bd 3 -textvariable setTileMaskT$tile
#set setTileMaskT$tile 4
}
label .setTileShifttL -width 10 -text "shiftT" -relief groove
for {set tile 0} {$tile < $numTiles} {incr tile 1} {
entry .setTileShifttE$tile -width 4 -relief sunken -bd 3 -textvariable setTileShiftT$tile
#set setTileShiftT$tile 5
}
label .setTilePalttL -width 10 -text "palette" -relief groove
for {set tile 0} {$tile < $numTiles} {incr tile 1} {
entry .setTilePalttE$tile -width 4 -relief sunken -bd 3 -textvariable setTilePalette$tile
#set setTilePalette$tile 0
}
############################### Set Tile Size portion ####################################
label .setTileSizeL -text "setTileSize" -relief groove
label .setTileSizeTileL -width 10 -text "tile" -relief groove
for {set tile 0} {$tile < $numTiles} {incr tile 1} {
label .setTileSizeTileL$tile -width 4 -relief groove -text $tile
}
# Note: The tileSize parameters are multiplied by 4 before being passed
# to the 'c' code to account for 2 fractional bits
label .setTileSizeSlL -width 10 -text "sLow" -relief groove
for {set tile 0} {$tile < $numTiles} {incr tile 1} {
entry .setTileSizeSlE$tile -width 4 -bd 3 -relief sunken -textvariable setTileSizeSlFloat$tile
}
label .setTileSizeTlL -width 10 -text "tLow" -relief groove
for {set tile 0} {$tile < $numTiles} {incr tile 1} {
entry .setTileSizeTlE$tile -width 4 -bd 3 -relief sunken -textvariable setTileSizeTlFloat$tile
#set setTileSizeTl$tile 0
}
label .setTileSizeShL -width 10 -text "sHi" -relief groove
for {set tile 0} {$tile < $numTiles} {incr tile 1} {
entry .setTileSizeShE$tile -width 4 -bd 3 -relief sunken -textvariable setTileSizeShFloat$tile
#set setTileSizeSh$tile 0
}
label .setTileSizeThL -width 10 -text "tHi" -relief groove
for {set tile 0} {$tile < $numTiles} {incr tile 1} {
entry .setTileSizeThE$tile -width 4 -bd 3 -relief sunken -textvariable setTileSizeThFloat$tile
#set setTileSizeTh$tile 0
}
###########################################################################################
button .setTileDoneB -command CsetTileAndTileSize -text "done"