Bu sayfadaki yazılar
Sayfanın metni
Sayfa 147
/** * Name : SetColor * Desc : Overloaded SetColor fonksiyonu. (r,g,b) renklerini * RGB sınıfından tek bir değişkenden alır. * Input : (unsigned char)color * (RGB *)rgbColor */ void SetColor(unsigned char color, RGB *rgbColor) { outportb(0x3c8, color); outportb(0x3c9, rgbColor->getR()); outportb(0x3c9, rgbColor->getG()); outportb(0x3c9, rgbColor->getB()); }
/** * Name : CycleLeft * Desc : Palet renklerini sola kaydırır * Input : (unsigned char)continues */ void CycleLeft(unsigned char continues) { RGB rgbTemp; int i; if(continues == 1) rgbTemp = &GetColor(0); for(i = 0; i <= 254; i++) SetColor(i, &GetColor(i + 1)); if(continues == 1) SetColor(255, &rgbTemp); }
/** * Name : CycleRight * Desc : Palet renklerini sağa kaydırır * Input : (unsigned char)continues */ void CycleRight(unsigned char continues) { RGB rgbTemp; int i; if(continues == 1) rgbTemp = &GetColor(255); for(i = 255; i >= 1; i--) SetColor(i, &GetColor(i - 1)); if(continues == 1) SetColor(0, &rgbTemp); }
/** * Name : Plot * Desc : Parametreden gelen (x,y) koordinatlarına, yine parametreden * gelen rengi basar. * Input : (unsigned int)x * (unsigned char)y * (unsigned char)color */ void Plot(unsigned int x, unsigned char y, unsigned char color) { /******************************** * Formülün Çıkarılışı * ********************************* * (y * 320) + x => * * (y * 256) + (y * 64) + x => * * (y * 2^8) + (y * 2^6) + x => * * (y << 8) + (y << 6) + x *
Klavyeyle gezinmek için ← ve → tuşları.
Sayfa 146
FillCircle(&myPoint1, i, i * 16);
// Bir tuşa basılana kadar bekle getch();
// Renkleri kaydır while(!kbhit()) { CycleLeft(1); delay(50); } getch(); while(!kbhit()) { CycleRight(0); delay(50); }
// 80x25 karakter ekran moduna geç SetScreen(CHAR03); }
/** * Name : SetScreen * Desc : 0x10 interruptini kullanarak ekran modunu değiştirir. * Input : (int)screenMode */ void SetScreen(int screenMode) { union REGS regs; regs.x.ax = screenMode; int86(INT_VIDEO, ®s, ®s); }
/** * Name : GetColor * Desc : Parametreden gelen sıradaki palet rengini okur. * Input : (unsigned char)color * Output: (RGB) */ RGB GetColor(unsigned char color) { RGB rgbColor; outportb(0x3c7, color); rgbColor.setR(inportb(0x3c9)); rgbColor.setG(inportb(0x3c9)); rgbColor.setB(inportb(0x3c9)); return rgbColor; }
/** * Name : SetColor * Desc : Palet renklerini değiştirir. * Input : (unsigned char)color * (unsigned char)r * (unsigned char)g * (unsigned char)b */ void SetColor(unsigned char color, unsigned char r, unsigned char g, unsigned char b) { outportb(0x3c8, color); outportb(0x3c9, r); outportb(0x3c9, g); outportb(0x3c9, b); }