| 1 |
|
| 2 |
#if defined _DEBUG && defined _MSC_VER |
| 3 |
#include <crtdbg.h> |
| 4 |
#endif |
| 5 |
|
| 6 |
#include <stdio.h> |
| 7 |
#include <string.h> |
| 8 |
#include <stdlib.h> |
| 9 |
#include <SDL2/SDL.h> |
| 10 |
#include "tinyfiledialogs/tinyfiledialogs.h" |
| 11 |
#include "config.h" |
| 12 |
#include "palette.h" |
| 13 |
#include "gui.h" |
| 14 |
|
| 15 |
|
| 16 |
#define BUTTON_DELAY 15 |
| 17 |
#define BUTTON_REPEAT_DELAY 2 |
| 18 |
|
| 19 |
static bool rainbowHeldDown, rainbowDownHeldDown, rainbowUpHeldDown, spreadFlag; |
| 20 |
static uint8_t whichSliderHeldDown, spreadFrom; |
| 21 |
static uint16_t oldColorVal; |
| 22 |
static uint32_t buttonCounter, randSeed; |
| 23 |
|
| 24 |
extern const uint32_t arrowDown[42]; |
| 25 |
extern const uint32_t arrowUp[42]; |
| 26 |
extern const uint32_t editText[42880]; |
| 27 |
extern const uint8_t visualsData[31680]; |
| 28 |
extern const uint8_t spectrumData[11000]; |
| 29 |
extern const uint8_t samplerData[42880]; |
| 30 |
extern const uint8_t songNameData[7040]; |
| 31 |
extern const uint8_t patternEditorData[42880]; |
| 32 |
extern const uint8_t diskOpData[31680]; |
| 33 |
extern const uint8_t fontData[5168]; |
| 34 |
|
| 35 |
|
| 36 |
bool topScreenShown = false, bottomScreenShown = false, analyzerShown = false; |
| 37 |
uint8_t currColor = 0, rainbowPos = 0, colorsMax = 48; |
| 38 |
uint16_t *theRightColors = vuColors; |
| 39 |
|
| 40 |
|
| 41 |
static inline uint32_t myRandom(uint32_t limit) |
| 42 |
{ |
| 43 |
randSeed = randSeed * 134775813 + 1; |
| 44 |
return ((int64_t)randSeed * limit) >> 32; |
| 45 |
} |
| 46 |
|
| 47 |
static void blit(const uint8_t *srcPtr, int32_t xPos, int32_t yPos, int32_t w, int32_t h) |
| 48 |
{ |
| 49 |
uint32_t pixel; |
| 50 |
|
| 51 |
uint32_t *dstPtr = &frameBuffer[(yPos * SCREEN_W) + xPos]; |
| 52 |
for (int32_t y = 0; y < h; y++) |
| 53 |
{ |
| 54 |
for (int32_t x = 0; x < w; x++) |
| 55 |
{ |
| 56 |
const uint8_t pal = srcPtr[x]; |
| 57 |
|
| 58 |
if (pal == 8) pixel = 0x373737; |
| 59 |
else if (pal == 9) pixel = 0x666666; |
| 60 |
else if (pal == 10) pixel = 0xCCCCCC; |
| 61 |
else pixel = RGB12_to_RGB24(palette[pal]); |
| 62 |
|
| 63 |
dstPtr[x] = pixel; |
| 64 |
} |
| 65 |
|
| 66 |
srcPtr += w; |
| 67 |
dstPtr += SCREEN_W; |
| 68 |
} |
| 69 |
} |
| 70 |
|
| 71 |
static void blit32(int32_t xPos, int32_t yPos, int32_t w, int32_t h, const uint32_t *srcPtr) |
| 72 |
{ |
| 73 |
uint32_t *dstPtr = &frameBuffer[(yPos * SCREEN_W) + xPos]; |
| 74 |
for (int32_t y = 0; y < h; y++) |
| 75 |
{ |
| 76 |
memcpy(dstPtr, srcPtr, w * sizeof (int32_t)); |
| 77 |
|
| 78 |
srcPtr += w; |
| 79 |
dstPtr += SCREEN_W; |
| 80 |
} |
| 81 |
} |
| 82 |
|
| 83 |
void charOut(int32_t xPos, int32_t yPos, uint32_t color, char chr) |
| 84 |
{ |
| 85 |
const uint8_t *srcPtr = &fontData[(chr * (8 * 5)) + 1]; |
| 86 |
uint32_t *dstPtr = &frameBuffer[(yPos * SCREEN_W) + xPos]; |
| 87 |
|
| 88 |
for (int32_t y = 0; y < 5; y++) |
| 89 |
{ |
| 90 |
for (int32_t x = 0; x < 6; x++) |
| 91 |
{ |
| 92 |
if (srcPtr[x]) |
| 93 |
dstPtr[x] = color; |
| 94 |
} |
| 95 |
|
| 96 |
srcPtr += 8; |
| 97 |
dstPtr += SCREEN_W; |
| 98 |
} |
| 99 |
} |
| 100 |
|
| 101 |
void textOut(int32_t xPos, int32_t yPos, uint32_t color, const char *text) |
| 102 |
{ |
| 103 |
int32_t x = xPos; |
| 104 |
while (*text != '\0') |
| 105 |
{ |
| 106 |
charOut(x, yPos, color, *text++); |
| 107 |
x += 7; |
| 108 |
} |
| 109 |
} |
| 110 |
|
| 111 |
void textOutShadow(int32_t xPos, int32_t yPos, uint32_t fgColor, uint32_t bgColor, const char *text) |
| 112 |
{ |
| 113 |
int32_t x = xPos; |
| 114 |
while (*text != '\0') |
| 115 |
{ |
| 116 |
charOut(x+1, yPos+1, bgColor, *text); |
| 117 |
charOut(x+0, yPos+0, fgColor, *text); |
| 118 |
|
| 119 |
text++; |
| 120 |
x += 7; |
| 121 |
} |
| 122 |
} |
| 123 |
|
| 124 |
void hLine(int32_t x, int32_t y, int32_t w, uint32_t color) |
| 125 |
{ |
| 126 |
#ifdef _DEBUG |
| 127 |
if (x >= SCREEN_W || y >= SCREEN_H || x+w > SCREEN_W) |
| 128 |
__debugbreak(); |
| 129 |
#endif |
| 130 |
|
| 131 |
uint32_t *dstPtr = &frameBuffer[(y * SCREEN_W) + x]; |
| 132 |
for (int32_t i = 0; i < w; i++) |
| 133 |
dstPtr[i] = color; |
| 134 |
} |
| 135 |
|
| 136 |
void vLine(int32_t x, int32_t y, int32_t h, uint32_t color) |
| 137 |
{ |
| 138 |
#ifdef _DEBUG |
| 139 |
if (y >= SCREEN_W || x >= SCREEN_W || y+h > SCREEN_H) |
| 140 |
__debugbreak(); |
| 141 |
#endif |
| 142 |
|
| 143 |
uint32_t *dstPtr = &frameBuffer[(y * SCREEN_W) + x]; |
| 144 |
for (int32_t i = 0; i < h; i++) |
| 145 |
{ |
| 146 |
*dstPtr = color; |
| 147 |
dstPtr += SCREEN_W; |
| 148 |
} |
| 149 |
} |
| 150 |
|
| 151 |
static void drawSpectrumAnalyzer(int32_t xPos, int32_t yPos) |
| 152 |
{ |
| 153 |
randSeed = 8675309; |
| 154 |
|
| 155 |
int32_t drawX = xPos + 129; |
| 156 |
for (int32_t i = 0; i < 23; i++) |
| 157 |
{ |
| 158 |
const int32_t h = myRandom(35+1); |
| 159 |
|
| 160 |
int32_t drawY = 35 - h; |
| 161 |
const uint32_t *srcPtr = &spectrumAnalyzerBMP[h]; |
| 162 |
uint32_t *dstPtr = &frameBuffer[((yPos+drawY+59) * SCREEN_W) + drawX]; |
| 163 |
|
| 164 |
for (int32_t y = 0; y <= h; y++) |
| 165 |
{ |
| 166 |
for (int32_t x = 0; x < 6; x++) |
| 167 |
dstPtr[x] = *srcPtr; |
| 168 |
|
| 169 |
dstPtr += SCREEN_W; |
| 170 |
srcPtr--; |
| 171 |
} |
| 172 |
|
| 173 |
drawX += 8; |
| 174 |
} |
| 175 |
} |
| 176 |
|
| 177 |
static void drawVUMeters(int32_t xPos, int32_t yPos) |
| 178 |
{ |
| 179 |
randSeed = 81549300; |
| 180 |
|
| 181 |
int32_t drawX = xPos + 55; |
| 182 |
for (int32_t i = 0; i < 4; i++) |
| 183 |
{ |
| 184 |
int32_t h = myRandom(48+1); |
| 185 |
|
| 186 |
int32_t drawY = 48 - h; |
| 187 |
const uint32_t *srcPtr = &vuMeterBMP[((48 - 1) * 10) - (drawY * 10)]; |
| 188 |
uint32_t *dstPtr = &frameBuffer[((yPos+drawY+140) * SCREEN_W) + drawX]; |
| 189 |
|
| 190 |
for (int32_t y = 0; y < h; y++) |
| 191 |
{ |
| 192 |
for (int32_t x = 0; x < 10; x++) |
| 193 |
dstPtr[x]= srcPtr[x]; |
| 194 |
|
| 195 |
dstPtr += SCREEN_W; |
| 196 |
srcPtr -= 10; |
| 197 |
} |
| 198 |
|
| 199 |
drawX += 72; |
| 200 |
} |
| 201 |
} |
| 202 |
|
| 203 |
static void drawPatternCursor(int32_t xPos, int32_t yPos) |
| 204 |
{ |
| 205 |
const uint32_t *srcPtr = patternCursorBMP; |
| 206 |
uint32_t *dstPtr = &frameBuffer[((yPos+188) * SCREEN_W) + (xPos+30)]; |
| 207 |
|
| 208 |
for (int32_t y = 0; y < 14; y++) |
| 209 |
{ |
| 210 |
for (int32_t x = 0; x < 11; x++) |
| 211 |
{ |
| 212 |
const uint32_t pixel = srcPtr[x]; |
| 213 |
if (pixel != RGB24_COLORKEY) |
| 214 |
dstPtr[x] = pixel; |
| 215 |
} |
| 216 |
|
| 217 |
srcPtr += 11; |
| 218 |
dstPtr += SCREEN_W; |
| 219 |
} |
| 220 |
} |
| 221 |
|
| 222 |
void drawTracker(void) |
| 223 |
{ |
| 224 |
const int32_t x = TRACKER_X; |
| 225 |
const int32_t y = TRACKER_Y; |
| 226 |
|
| 227 |
if (!topScreenShown) |
| 228 |
blit(visualsData, x, y, 320, 99); |
| 229 |
else |
| 230 |
blit(diskOpData, x, y, 320, 99); |
| 231 |
|
| 232 |
if (!topScreenShown && analyzerShown) |
| 233 |
{ |
| 234 |
blit(spectrumData, x+120, y+44, 200, 55); |
| 235 |
drawSpectrumAnalyzer(x, y); |
| 236 |
} |
| 237 |
|
| 238 |
blit(songNameData, x, y+99, 320, 22); |
| 239 |
|
| 240 |
if (!bottomScreenShown) |
| 241 |
blit(patternEditorData, x, y+121, 320, 134); |
| 242 |
else |
| 243 |
blit(samplerData, x, y+121, 320, 134); |
| 244 |
|
| 245 |
if (!bottomScreenShown) |
| 246 |
{ |
| 247 |
drawVUMeters(x, y); |
| 248 |
drawPatternCursor(x, y); |
| 249 |
} |
| 250 |
} |
| 251 |
|
| 252 |
void handleSlidersHeldDown(void) |
| 253 |
{ |
| 254 |
int8_t value; |
| 255 |
int32_t mx; |
| 256 |
|
| 257 |
if (whichSliderHeldDown == 0) |
| 258 |
return; |
| 259 |
|
| 260 |
if (whichSliderHeldDown <= 3) |
| 261 |
{ |
| 262 |
|
| 263 |
|
| 264 |
mx = mouse.x - (COLORPICKER1_X+26); |
| 265 |
if (mx < 0) |
| 266 |
mx = 0; |
| 267 |
|
| 268 |
value = (int8_t)(mx / 3); |
| 269 |
if (value > 15) |
| 270 |
value = 15; |
| 271 |
|
| 272 |
oldColorVal = palette[currColor]; |
| 273 |
|
| 274 |
palette[currColor] &= ~(15 << (4 * (3 - whichSliderHeldDown))); |
| 275 |
palette[currColor] |= (value << (4 * (3 - whichSliderHeldDown))); |
| 276 |
|
| 277 |
if (palette[currColor] != oldColorVal) |
| 278 |
{ |
| 279 |
configIsSaved = false; |
| 280 |
|
| 281 |
if (currColor == 5) |
| 282 |
updatePatternCursorBMP(); |
| 283 |
|
| 284 |
drawColorPicker1(); |
| 285 |
drawTracker(); |
| 286 |
redrawScreen = true; |
| 287 |
} |
| 288 |
} |
| 289 |
else if (whichSliderHeldDown <= 6) |
| 290 |
{ |
| 291 |
|
| 292 |
|
| 293 |
mx = mouse.x - (COLORPICKER2_X+26); |
| 294 |
if (mx < 0) |
| 295 |
mx = 0; |
| 296 |
|
| 297 |
value = (int8_t)(mx / 3); |
| 298 |
if (value > 15) |
| 299 |
value = 15; |
| 300 |
|
| 301 |
oldColorVal = theRightColors[rainbowPos]; |
| 302 |
|
| 303 |
theRightColors[rainbowPos] &= ~(15 << (4 * (6 - whichSliderHeldDown))); |
| 304 |
theRightColors[rainbowPos] |= (value << (4 * (6 - whichSliderHeldDown))); |
| 305 |
|
| 306 |
if (theRightColors[rainbowPos] != oldColorVal) |
| 307 |
{ |
| 308 |
configIsSaved = false; |
| 309 |
|
| 310 |
if (theRightColors == vuColors) |
| 311 |
updateVuMeterBMP(); |
| 312 |
else |
| 313 |
updateSpectrumAnalyzerBMP(); |
| 314 |
|
| 315 |
drawColorPicker2(); |
| 316 |
drawTracker(); |
| 317 |
redrawScreen = true; |
| 318 |
} |
| 319 |
} |
| 320 |
} |
| 321 |
|
| 322 |
void handleRainbowHeldDown(void) |
| 323 |
{ |
| 324 |
if (!rainbowHeldDown) |
| 325 |
return; |
| 326 |
|
| 327 |
int32_t my = mouse.y - (COLORPICKER2_Y+3); |
| 328 |
|
| 329 |
if (my < 0) my = 0; |
| 330 |
else if (my > 47) my = 47; |
| 331 |
|
| 332 |
if (theRightColors == analyzerColors && my > 35) |
| 333 |
my = 35; |
| 334 |
|
| 335 |
uint8_t oldOffset = rainbowPos; |
| 336 |
|
| 337 |
rainbowPos = (uint8_t)my; |
| 338 |
if (rainbowPos != oldOffset) |
| 339 |
{ |
| 340 |
setUndo2Color(rainbowPos); |
| 341 |
drawColorPicker2(); |
| 342 |
redrawScreen = true; |
| 343 |
} |
| 344 |
} |
| 345 |
|
| 346 |
static void rainbowUp(void) |
| 347 |
{ |
| 348 |
uint16_t tmp = *theRightColors; |
| 349 |
for (int32_t i = 0; i < colorsMax-1; i++) |
| 350 |
theRightColors[i] = theRightColors[i+1]; |
| 351 |
theRightColors[colorsMax-1] = tmp; |
| 352 |
|
| 353 |
if (theRightColors == vuColors) |
| 354 |
updateVuMeterBMP(); |
| 355 |
else |
| 356 |
updateSpectrumAnalyzerBMP(); |
| 357 |
|
| 358 |
drawColorPicker2(); |
| 359 |
drawTracker(); |
| 360 |
redrawScreen = true; |
| 361 |
} |
| 362 |
|
| 363 |
static void rainbowDown(void) |
| 364 |
{ |
| 365 |
uint16_t tmp = theRightColors[colorsMax-1]; |
| 366 |
for (int32_t i = colorsMax-1; i >= 1; i--) |
| 367 |
theRightColors[i] = theRightColors[i-1]; |
| 368 |
theRightColors[0] = tmp; |
| 369 |
|
| 370 |
if (theRightColors == vuColors) |
| 371 |
updateVuMeterBMP(); |
| 372 |
else |
| 373 |
updateSpectrumAnalyzerBMP(); |
| 374 |
|
| 375 |
drawColorPicker2(); |
| 376 |
drawTracker(); |
| 377 |
redrawScreen = true; |
| 378 |
} |
| 379 |
|
| 380 |
static void rainbowSpread(void) |
| 381 |
{ |
| 382 |
spreadFlag = true; |
| 383 |
spreadFrom = rainbowPos; |
| 384 |
} |
| 385 |
|
| 386 |
#ifndef __APPLE__ |
| 387 |
static void colorPicker1(void) |
| 388 |
{ |
| 389 |
const uint16_t color = colorPicker(palette[currColor]); |
| 390 |
if (color != 0xFFFF) |
| 391 |
{ |
| 392 |
palette[currColor] = color & 0xFFF; |
| 393 |
|
| 394 |
if (currColor == 5) |
| 395 |
updatePatternCursorBMP(); |
| 396 |
|
| 397 |
drawColorPicker1(); |
| 398 |
drawTracker(); |
| 399 |
redrawScreen = true; |
| 400 |
configIsSaved = false; |
| 401 |
} |
| 402 |
} |
| 403 |
|
| 404 |
static void colorPicker2(void) |
| 405 |
{ |
| 406 |
const uint16_t color = colorPicker(theRightColors[rainbowPos]); |
| 407 |
if (color != 0xFFFF) |
| 408 |
{ |
| 409 |
theRightColors[rainbowPos] = color & 0xFFF; |
| 410 |
if (theRightColors == vuColors) |
| 411 |
updateVuMeterBMP(); |
| 412 |
else |
| 413 |
updateSpectrumAnalyzerBMP(); |
| 414 |
|
| 415 |
drawColorPicker2(); |
| 416 |
drawTracker(); |
| 417 |
redrawScreen = true; |
| 418 |
configIsSaved = false; |
| 419 |
} |
| 420 |
} |
| 421 |
#endif |
| 422 |
|
| 423 |
static bool handleColorPicker1(int32_t mx, int32_t my) |
| 424 |
{ |
| 425 |
uint8_t newColor; |
| 426 |
|
| 427 |
|
| 428 |
if (mx >= COLORPICKER1_X && mx < COLORPICKER1_X+108 && my >= COLORPICKER1_Y+33 && my < COLORPICKER1_Y+44) |
| 429 |
{ |
| 430 |
if (mx >= COLORPICKER1_X+79) |
| 431 |
{ |
| 432 |
configIsSaved = false; |
| 433 |
setDefaultPalette(); |
| 434 |
updatePatternCursorBMP(); |
| 435 |
drawTracker(); |
| 436 |
drawColorPicker1(); |
| 437 |
redrawScreen = true; |
| 438 |
return true; |
| 439 |
} |
| 440 |
else if (mx >= COLORPICKER1_X+33) |
| 441 |
{ |
| 442 |
configIsSaved = false; |
| 443 |
cancel1Color(); |
| 444 |
updatePatternCursorBMP(); |
| 445 |
drawTracker(); |
| 446 |
drawColorPicker1(); |
| 447 |
redrawScreen = true; |
| 448 |
return true; |
| 449 |
} |
| 450 |
else |
| 451 |
{ |
| 452 |
configIsSaved = false; |
| 453 |
undo1Color(); |
| 454 |
updatePatternCursorBMP(); |
| 455 |
drawTracker(); |
| 456 |
drawColorPicker1(); |
| 457 |
redrawScreen = true; |
| 458 |
return true; |
| 459 |
} |
| 460 |
} |
| 461 |
|
| 462 |
|
| 463 |
if (mx >= COLORPICKER1_X+0 && mx < COLORPICKER1_X+79) |
| 464 |
{ |
| 465 |
if (my >= COLORPICKER1_Y+0 && my < COLORPICKER1_Y+11) |
| 466 |
{ |
| 467 |
whichSliderHeldDown = 1; |
| 468 |
return true; |
| 469 |
} |
| 470 |
else if (my >= COLORPICKER1_Y+11 && my < COLORPICKER1_Y+22) |
| 471 |
{ |
| 472 |
whichSliderHeldDown = 2; |
| 473 |
return true; |
| 474 |
} |
| 475 |
else if (my >= COLORPICKER1_Y+22 && my < COLORPICKER1_Y+33) |
| 476 |
{ |
| 477 |
whichSliderHeldDown = 3; |
| 478 |
return true; |
| 479 |
} |
| 480 |
} |
| 481 |
|
| 482 |
|
| 483 |
if (mx >= COLORPICKER1_X+82 && my >= COLORPICKER1_Y+5 && my < COLORPICKER1_Y+28) |
| 484 |
{ |
| 485 |
if (mx < (COLORPICKER1_X+92)) |
| 486 |
{ |
| 487 |
|
| 488 |
newColor = (uint8_t)((my - (COLORPICKER1_Y+5)) / 6); |
| 489 |
if (currColor != newColor) |
| 490 |
{ |
| 491 |
currColor = newColor; |
| 492 |
setUndo1Color(currColor); |
| 493 |
drawColorPicker1(); |
| 494 |
redrawScreen = true; |
| 495 |
} |
| 496 |
|
| 497 |
return true; |
| 498 |
} |
| 499 |
else if (mx >= COLORPICKER1_X+95 && mx < COLORPICKER1_X+105) |
| 500 |
{ |
| 501 |
|
| 502 |
newColor = (uint8_t)(4 + ((my - (COLORPICKER1_Y+5)) / 6)); |
| 503 |
if (currColor != newColor) |
| 504 |
{ |
| 505 |
currColor = newColor; |
| 506 |
setUndo1Color(currColor); |
| 507 |
drawColorPicker1(); |
| 508 |
redrawScreen = true; |
| 509 |
} |
| 510 |
} |
| 511 |
} |
| 512 |
|
| 513 |
#ifndef __APPLE__ |
| 514 |
|
| 515 |
if (mx >= COLORPICKER1_X && mx < COLORPICKER1_X+33 && my >= COLORPICKER1_Y+44 && my < COLORPICKER1_Y+55) |
| 516 |
colorPicker1(); |
| 517 |
#endif |
| 518 |
|
| 519 |
return false; |
| 520 |
} |
| 521 |
|
| 522 |
void handleRainbowUpDownButtons(void) |
| 523 |
{ |
| 524 |
if (buttonCounter++ < BUTTON_DELAY || buttonCounter % BUTTON_REPEAT_DELAY != 0) |
| 525 |
return; |
| 526 |
|
| 527 |
const int32_t mx = mouse.x; |
| 528 |
const int32_t my = mouse.y; |
| 529 |
|
| 530 |
if (rainbowUpHeldDown) |
| 531 |
{ |
| 532 |
if (my >= COLORPICKER2_Y+12 && my < COLORPICKER2_Y+22 |
| 533 |
&& mx >= COLORPICKER2_X+0 && mx < COLORPICKER2_X+16) |
| 534 |
rainbowUp(); |
| 535 |
} |
| 536 |
else if (rainbowDownHeldDown) |
| 537 |
{ |
| 538 |
if (my >= COLORPICKER2_Y+12 && my < COLORPICKER2_Y+22 |
| 539 |
&& mx >= COLORPICKER2_X+16 && mx < COLORPICKER2_X+32) |
| 540 |
rainbowDown(); |
| 541 |
} |
| 542 |
} |
| 543 |
|
| 544 |
static bool handleColorPicker2(int32_t mx, int32_t my) |
| 545 |
{ |
| 546 |
|
| 547 |
if (mx >= COLORPICKER2_X+79 && mx < COLORPICKER2_X+108 && my >= COLORPICKER2_Y && my < COLORPICKER2_Y+55) |
| 548 |
{ |
| 549 |
rainbowHeldDown = true; |
| 550 |
return true; |
| 551 |
} |
| 552 |
|
| 553 |
spreadFlag = false; |
| 554 |
|
| 555 |
|
| 556 |
if (my >= COLORPICKER2_Y && my < COLORPICKER2_Y+11 && mx >= COLORPICKER2_X && mx < COLORPICKER2_X+79) |
| 557 |
{ |
| 558 |
if (theRightColors == vuColors) |
| 559 |
{ |
| 560 |
theRightColors = analyzerColors; |
| 561 |
colorsMax = 36; |
| 562 |
|
| 563 |
|
| 564 |
if (rainbowPos > 35) |
| 565 |
rainbowPos = 0; |
| 566 |
} |
| 567 |
else |
| 568 |
{ |
| 569 |
theRightColors = vuColors; |
| 570 |
colorsMax = 48; |
| 571 |
} |
| 572 |
|
| 573 |
drawColorPicker2(); |
| 574 |
redrawScreen = true; |
| 575 |
return true; |
| 576 |
} |
| 577 |
|
| 578 |
|
| 579 |
if (mx >= COLORPICKER2_X && mx < COLORPICKER2_X+79 && my >= COLORPICKER2_Y+12 && my < COLORPICKER2_Y+22) |
| 580 |
{ |
| 581 |
if (mx >= COLORPICKER2_X+32) |
| 582 |
{ |
| 583 |
|
| 584 |
|
| 585 |
rainbowSpread(); |
| 586 |
return true; |
| 587 |
} |
| 588 |
else if (mx >= COLORPICKER2_X+16) |
| 589 |
{ |
| 590 |
|
| 591 |
|
| 592 |
configIsSaved = false; |
| 593 |
rainbowDown(); |
| 594 |
rainbowDownHeldDown = true; |
| 595 |
buttonCounter = 0; |
| 596 |
return true; |
| 597 |
} |
| 598 |
else |
| 599 |
{ |
| 600 |
|
| 601 |
|
| 602 |
configIsSaved = false; |
| 603 |
rainbowUp(); |
| 604 |
rainbowUpHeldDown = true; |
| 605 |
buttonCounter = 0; |
| 606 |
return true; |
| 607 |
} |
| 608 |
} |
| 609 |
|
| 610 |
|
| 611 |
if (mx >= COLORPICKER2_X && mx < COLORPICKER2_X+108 && my >= COLORPICKER2_Y+55 && my < COLORPICKER2_Y+66) |
| 612 |
{ |
| 613 |
if (mx >= COLORPICKER2_X+79) |
| 614 |
{ |
| 615 |
|
| 616 |
|
| 617 |
configIsSaved = false; |
| 618 |
|
| 619 |
if (theRightColors == vuColors) |
| 620 |
{ |
| 621 |
setDefaultVuColors(); |
| 622 |
updateVuMeterBMP(); |
| 623 |
} |
| 624 |
else |
| 625 |
{ |
| 626 |
setDefaultAnalyzerColors(); |
| 627 |
updateSpectrumAnalyzerBMP(); |
| 628 |
} |
| 629 |
|
| 630 |
drawTracker(); |
| 631 |
drawColorPicker2(); |
| 632 |
redrawScreen = true; |
| 633 |
return true; |
| 634 |
} |
| 635 |
else if (mx >= COLORPICKER2_X+33) |
| 636 |
{ |
| 637 |
|
| 638 |
|
| 639 |
configIsSaved = false; |
| 640 |
cancel2Color(); |
| 641 |
|
| 642 |
if (theRightColors == vuColors) |
| 643 |
updateVuMeterBMP(); |
| 644 |
else |
| 645 |
updateSpectrumAnalyzerBMP(); |
| 646 |
|
| 647 |
drawTracker(); |
| 648 |
drawColorPicker2(); |
| 649 |
redrawScreen = true; |
| 650 |
return true; |
| 651 |
} |
| 652 |
else |
| 653 |
{ |
| 654 |
|
| 655 |
|
| 656 |
configIsSaved = false; |
| 657 |
undo2Color(); |
| 658 |
|
| 659 |
if (theRightColors == vuColors) |
| 660 |
updateVuMeterBMP(); |
| 661 |
else |
| 662 |
updateSpectrumAnalyzerBMP(); |
| 663 |
|
| 664 |
drawTracker(); |
| 665 |
drawColorPicker2(); |
| 666 |
redrawScreen = true; |
| 667 |
return true; |
| 668 |
} |
| 669 |
} |
| 670 |
|
| 671 |
|
| 672 |
if (mx >= COLORPICKER2_X+0 && mx < COLORPICKER2_X+79) |
| 673 |
{ |
| 674 |
if (my >= COLORPICKER2_Y+13 && my < COLORPICKER2_Y+33) |
| 675 |
{ |
| 676 |
whichSliderHeldDown = 4; |
| 677 |
return true; |
| 678 |
} |
| 679 |
else if (my >= COLORPICKER2_Y+33 && my < COLORPICKER2_Y+44) |
| 680 |
{ |
| 681 |
whichSliderHeldDown = 5; |
| 682 |
return true; |
| 683 |
} |
| 684 |
else if (my >= COLORPICKER2_Y+44 && my < COLORPICKER2_Y+55) |
| 685 |
{ |
| 686 |
whichSliderHeldDown = 6; |
| 687 |
return true; |
| 688 |
} |
| 689 |
} |
| 690 |
|
| 691 |
#ifndef __APPLE__ |
| 692 |
|
| 693 |
if (mx >= COLORPICKER2_X && mx < COLORPICKER2_X+33 && my >= COLORPICKER2_Y+66 && my < COLORPICKER2_Y+77) |
| 694 |
colorPicker2(); |
| 695 |
#endif |
| 696 |
|
| 697 |
return false; |
| 698 |
} |
| 699 |
|
| 700 |
static bool handleTrackerButtons(int32_t mx, int32_t my) |
| 701 |
{ |
| 702 |
if (!topScreenShown) |
| 703 |
{ |
| 704 |
|
| 705 |
|
| 706 |
|
| 707 |
if (mx >= TRACKER_X+182 && my >= TRACKER_Y+33 && mx < TRACKER_X+244 && my < TRACKER_Y+44) |
| 708 |
{ |
| 709 |
topScreenShown = true; |
| 710 |
drawTracker(); |
| 711 |
redrawScreen = true; |
| 712 |
return true; |
| 713 |
} |
| 714 |
|
| 715 |
|
| 716 |
else if (mx >= TRACKER_X+244 && my >= TRACKER_Y+33 && mx < TRACKER_X+306 && my < TRACKER_Y+44) |
| 717 |
{ |
| 718 |
bottomScreenShown ^= 1; |
| 719 |
drawTracker(); |
| 720 |
redrawScreen = true; |
| 721 |
return true; |
| 722 |
} |
| 723 |
|
| 724 |
|
| 725 |
else if (mx >= TRACKER_X+120 && mx < TRACKER_X+320 && my >= TRACKER_Y+44 && my < TRACKER_Y+99) |
| 726 |
{ |
| 727 |
analyzerShown ^= 1; |
| 728 |
drawTracker(); |
| 729 |
redrawScreen = true; |
| 730 |
return true; |
| 731 |
} |
| 732 |
} |
| 733 |
else |
| 734 |
{ |
| 735 |
|
| 736 |
|
| 737 |
|
| 738 |
if (mx >= TRACKER_X+308 && mx < TRACKER_X+320 && my >= TRACKER_Y+40 && my < TRACKER_Y+81) |
| 739 |
{ |
| 740 |
topScreenShown = false; |
| 741 |
drawTracker(); |
| 742 |
redrawScreen = true; |
| 743 |
return true; |
| 744 |
} |
| 745 |
} |
| 746 |
|
| 747 |
if (bottomScreenShown) |
| 748 |
{ |
| 749 |
|
| 750 |
|
| 751 |
|
| 752 |
if (mx >= TRACKER_X+7 && my >= TRACKER_Y+124 && mx < TRACKER_X+26 && my < TRACKER_Y+135) |
| 753 |
{ |
| 754 |
bottomScreenShown ^= 1; |
| 755 |
drawTracker(); |
| 756 |
redrawScreen = true; |
| 757 |
return true; |
| 758 |
} |
| 759 |
} |
| 760 |
|
| 761 |
return false; |
| 762 |
} |
| 763 |
|
| 764 |
static bool handleLoadSaveButtons(int32_t mx, int32_t my) |
| 765 |
{ |
| 766 |
if (mx >= LOADINI_X && mx < LOADINI_X+108 && my >= LOADINI_Y && my < LOADINI_Y+11) |
| 767 |
{ |
| 768 |
|
| 769 |
loadColorsDotIni(); |
| 770 |
return true; |
| 771 |
} |
| 772 |
|
| 773 |
if (mx >= LOADPT_X && mx < LOADPT_X+108 && my >= LOADPT_Y && my < LOADPT_Y+11) |
| 774 |
{ |
| 775 |
|
| 776 |
loadPTDotConfig(); |
| 777 |
return true; |
| 778 |
} |
| 779 |
|
| 780 |
if (mx >= SAVE_X && mx < SAVE_X+108 && my >= SAVE_Y && my < SAVE_Y+11) |
| 781 |
{ |
| 782 |
|
| 783 |
savePalette(true); |
| 784 |
return true; |
| 785 |
} |
| 786 |
|
| 787 |
return false; |
| 788 |
} |
| 789 |
|
| 790 |
static uint16_t colCrossFade(uint16_t col1, uint16_t col2, uint16_t idx, uint16_t len) |
| 791 |
{ |
| 792 |
uint16_t color = 0; |
| 793 |
for (int32_t ch = 0; ch < 3; ch++) |
| 794 |
{ |
| 795 |
const int32_t a = (col1 >> (ch * 4)) & 15; |
| 796 |
const int32_t b = (col2 >> (ch * 4)) & 15; |
| 797 |
|
| 798 |
int32_t nybble = (uint16_t)((((a * ((len * 2) - (idx * 2))) + len) + (b * (idx * 2))) / (len * 2)); |
| 799 |
if (nybble > 15) nybble = 15; |
| 800 |
|
| 801 |
color |= nybble << (ch * 4); |
| 802 |
} |
| 803 |
|
| 804 |
return color; |
| 805 |
} |
| 806 |
|
| 807 |
static void chkSpread(void) |
| 808 |
{ |
| 809 |
spreadFlag = false; |
| 810 |
|
| 811 |
uint8_t x1 = spreadFrom; |
| 812 |
uint8_t x2 = rainbowPos; |
| 813 |
|
| 814 |
|
| 815 |
if (x1 > x2) |
| 816 |
{ |
| 817 |
uint8_t tmp = x1; |
| 818 |
x1 = x2; |
| 819 |
x2 = tmp; |
| 820 |
} |
| 821 |
|
| 822 |
uint16_t length = x2 - x1; |
| 823 |
if (length <= 1) |
| 824 |
return; |
| 825 |
|
| 826 |
for (uint8_t i = 0; i <= length; i++) |
| 827 |
theRightColors[x1+i] = colCrossFade(theRightColors[x1], theRightColors[x2], i, length); |
| 828 |
|
| 829 |
if (theRightColors == vuColors) |
| 830 |
updateVuMeterBMP(); |
| 831 |
else |
| 832 |
updateSpectrumAnalyzerBMP(); |
| 833 |
|
| 834 |
drawTracker(); |
| 835 |
drawColorPicker2(); |
| 836 |
redrawScreen = true; |
| 837 |
configIsSaved = false; |
| 838 |
} |
| 839 |
|
| 840 |
void mouseButtonUpHandler(void) |
| 841 |
{ |
| 842 |
if (spreadFlag && rainbowHeldDown) |
| 843 |
chkSpread(); |
| 844 |
|
| 845 |
buttonCounter = 0; |
| 846 |
whichSliderHeldDown = 0; |
| 847 |
rainbowHeldDown = false; |
| 848 |
rainbowUpHeldDown = false; |
| 849 |
rainbowDownHeldDown = false; |
| 850 |
} |
| 851 |
|
| 852 |
void mouseButtonDownHandler(void) |
| 853 |
{ |
| 854 |
uint32_t mx = mouse.x; |
| 855 |
uint32_t my = mouse.y; |
| 856 |
|
| 857 |
if (handleColorPicker1(mx, my)) |
| 858 |
return; |
| 859 |
|
| 860 |
if (handleColorPicker2(mx, my)) |
| 861 |
return; |
| 862 |
|
| 863 |
if (handleTrackerButtons(mx, my)) |
| 864 |
return; |
| 865 |
|
| 866 |
if (handleLoadSaveButtons(mx, my)) |
| 867 |
return; |
| 868 |
} |
| 869 |
|
| 870 |
void keyDownHandler(SDL_Keycode keyEntry) |
| 871 |
{ |
| 872 |
|
| 873 |
if (keyEntry == SDLK_ESCAPE) |
| 874 |
{ |
| 875 |
topScreenShown = false; |
| 876 |
bottomScreenShown = false; |
| 877 |
drawTracker(); |
| 878 |
redrawScreen = true; |
| 879 |
} |
| 880 |
} |
| 881 |
|
| 882 |
static void fillRect(int32_t xPos, int32_t yPos, int32_t w, int32_t h, uint32_t color) |
| 883 |
{ |
| 884 |
uint32_t *dstPtr = &frameBuffer[(yPos * SCREEN_W) + xPos]; |
| 885 |
for (int32_t y = 0; y < h; y++) |
| 886 |
{ |
| 887 |
for (int32_t x = 0; x < w; x++) |
| 888 |
dstPtr[x] = color; |
| 889 |
|
| 890 |
dstPtr += SCREEN_W; |
| 891 |
} |
| 892 |
} |
| 893 |
|
| 894 |
static void drawBox1(int32_t x, int32_t y, int32_t w, int32_t h) |
| 895 |
{ |
| 896 |
fillRect(x + 1, y + 1, w - 1, h - 1, 0x888888); |
| 897 |
|
| 898 |
hLine(x+0, y+0, w-1, 0xBBBBBB); |
| 899 |
vLine(x+0, y+1, h-2, 0xBBBBBB); |
| 900 |
hLine(x+1, y+h-1, w-1, 0x555555); |
| 901 |
vLine(x+w-1, y+1, h-2, 0x555555); |
| 902 |
|
| 903 |
frameBuffer[((y + (h - 1)) * SCREEN_W) + x] = 0x888888; |
| 904 |
frameBuffer[(y * SCREEN_W) + (x + (w - 1))] = 0x888888; |
| 905 |
} |
| 906 |
|
| 907 |
static void drawBox2(int32_t x, int32_t y, int32_t w, int32_t h) |
| 908 |
{ |
| 909 |
fillRect(x + 1, y + 1, w - 1, h - 1, 0); |
| 910 |
|
| 911 |
hLine(x+0, y+0, w-1, 0x555555); |
| 912 |
vLine(x+0, y+1, h-2, 0x555555); |
| 913 |
hLine(x+1, y+h-1, w-1, 0xBBBBBB); |
| 914 |
vLine(x+w-1, y+1, h-2, 0xBBBBBB); |
| 915 |
|
| 916 |
frameBuffer[((y + (h - 1)) * SCREEN_W) + x] = 0x888888; |
| 917 |
frameBuffer[(y * SCREEN_W) + (x + (w - 1))] = 0x888888; |
| 918 |
} |
| 919 |
|
| 920 |
static void drawSliders1(int32_t x, int32_t y) |
| 921 |
{ |
| 922 |
int32_t xPos; |
| 923 |
|
| 924 |
|
| 925 |
xPos = x + 25 + (R12(palette[currColor]) * 3); |
| 926 |
fillRect(xPos, y + 4, 5, 3, 0xFFDD00); |
| 927 |
|
| 928 |
|
| 929 |
xPos = x + 25 + (G12(palette[currColor]) * 3); |
| 930 |
fillRect(xPos, y + 15, 5, 3, 0xFFDD00); |
| 931 |
|
| 932 |
|
| 933 |
xPos = x + 25 + (B12(palette[currColor]) * 3); |
| 934 |
fillRect(xPos, y + 26, 5, 3, 0xFFDD00); |
| 935 |
} |
| 936 |
|
| 937 |
static void drawSliders2(int32_t x, int32_t y) |
| 938 |
{ |
| 939 |
int32_t xPos; |
| 940 |
|
| 941 |
|
| 942 |
xPos = x + 25 + (R12(theRightColors[rainbowPos]) * 3); |
| 943 |
fillRect(xPos, y + 26, 5, 3, 0xFFDD00); |
| 944 |
|
| 945 |
|
| 946 |
xPos = x + 25 + (G12(theRightColors[rainbowPos]) * 3); |
| 947 |
fillRect(xPos, y + 37, 5, 3, 0xFFDD00); |
| 948 |
|
| 949 |
|
| 950 |
xPos = x + 25 + (B12(theRightColors[rainbowPos]) * 3); |
| 951 |
fillRect(xPos, y + 48, 5, 3, 0xFFDD00); |
| 952 |
} |
| 953 |
|
| 954 |
void drawColorPicker1(void) |
| 955 |
{ |
| 956 |
char strBuf[24]; |
| 957 |
int32_t i, j, xPos, yPos; |
| 958 |
uint32_t color; |
| 959 |
|
| 960 |
const uint32_t x = COLORPICKER1_X; |
| 961 |
const uint32_t y = COLORPICKER1_Y; |
| 962 |
|
| 963 |
|
| 964 |
drawBox1(x, y, 21, 11); textOutShadow(x+7, y+ 3, 0xBBBBBB, 0x555555, "R"); |
| 965 |
drawBox1(x, y+11, 21, 11); textOutShadow(x+7, y+14, 0xBBBBBB, 0x555555, "G"); |
| 966 |
drawBox1(x, y+22, 21, 11); textOutShadow(x+7, y+25, 0xBBBBBB, 0x555555, "B"); |
| 967 |
|
| 968 |
|
| 969 |
drawBox1(x+21, y, 58, 11); drawBox2(x+23, y+2, 54, 7); |
| 970 |
drawBox1(x+21, y+11, 58, 11); drawBox2(x+23, y+2+11, 54, 7); |
| 971 |
drawBox1(x+21, y+22, 58, 11); drawBox2(x+23, y+2+22, 54, 7); |
| 972 |
|
| 973 |
|
| 974 |
for (i = 0; i < 3; i++) |
| 975 |
{ |
| 976 |
xPos = x + 27; |
| 977 |
yPos = y + 2 + (i * 11); |
| 978 |
|
| 979 |
for (j = 0; j < 16; j++) |
| 980 |
{ |
| 981 |
if ((j % 4) == 0 || j == 15) |
| 982 |
frameBuffer[((yPos-1) * SCREEN_W) + xPos] = 0xBBBBBB; |
| 983 |
|
| 984 |
frameBuffer[(yPos * SCREEN_W) + xPos] = 0xBBBBBB; |
| 985 |
|
| 986 |
xPos += 3; |
| 987 |
} |
| 988 |
} |
| 989 |
|
| 990 |
|
| 991 |
drawBox1(x, y+33, 33, 11); textOutShadow(x+3, y+36, 0xBBBBBB, 0x555555, "UNDO"); |
| 992 |
drawBox1(x+33, y+33, 46, 11); textOutShadow(x+35, y+36, 0xBBBBBB, 0x555555, "CANCEL"); |
| 993 |
drawBox1(x+79, y+33, 29, 11); textOutShadow(x+84, y+36, 0xBBBBBB, 0x555555, "DEF"); |
| 994 |
|
| 995 |
#ifndef __APPLE__ |
| 996 |
|
| 997 |
drawBox1(x, y + 44, 33, 11); textOutShadow(x + 3, y + 47, 0xBBBBBB, 0x555555, "PICK"); |
| 998 |
|
| 999 |
|
| 1000 |
drawBox1(x + 33, y + 44, 75, 11); |
| 1001 |
sprintf(strBuf, "%06X", RGB12_to_RGB24(palette[currColor])); |
| 1002 |
textOut(x + 50, y + 47, 0, strBuf); |
| 1003 |
#else |
| 1004 |
|
| 1005 |
drawBox1(x, y + 44, 108, 11); textOutShadow(x + 3, y + 47, 0xBBBBBB, 0x555555, "RGB24:"); |
| 1006 |
sprintf(strBuf, "%06X", RGB12_to_RGB24(palette[currColor])); |
| 1007 |
textOut(x + 55, y + 47, 0, strBuf); |
| 1008 |
#endif |
| 1009 |
|
| 1010 |
|
| 1011 |
drawBox1(x+79, y, 29, 33); drawBox2(x+81, y+3, 12, 27); drawBox2(x+94, y+3, 12, 27); |
| 1012 |
|
| 1013 |
|
| 1014 |
for (i = 0; i < 2; i++) |
| 1015 |
{ |
| 1016 |
xPos = (i == 0) ? (x + 83) : (x + 96); |
| 1017 |
for (j = 0; j < 4; j++) |
| 1018 |
{ |
| 1019 |
yPos = y + 5 + (j * 6); |
| 1020 |
|
| 1021 |
color = (i * 4) + j; |
| 1022 |
if (color == currColor) |
| 1023 |
fillRect(xPos-1, yPos-1, 10, 7, 0xFFDD00); |
| 1024 |
|
| 1025 |
fillRect(xPos, yPos, 8, 5, RGB12_to_RGB24(palette[color])); |
| 1026 |
} |
| 1027 |
} |
| 1028 |
|
| 1029 |
drawSliders1(x, y); |
| 1030 |
} |
| 1031 |
|
| 1032 |
void drawColorPicker2(void) |
| 1033 |
{ |
| 1034 |
char strBuf[24]; |
| 1035 |
int32_t i, j, xPos, yPos; |
| 1036 |
uint32_t color, *dstPtr; |
| 1037 |
|
| 1038 |
const uint32_t x = COLORPICKER2_X; |
| 1039 |
const uint32_t y = COLORPICKER2_Y; |
| 1040 |
|
| 1041 |
|
| 1042 |
drawBox1(x, y, 79, 11); |
| 1043 |
blit32(x+2, y+3, 19, 6, editText); |
| 1044 |
textOut(x+22, y+3, 0, (theRightColors == vuColors) ? "VU-METER" : "ANALYZER"); |
| 1045 |
|
| 1046 |
|
| 1047 |
drawBox1(x+79, y+0, 29, 55); |
| 1048 |
drawBox2(x+81, y+1, 25, 53); |
| 1049 |
|
| 1050 |
|
| 1051 |
drawBox1(x+0, y+11, 16, 11); blit32(x+5, y+13, 6, 7, arrowUp); |
| 1052 |
drawBox1(x+16, y+11, 16, 11); blit32(x+21, y+13, 6, 7, arrowDown); |
| 1053 |
drawBox1(x+32, y+11, 47, 11); textOutShadow(x+35, y+14, 0xBBBBBB, 0x555555, "SPREAD"); |
| 1054 |
|
| 1055 |
|
| 1056 |
drawBox1(x, y+22, 21, 11); textOutShadow(x+7, y+25, 0xBBBBBB, 0x555555, "R"); |
| 1057 |
drawBox1(x, y+33, 21, 11); textOutShadow(x+7, y+36, 0xBBBBBB, 0x555555, "G"); |
| 1058 |
drawBox1(x, y+44, 21, 11); textOutShadow(x+7, y+47, 0xBBBBBB, 0x555555, "B"); |
| 1059 |
|
| 1060 |
|
| 1061 |
drawBox1(x+21, y+22, 58, 11); drawBox2(x+23, y+24, 54, 7); |
| 1062 |
drawBox1(x+21, y+33, 58, 11); drawBox2(x+23, y+35, 54, 7); |
| 1063 |
drawBox1(x+21, y+44, 58, 11); drawBox2(x+23, y+46, 54, 7); |
| 1064 |
|
| 1065 |
|
| 1066 |
for (i = 0; i < 3; i++) |
| 1067 |
{ |
| 1068 |
xPos = x + 27; |
| 1069 |
yPos = y + 24 + (i * 11); |
| 1070 |
|
| 1071 |
for (j = 0; j < 16; j++) |
| 1072 |
{ |
| 1073 |
if ((j % 4) == 0 || j == 15) |
| 1074 |
frameBuffer[((yPos-1) * SCREEN_W) + xPos] = 0xBBBBBB; |
| 1075 |
|
| 1076 |
frameBuffer[(yPos * SCREEN_W) + xPos] = 0xBBBBBB; |
| 1077 |
|
| 1078 |
xPos += 3; |
| 1079 |
} |
| 1080 |
} |
| 1081 |
|
| 1082 |
|
| 1083 |
drawBox1(x, y+55, 33, 11); textOutShadow(x+3, y+58, 0xBBBBBB, 0x555555, "UNDO"); |
| 1084 |
drawBox1(x+33, y+55, 46, 11); textOutShadow(x+35, y+58, 0xBBBBBB, 0x555555, "CANCEL"); |
| 1085 |
drawBox1(x+79, y+55, 29, 11); textOutShadow(x+84, y+58, 0xBBBBBB, 0x555555, "DEF"); |
| 1086 |
|
| 1087 |
|
| 1088 |
for (i = 0; i < 48; i++) |
| 1089 |
{ |
| 1090 |
if (i > 35 && theRightColors == analyzerColors) |
| 1091 |
color = 0; |
| 1092 |
else |
| 1093 |
color = RGB12_to_RGB24(theRightColors[i]); |
| 1094 |
|
| 1095 |
|
| 1096 |
dstPtr = &frameBuffer[((y+3+i) * SCREEN_W) + (x+88)]; |
| 1097 |
for (j = 0; j < 11; j++) |
| 1098 |
dstPtr[j] = color; |
| 1099 |
} |
| 1100 |
|
| 1101 |
|
| 1102 |
hLine(x+ 83, y+3+rainbowPos, 4, 0xFFDD00); |
| 1103 |
hLine(x+100, y+3+rainbowPos, 4, 0xFFDD00); |
| 1104 |
|
| 1105 |
#ifndef __APPLE__ |
| 1106 |
|
| 1107 |
drawBox1(x, y + 66, 33, 11); textOutShadow(x + 3, y + 69, 0xBBBBBB, 0x555555, "PICK"); |
| 1108 |
|
| 1109 |
|
| 1110 |
color = RGB12_to_RGB24(theRightColors[rainbowPos]); |
| 1111 |
drawBox1(x + 33, y + 66, 75, 11); |
| 1112 |
sprintf(strBuf, "%06X", color); |
| 1113 |
textOut(x + 50, y + 69, 0, strBuf); |
| 1114 |
#else |
| 1115 |
|
| 1116 |
color = RGB12_to_RGB24(theRightColors[rainbowPos]); |
| 1117 |
drawBox1(x, y + 66, 108, 11); textOutShadow(x + 3, y + 69, 0xBBBBBB, 0x555555, "RGB24:"); |
| 1118 |
sprintf(strBuf, "%06X", color); |
| 1119 |
textOut(x + 55, y + 69, 0, strBuf); |
| 1120 |
#endif |
| 1121 |
|
| 1122 |
drawSliders2(x, y); |
| 1123 |
} |
| 1124 |
|
| 1125 |
void setupGUI(void) |
| 1126 |
{ |
| 1127 |
fillRect(0, 0, SCREEN_W, SCREEN_H, 0x323E68); |
| 1128 |
|
| 1129 |
setDefaultPalette(); |
| 1130 |
setDefaultVuColors(); |
| 1131 |
setDefaultAnalyzerColors(); |
| 1132 |
updateBMPs(); |
| 1133 |
fillCancel1Colors(); |
| 1134 |
fillCancel2Colors(); |
| 1135 |
setUndo1Color(currColor); |
| 1136 |
setUndo2Color(rainbowPos); |
| 1137 |
|
| 1138 |
|
| 1139 |
textOutShadow(98, 5, 0xF2F2F2, 0x0F121C, "- TRACKER PREVIEW -"); |
| 1140 |
textOutShadow(343, 5, 0xF2F2F2, 0x0F121C, "- PALETTE -"); |
| 1141 |
textOutShadow(332, 93, 0xF2F2F2, 0x0F121C, "- VISUALIZER -"); |
| 1142 |
textOutShadow(325, 244, 0xF2F2F2, 0x0F121C, "<-- Clickable:"); |
| 1143 |
textOutShadow(326, 252, 0xF2F2F2, 0x0F121C, "DISK OP."); |
| 1144 |
textOutShadow(326, 258, 0xF2F2F2, 0x0F121C, "SAMPLER"); |
| 1145 |
textOutShadow(326, 264, 0xF2F2F2, 0x0F121C, "QUADRASCOPE"); |
| 1146 |
|
| 1147 |
drawTracker(); |
| 1148 |
|
| 1149 |
|
| 1150 |
hLine(TRACKER_X-1, TRACKER_Y-1, 320+2, 0xF2F2F2); |
| 1151 |
vLine(TRACKER_X-1, TRACKER_Y+0, 255+0, 0xF2F2F2); |
| 1152 |
hLine(TRACKER_X-1, TRACKER_Y+255, 320+2, 0xF2F2F2); |
| 1153 |
vLine(TRACKER_X+320, TRACKER_Y+0, 255+0, 0xF2F2F2); |
| 1154 |
|
| 1155 |
drawColorPicker1(); |
| 1156 |
drawColorPicker2(); |
| 1157 |
|
| 1158 |
|
| 1159 |
drawBox1(LOADINI_X, LOADINI_Y, 108, 11); textOutShadow(LOADINI_X+2, LOADINI_Y+3, 0xBBBBBB, 0x555555, "LOAD COLORS.INI"); |
| 1160 |
drawBox1(LOADPT_X, LOADPT_Y, 108, 11); textOutShadow(LOADPT_X+5, LOADPT_Y+3, 0xBBBBBB, 0x555555, "LOAD PT.CONFIG"); |
| 1161 |
drawBox1(SAVE_X, SAVE_Y, 108, 11); textOutShadow(SAVE_X+2, SAVE_Y+3, 0xBBBBBB, 0x555555, "SAVE COLORS.INI"); |
| 1162 |
|
| 1163 |
redrawScreen = true; |
| 1164 |
} |