Example #1
0
void LCD_5110_SPI::text(uint8_t x, uint8_t y, String s) {
    uint8_t i;
    uint8_t j;
    
    if (_font==0) {
        setXY(6*x, y);
        for (j=0; j<s.length(); j++) {
            for (i=0; i<5; i++) write(_dataLCD, Terminal6x8[s.charAt(j)-' '][i]);
            write(_dataLCD, 0x00);
        }
    }
    else if (_font==1) {
        setXY(6*x, y);
        for (j=0; j<s.length(); j++) {
            for (i=0; i<11; i++) write(_dataLCD, Terminal11x16[s.charAt(j)-' '][2*i]);
            write(_dataLCD, 0x00);
        }
        
        setXY(6*x, y+1);
        for (j=0; j<s.length(); j++) {
            for (i=0; i<11; i++) write(_dataLCD, Terminal11x16[s.charAt(j)-' '][2*i+1]);
            write(_dataLCD, 0x00);
        }
    }
}
Example #2
0
File: UTFT.cpp Project: joyqi/UTFT
void UTFT::clrXY()
{
	if (orient==PORTRAIT)
		setXY(0,0,disp_x_size,disp_y_size);
	else
		setXY(0,0,disp_y_size,disp_x_size);
}
Example #3
0
void newFont(char character, int x, int y){
	char index=0;
	int offset=0;
	int length=0;
	setXY(x, y-1);
	offset = codersCrux_22ptDescriptors[character-0x2c][1];
	length = codersCrux_22ptDescriptors[character-0x2c][0] * 2;
	
	for (index = 1 ; index < length ; index += 2)
		    writeLCD(1, codersCrux_22ptBitmaps[offset+index]);
	
	
	setXY(x, y);
	for (index = 0 ; index < length ; index += 2)
		   writeLCD(1, codersCrux_22ptBitmaps[offset+index]);
	/*
	int index;
	setXY(x, y-1);
	for (index = 1 ; index < 29 ; index += 2)
		    writeLCD(1, codersCrux_22pt[character - 0x2b][index]);
		    //0x20 is the ASCII character for Space (' '). The font table starts with this character
	setXY(x, y);
	for (index = 0 ; index < 30 ; index += 2)
		   writeLCD(1, codersCrux_22pt[character - 0x2b][index]);
	//writeLCD(1, 0x00); //Blank vertical line padding*/
}
Example #4
0
void ILI9325i2c_16::printChar(byte c, int x, int y)
{
  byte i, ch;
  word j;
  word temp;

  clearBit(CS);

  if (orient == PORTRAIT)
  {
    setXY(x, y, x + cfont.x_size - 1, y + cfont.y_size - 1);

    temp = ((c - cfont.offset) * ((cfont.x_size / 8) * cfont.y_size)) + 4;

    for (j = 0; j < ((cfont.x_size / 8)*cfont.y_size); j++)
    {
      ch = pgm_read_byte(&cfont.font[temp]);
      for (i = 0; i < 8; i++)
      {
        if ((ch & (1 << (7 - i))) != 0)
        {
          setPixel(fcolorr, fcolorg, fcolorb);
        }
        else
        {
          setPixel(bcolorr, bcolorg, bcolorb);
        }
      }
      temp++;
    }
  }
  else
  {
    temp = ((c - cfont.offset) * ((cfont.x_size / 8) * cfont.y_size)) + 4;

    for (j = 0; j < ((cfont.x_size / 8)*cfont.y_size); j += (cfont.x_size / 8))
    {
      setXY(x, y + (j / (cfont.x_size / 8)), x + cfont.x_size - 1, y + (j / (cfont.x_size / 8)));
      for (int zz = (cfont.x_size / 8) - 1; zz >= 0; zz--)
      {
        ch = pgm_read_byte(&cfont.font[temp + zz]);
        for (i = 0; i < 8; i++)
        {
          if ((ch & (1 << i)) != 0)
          {
            setPixel(fcolorr, fcolorg, fcolorb);
          }
          else
          {
            setPixel(bcolorr, bcolorg, bcolorb);
          }
        }
      }
      temp += (cfont.x_size / 8);
    }
  }
  setBit(CS);
  clrXY();
}
Example #5
0
void FontInfo::clear()
{
    if (tateyoko_mode == YOKO_MODE)
        setXY(0, 0);
    else
        setXY(num_xy[0]-1, 0);
    line_offset_xy[0] = line_offset_xy[1] = 0;
}
Example #6
0
void Fontinfo::clear()
{
    if (tateyoko_mode == YOKO_MODE)
        setXY(0, 0);
    else
        setXY(num_xy[0]-1, 0);
    line_offset_xy[0] = line_offset_xy[1] = 0;
    setRubyOnFlag(rubyon_flag);
}
Example #7
0
void scrollScreen()
{
	memcpy((unsigned int*)0xB8000, (unsigned int*)0xB80A0,
		SCREEN_WIDTH * (SCREEN_HEIGHT - 1) * 2);
	setXY(0, SCREEN_HEIGHT - 1);
	int i = 0;
	for(; i < SCREEN_WIDTH; i++)
	{
		putch(' ');
	}
	setXY(0, SCREEN_HEIGHT - 1);
}
void fillScr(char r, char g, char b){
	long i;
	
	fastWriteLow(LCD_CS); 
	if (orient==PORTRAIT)
		setXY(0,0,239,319);
	else
		setXY(0,0,319,239);
	for (i=0; i<76800; i++)
	{
		setPixel (r, g, b);
	}
	fastWriteHigh(LCD_CS); 
}
void clrScr(){
	unsigned long i;
	
	fastWriteLow(LCD_CS);
	if (orient==PORTRAIT)
		setXY(0,0,239,319);
	else
		setXY(0,0,319,239);
	for (i=0; i<76800; i++)
	{
		setPixel(0,0,0);
	}
	fastWriteHigh(LCD_CS); 
}
Example #10
0
void promptSDcard(struct Env* p, alt_up_sd_card_dev* device_reference) {
	/*
	 * Loading Screen if SD card is not presented
	 */

	int frame = 25;
	struct animation* b = initAnimation((int*)pacman01, 1);
	addImage(b, initAnimation((int*)pacman02, 0));
	addImage(b, initAnimation((int*)pacman03, 0));
	addImage(b, initAnimation((int*)pacman04, 0));
	struct Object *face;
	face= initObject(80, 120, 10, b, NULL);
	addToEnv(p, face);

	alt_alarm_start (&alarm,alt_ticks_per_second(),my_alarm_callback,(void*)p);


	while(!loadSDCard(device_reference)) {
		displayString("Please insert the SD card to start", frame, 30);
		frame++;
		setXY(face, face->x+4, face->y);
		if(face->x >245) face->x = 0;
		if(frame > 61) frame = 0;

		usleep(300000);
	}alt_up_char_buffer_clear(char_buffer);
	killAnimation(b);
	removeFromEnv(p, face);
	alt_alarm_stop(&alarm);
	alt_up_pixel_buffer_dma_clear_screen(pixel_buffer, 0);
}
Example #11
0
void XImlib2Caption::moveWindow(int xC, int yC)
{
    XDesktopContainer * xContainer =
        dynamic_cast<XDesktopContainer *>(AbstractImage::container);
    setXY(xC, yC);
    XMoveWindow( xContainer->getDisplay(), window, xC, yC );
}
Example #12
0
//------------------------------------------------------------
//------------------------------------------------------------
void Sprite::hide()
{
	if(0xFF != m_nSpriteObj)
	{
		setXY(HIDDEN_SPRITE_X, HIDDEN_SPRITE_Y);
	}
}
Example #13
0
void ILI9341::drawHorizontalLine(uint16_t poX, uint16_t poY, uint16_t length,
                        uint16_t color)
{
  unsigned int i;
  if(poX <0)
    poX = 0;
  if(poX>239)
    poX = 239;
 
  if(poY <0)
    poY = 0;
  if(poY>319)
    poY = 319;
 
  setXY(poX,poY);
  //tft.setOrientation(0);
  
  if(length+poX>MAX_X)
  {
    length=MAX_X-poX;
  }
  for(i=0;i<length;i++)
  {
    sendData(color);
  }
}
Example #14
0
SplashScreen::SplashScreen(Application* application) : Sprite(application)
{
	Dib dib1 = logo2dib(application, logo1, sizeof(logo1), 320, 44);
	Dib dib2 = logo2dib(application, logo2, sizeof(logo2), 320, 96);

	TextureParameters parameters;
	data1_ = application_->getTextureManager()->createTextureFromDib(dib1, parameters);
	data2_ = application_->getTextureManager()->createTextureFromDib(dib2, parameters);
	
	graphicsBase1_ = createGraphicsBase(data1_, 0, 0);
	graphicsBase2_ = createGraphicsBase(data2_, 0, 30);

	startTime_ = iclock();

	Orientation orientation = application->orientation();
	float width = application->getHardwareWidth();
	float height = application->getHardwareHeight();
	if (orientation == eLandscapeLeft || orientation == eLandscapeRight)
		std::swap(width, height);	
	float dx = (width - 320) / 2;
	float dy = (height - 140) / 2; 

	float sx = application->getLogicalScaleX();
	float sy = application->getLogicalScaleY();
	float tx = application->getLogicalTranslateX();
	float ty = application->getLogicalTranslateY();
	setScaleXY(1/sx, 1/sy);
	setXY((-tx + dx) / sx, (-ty + dy) / sy);
}
Example #15
0
	void Rect<T>::set(const T &x,
										const T &y,
										const T &w,
										const T &h) {
	setXY(x, y);
	setWH(w, h);
}
Example #16
0
void LCDClear(void){
	int index;
	for (index = 0 ; index < (LCD_X * LCD_Y / 8) ; index++)
	    writeLCD(1, 0x00);

	  setXY(0, 0); //After we clear the display, return to the home position
}
Example #17
0
int HoaMap::Source::setPolarCoordinates(float _newRadius, float _newAzimuth)
{
    m_azimuth = _newAzimuth;
    m_radius = _newRadius;
    setXY(Tools::abscisse(_newRadius, _newAzimuth), Tools::ordinate(_newRadius, _newAzimuth));
    return 1;
}
void i2c_oled::drawPixel(int x, int y, int mode)
{
	if( (x>=width) || (x<0) ||(y>=height) || (y<0) ) return;

	int pos=0;
	int data=0;
	
	int xx=x/8;
	int yy=y/8;
	int restX=x-xx*8;
	int restY=y-yy*8;
	
	//Position setzen
	setXY(yy, xx);//zeile(0..7),spalte(0..15)
	
	//entsprechendes Zeichen (8Byte) übertragen, dabei bit setzen
	Wire.beginTransmission(_devid); // begin transmitting
	Wire.write(0x40);//data mode ->8byte ->8x8bit = 1 Zeichen
	for(int i=0;i<8;i++){ //8byte
		pos=posX+posY;// /8
		data=oLEDbuffer[pos];
		if(i==restX){
			switch (mode) {
				case drawmode_WHITE:	data |=  bit(restY); break;	//OR data = data | bit(restY)
				case drawmode_BLACK: 	data &= ~(bit(restY)); break;//invertirt + AND
				case drawmode_INVERSE:	data ^= bit(restY); break;	//XOR
			}
		}
		Wire.write(data);
		drawBuff(data);
	}
	Wire.endTransmission();    // stop transmitting	
}
Example #19
0
void nextLine()
{
	unsigned short x, y;
	getXY(&x, &y);
	setXY(0, y + 1);
	if(position > SCREEN_WIDTH * SCREEN_HEIGHT - 1)
		scrollScreen();
}
	Crystals(int value, int x, int y): value(value){
		//Define skin, coordinates, and amount = value;
		skin[1][1] = "*";
		skin[2][0] = "*";
		skin[2][1] = "*";
		skin[2][2] = "*";
		setXY(x, y);
	}
Example #21
0
File: UTFT.cpp Project: joyqi/UTFT
void UTFT::fillRect(int x1, int y1, int x2, int y2)
{
	if (x1>x2)
	{
		swap(int, x1, x2);
	}
	if (y1>y2)
	{
		swap(int, y1, y2);
	}
	if (display_transfer_mode==16)
	{
		cbi(P_CS, B_CS);
		setXY(x1, y1, x2, y2);
		sbi(P_RS, B_RS);
		_fast_fill_16(fch,fcl,((long(x2-x1)+1)*(long(y2-y1)+1)));
		sbi(P_CS, B_CS);
	}
	else if ((display_transfer_mode==8) and (fch==fcl))
	{
		cbi(P_CS, B_CS);
		setXY(x1, y1, x2, y2);
		sbi(P_RS, B_RS);
		_fast_fill_8(fch,((long(x2-x1)+1)*(long(y2-y1)+1)));
		sbi(P_CS, B_CS);
	}
	else
	{
		if (orient==PORTRAIT)
		{
			for (int i=0; i<((y2-y1)/2)+1; i++)
			{
				drawHLine(x1, y1+i, x2-x1);
				drawHLine(x1, y2-i, x2-x1);
			}
		}
		else
		{
			for (int i=0; i<((x2-x1)/2)+1; i++)
			{
				drawVLine(x1+i, y1, y2-y1);
				drawVLine(x2-i, y1, y2-y1);
			}
		}
	}
}
Example #22
0
bool IntroMenu::init() {
	if (!AbstractScreenObject::init()) return false;
	setXY(297, 384);
	firstButton = new Button(this, "play", 0, 0, 1, Locale::getCurrentImageLocale());
	firstButton->addReceiver(eimPlay, scene);
	secondButton = new Button(this, "setup", 0, 157, 2, Locale::getCurrentImageLocale());
	secondButton->addReceiver(eimSettings, scene);
    return true;
}
Example #23
0
void ITDB02::fillCircle(int x, int y, int radius)
{
	*P_CS &= ~B_CS;
	for(int y1=-radius; y1<=radius; y1++) 
		for(int x1=-radius; x1<=radius; x1++) 
			if(x1*x1+y1*y1 <= radius*radius) 
			{
				setXY(x+x1, y+y1, x+x1, y+y1);
				LCD_Write_DATA(((fcolorr&248)|fcolorg>>5),((fcolorg&28)<<3|fcolorb>>3));
			}
Example #24
0
// Flips the backbuffer -- transfers the framebuffer contents to the actual display. 
void SSD1351::updateScreen() {  
  // Set location to (0, 0)
  setXY(0, 0);
  
  // Transfer contents of framebuffer to SSD1351 display  
  for (uint32_t i=0; i<(width*height); i++) {
    uint16_t pixel = framebuffer[i];    
    writeData( ((pixel >> 8) & 0x00FF) );
    writeData( (pixel & 0x00FF) );
  }  
}
Example #25
0
//==========================================================//
// Prints a display char (not just a byte) in coordinates X Y,
// being multiples of 8. This means we have 16 COLS (0-15) 
// and 8 ROWS (0-7).
void OLED::sendCharXY(unsigned char data, int X, int Y)
{
  setXY(X, Y);
  Wire.beginTransmission(_address); // begin transmitting
  Wire.write(0x40);//data mode
  
  for(int i=0;i<8;i++)          
    Wire.write(pgm_read_byte(myFont[data-0x20]+i));
    
  Wire.endTransmission();    // stop transmitting
}
	Weapon(string name, int attack, int x, int y):name(name){
		//Set skin
		skin[0][1] = "|";
		skin[1][1] = "+";

		//Set attack bonus
		this->setAttack(attack);

		//Set coordinates
		setXY(x, y);
	}
Example #27
0
/*
 * Inserting Field Values
 */
void Config::insertFields()
{
    //one flag is set we need not have the signals as the settings are saved only at ok
    disconnect(fieldCombo,SIGNAL(currentIndexChanged(int)),this,SLOT(setXY(int)));

    fieldCombo->clear();//to avoid append of insertion during revisit
    fieldCombo->insertItems(0,fields[type1]);

    connect(fieldCombo,SIGNAL(currentIndexChanged(int)),this,SLOT(setXY(int)));

    setXY(0);//setting first fields X,Y for view
}
Example #28
0
EffectTryingPosition::EffectTryingPosition(Zone* pZone, ZoneCoord_t X, ZoneCoord_t Y, MonsterCorpse* pTower) throw(Error)
{
	__BEGIN_TRY

	m_pZone = pZone;
	setXY(X, Y);
	m_pTower = pTower;

	m_LastEffect = Effect::EFFECT_CLASS_TRYING_POSITION;

	__END_CATCH
}
Example #29
0
BattleHex& BattleHex::moveInDir(EDir dir, bool hasToBeValid)
{
	si16 x = getX(),
		y = getY();

	switch(dir)
	{
	case TOP_LEFT:
		setXY(y%2 ? x-1 : x, y-1, hasToBeValid);
		break;
	case TOP_RIGHT:
		setXY(y%2 ? x : x+1, y-1, hasToBeValid);
		break;
	case RIGHT:
		setXY(x+1, y, hasToBeValid);
		break;
	case BOTTOM_RIGHT:
		setXY(y%2 ? x : x+1, y+1, hasToBeValid);
		break;
	case BOTTOM_LEFT:
		setXY(y%2 ? x-1 : x, y+1, hasToBeValid);
		break;
	case LEFT:
		setXY(x-1, y, hasToBeValid);
		break;
	default:
		throw std::runtime_error("Disaster: wrong direction in BattleHex::operator+=!\n");
		break;
	}

	return *this;
}
//==========================================================//
// Prints a display char (not just a byte) in coordinates X Y,
// being multiples of 8. This means we have 16 COLS (0-15) 
// and 8 ROWS (0-7).
void i2c_oled::sendCharXY(unsigned char data, int zeile, int spalte)
{
  setXY(zeile, spalte);
  Wire.beginTransmission(_devid); // begin transmitting
  Wire.write(0x40);//data mode
  
  for(int i=0;i<8;i++){ //8 byte
     Wire.write(pgm_read_byte(oled_Font[data-0x20]+i));
	 drawBuff(pgm_read_byte(oled_Font[data-0x20]+i));
	}
    
  Wire.endTransmission();    // stop transmitting
}