

Definition at line 9 of file EffectZx.h.
Public Member Functions | |
| EffectZx () | |
| Read colors from all four corners. | |
| virtual void | updateEffect () |
| Update sprite height as ZX Spectrum does. | |
| virtual void | blit (SDL_Surface *screen, SDL_Surface *surface, int x, int y) |
| Draw ZX spectrum loading. | |
|
|
Read colors from all four corners.
Definition at line 22 of file EffectZx.cpp. 00023 {
00024 m_zx = ZX1;
00025 m_phase = 0;
00026 m_countHeight = 0;
00027 m_stripeHeight = STRIPE_STANDARD;
00028 }
|
|
||||||||||||||||||||
|
Draw ZX spectrum loading.
Implements ViewEffect. Definition at line 61 of file EffectZx.cpp. 00062 {
00063 SurfaceLock lock1(screen);
00064 SurfaceLock lock2(surface);
00065
00066 Uint32 colorZX1 = PixelTool::convertColor(screen->format,
00067 PixelTool::getColor(surface, 0, 0));
00068 Uint32 colorZX2 = PixelTool::convertColor(screen->format,
00069 PixelTool::getColor(surface, 0, surface->h - 1));
00070 Uint32 colorZX3 = PixelTool::convertColor(screen->format,
00071 PixelTool::getColor(surface, surface->w - 1, 0));
00072 Uint32 colorZX4 = PixelTool::convertColor(screen->format,
00073 PixelTool::getColor(surface, surface->w - 1, surface->h - 1));
00074
00075 PixelIterator pit(surface);
00076 for (int py = 0; py < surface->h; ++py) {
00077 m_countHeight++;
00078 if (m_countHeight > m_stripeHeight) {
00079 m_countHeight -= m_stripeHeight;
00080 switch (m_zx) {
00081 case ZX1:
00082 m_zx = ZX2;
00083 break;
00084 case ZX2:
00085 m_zx = ZX1;
00086 break;
00087 case ZX3:
00088 m_zx = ZX4;
00089 break;
00090 default:
00091 m_zx = ZX3;
00092 break;
00093 }
00094 }
00095
00096 Uint32 usedColor;
00097 switch (m_zx) {
00098 case ZX1:
00099 usedColor = colorZX1;
00100 break;
00101 case ZX2:
00102 usedColor = colorZX2;
00103 break;
00104 case ZX3:
00105 usedColor = colorZX3;
00106 break;
00107 default:
00108 usedColor = colorZX4;
00109 break;
00110 }
00111
00112 for (int px = 0; px < surface->w; ++px) {
00113 if (!pit.isTransparent()) {
00114 PixelTool::putPixel(screen,
00115 x + px, y + py, usedColor);
00116 }
00117 pit.inc();
00118 }
00119 }
00120 }
|
|
|
Update sprite height as ZX Spectrum does.
Reimplemented from ViewEffect. Definition at line 34 of file EffectZx.cpp. 00035 {
00036 m_phase = (m_phase + 1) % 500;
00037 if (m_phase == 1) {
00038 m_zx = ZX1;
00039 m_stripeHeight = STRIPE_STANDARD;
00040 }
00041 else if (2 <= m_phase && m_phase <= 51) {
00042 m_stripeHeight = (m_stripeHeight * 3
00043 * (0.97 + Random::randomReal(0.06))
00044 + STRIPE_STANDARD) / 4.0;
00045 }
00046 else if (m_phase == 52) {
00047 m_zx = ZX3;
00048 m_stripeHeight = STRIPE_NARROW;
00049 }
00050 else {
00051 m_stripeHeight = (m_stripeHeight * 3
00052 * (0.95 + Random::randomReal(0.1))
00053 + STRIPE_NARROW) / 4.0;
00054 }
00055 }
|
1.4.2