uColors.cpp 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. ////////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright 2016 RWS Inc, All Rights Reserved
  4. //
  5. // This program is free software; you can redistribute it and/or modify
  6. // it under the terms of version 2 of the GNU General Public License as published by
  7. // the Free Software Foundation
  8. //
  9. // This program is distributed in the hope that it will be useful,
  10. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. // GNU General Public License for more details.
  13. //
  14. // You should have received a copy of the GNU General Public License along
  15. // with this program; if not, write to the Free Software Foundation, Inc.,
  16. // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  17. //
  18. ////////////////////////////////////////////////////////////////////////////////
  19. //
  20. // mColors.cpp
  21. // Color Palette API for Unix Implementation of RSPiX CYAN.
  22. //
  23. //
  24. // History:
  25. // 06/04/04 RCG Started.
  26. //
  27. ////////////////////////////////////////////////////////////////////////////////
  28. #include "SDL.h"
  29. #include "Blue.h"
  30. #include "../cyan.h"
  31. ////////////////////////////////////////////////////////////////////////////////
  32. // Macros, types, enums, etc.
  33. ////////////////////////////////////////////////////////////////////////////////
  34. ////////////////////////////////////////////////////////////////////////////////
  35. // Data, variables, etc.
  36. ////////////////////////////////////////////////////////////////////////////////
  37. static unsigned char m_aucWin32R1[10] = { 0, 128, 0, 128, 0, 128, 0, 128, 192, 166 };
  38. static unsigned char m_aucWin32G1[10] = { 0, 0, 128, 128, 0, 0, 128, 128, 220, 202 };
  39. static unsigned char m_aucWin32B1[10] = { 0, 0, 0, 0, 128, 128, 128, 128, 192, 240 };
  40. static unsigned char m_aucWin32R2[10] = { 255, 160, 128, 255, 0, 255, 0, 255, 0, 255 };
  41. static unsigned char m_aucWin32G2[10] = { 251, 160, 128, 0, 255, 255, 0, 0, 255, 255 };
  42. static unsigned char m_aucWin32B2[10] = { 240, 164, 128, 0, 0, 0, 255, 255, 255, 255 };
  43. ////////////////////////////////////////////////////////////////////////////////
  44. // Function Prototypes
  45. ////////////////////////////////////////////////////////////////////////////////
  46. ///////////////////////////////////////////////////////////////////////////////
  47. //
  48. // Set the RSPiX palette to the standard Win32 "static colors".
  49. // If requested, the static colors will be locked.
  50. //
  51. // Under Win32, the first 10 and last 10 palette colors are called the "static
  52. // colors" because, historically, they were never changed. Nowadays, they
  53. // are often changed to create different desktop appearances or themes. In
  54. // any case, we often need some basic set of colors when creating cross-
  55. // platform apps, and since Win32 is far more reliant on colors than the Mac
  56. // (which can get by with just 2 colors) we chose the Win32 static colors as
  57. // a common ground. The RGB values for these colors were chosen based on the
  58. // Win95/NT desktop appearance scheme called "Windows Standard". These colors
  59. // are very similar to those used by Windows 3.1 (which we support via Win32s)
  60. // and those used by newer Mac apps that use the "3D" GUI look.
  61. //
  62. ///////////////////////////////////////////////////////////////////////////////
  63. void rspSetWin32StaticColors(
  64. short sLock /*= 0*/) // In: 1 means lock colors, 0 means don't
  65. {
  66. // Make sure display module is alive before we call it
  67. if (1) //( (SDL_WasInit(SDL_INIT_VIDEO)) && (SDL_GetVideoSurface() != NULL) )
  68. {
  69. // Set the colors (note that colors 0 and 255 can't really be changed!)
  70. rspSetPaletteEntries( 0, 10, m_aucWin32R1, m_aucWin32G1, m_aucWin32B1, 1);
  71. rspSetPaletteEntries(246, 10, m_aucWin32R2, m_aucWin32G2, m_aucWin32B2, 1);
  72. // Check if we need to lock the colors
  73. if (sLock)
  74. {
  75. rspLockPaletteEntries( 0, 10);
  76. rspLockPaletteEntries(246, 10);
  77. }
  78. }
  79. else
  80. {
  81. TRACE("rspSetWin32StaticColors(): rspInitBlue() must be called before using this function!\n");
  82. }
  83. }
  84. ////////////////////////////////////////////////////////////////////////////////
  85. // EOF
  86. ////////////////////////////////////////////////////////////////////////////////