Exemplo n.º 1
0
void NeoWindow::HandleButtonPress( FL_OBJECT *obj, XEvent *ev ) { // Deal with mouse button press
   Window rootWin, childWin, window = FL_ObjWin( mainWin->mainCanvas );
   int scale = neo->scale;
   Creature *old_creature = NULL, *new_creature = NULL;
#undef int
   int x, y, root_x, root_y; 
   unsigned int buttons;
#define int short
   ::XQueryPointer( display, window, &rootWin, &childWin, &root_x, &root_y, &x, &y, &buttons );
   if ( buttons == 0 ) { // No shift/alt/ctrl pressed
      if ( neo->output_creature >= 0 )
	 old_creature = neo->ppCreatureList[ neo->output_creature ];
      int creature = neo->FindCreatureAtLoc( -1, (x+xoffset)/scale, (y+yoffset)/scale );
      if ( creature >= 0 ) new_creature = neo->ppCreatureList[ creature ];
      neo->output_creature = creature;
      if ( old_creature != NULL ) DrawAt( old_creature->xcoord, old_creature->ycoord, true );
      if ( new_creature != NULL ) DrawAt( new_creature->xcoord, new_creature->ycoord, true );
      if ( nnet_plot != NULL ) RedrawNNetPlot();
   } else if ( buttons & ( 1 | 4 | 8 ) ) { // shift or alt or ctrl pressed (1 or 4 or 8)
      while( buttons & ( 1 | 4 | 8 ) ) {
	 ::XQueryPointer( display, window, &rootWin, &childWin, &root_x, &root_y, &x, &y, &buttons );
	 long loc = ((y+yoffset)/scale << neo->location_shift) + (x+xoffset)/scale;
	 neo->pcBarrierField[loc] = 255;
	 DrawAt( (x+xoffset)/scale, (y+yoffset)/scale, true );
      }
   }
}
void BattleAnimationChara::Draw() {
	//If animation is targeted on the screen
	if (animation.scope == RPG::Animation::Scope_screen) {
		DrawAt(SCREEN_TARGET_WIDTH / 2, SCREEN_TARGET_HEIGHT / 2);
		return;
	}
	const int character_height = 24;
	int vertical_center = character.GetScreenY() - character_height/2;
	int offset = CalculateOffset(animation.position, character_height);
	DrawAt(character.GetScreenX(), vertical_center + offset);
}
void BattleAnimationBattlers::Draw() {
	if (animation.scope == RPG::Animation::Scope_screen) {
		DrawAt(SCREEN_TARGET_WIDTH / 2, SCREEN_TARGET_HEIGHT / 3);
		return;
	}

	for (std::vector<Game_Battler*>::const_iterator it = battlers.begin();
	     it != battlers.end(); ++it) {
		const Game_Battler& battler = **it;
		const Sprite_Battler* sprite = Game_Battle::GetSpriteset().FindBattler(&battler);
		int offset = 0;
		if (sprite && sprite->GetBitmap()) {
			offset = CalculateOffset(animation.position, sprite->GetHeight());
		}
		DrawAt(battler.GetBattleX(), battler.GetBattleY() + offset);
	}
}
Exemplo n.º 4
0
void BattleAnimationBattlers::Draw() {
	for (std::vector<Game_Battler*>::const_iterator it = battlers.begin();
	     it != battlers.end(); ++it) {
		const Game_Battler& battler = **it;
		const Sprite_Battler* sprite = Game_Battle::GetSpriteset().FindBattler(&battler);
		int offset = 0;
		if (sprite && sprite->GetBitmap()) {
			offset = CalculateOffset(animation.position, sprite->GetHeight());
		}
		DrawAt(battler.GetBattleX(), battler.GetBattleY() + offset);
	}
}
Exemplo n.º 5
0
void BattleAnimationGlobal::Draw() {
	// The animations are played at the vertices of a regular grid,
	// 20 tiles wide by 10 tiles high, independant of the map.
	// NOTE: not accurate, but see #574
	const int x_stride = 20 * TILE_SIZE;
	const int y_stride = 10 * TILE_SIZE;
	int x_offset = (Game_Map::GetDisplayX()/TILE_SIZE) % x_stride;
	int y_offset = (Game_Map::GetDisplayY()/TILE_SIZE) % y_stride;
	for (int y = 0; y != 3; ++y) {
		for (int x = 0; x != 3; ++x) {
			DrawAt(x_stride*x - x_offset, y_stride*y - y_offset);
		}
	}
}
Exemplo n.º 6
0
void NeoWindow::Draw( Boolean draw_creatures ) {
   HandleScrollbars( NULL );
   Window window = FL_ObjWin( mainWin->mainCanvas );
   destination = window;
   if ( pixmap != (Pixmap) NULL ) destination = pixmap;
   XSetForeground( display, gc, BlackPixel( display, screen ) );
   ::XFillRectangle( display, destination, gc, 0, 0, mainWin->mainCanvas->w, 
		     mainWin->mainCanvas->h );
   if ( neo->setup && neo->keepDrawing ) {
      for ( long y = 0; y < neo->terrain_size; y ++ ) {
	 for ( long x = 0; x < neo->terrain_size; x ++ ) {
	    DrawAt( x, y, false );
	 }
      }
      if ( draw_creatures ) {
	 Creature **ptr = &( neo->ppCreatureList[0] );
	 for ( int i = 0; i < neo->max_index; i ++ ) {
	    Creature *creature = *ptr++;
	    if ( creature != (Creature *) NULL ) RedrawCreature( i );
	 }	    
      }
   }
   changed = false;
}
Exemplo n.º 7
0
//! @param where the point the color should be taken from and drawn
void rGradient::DrawPoint(tCoord const &where) {
#ifndef DEDICATED
    DrawAt(where);
    Vertex(where.x, where.y);
#endif
}
Exemplo n.º 8
0
void BattleAnimationChara::Draw() {
	const int character_height = 24;
	int vertical_center = character.GetScreenY() - character_height/2;
	int offset = CalculateOffset(animation.position, character_height);
	DrawAt(character.GetScreenX(), vertical_center + offset);
}
Exemplo n.º 9
0
void Clock::Render( int pageChanged )
{
	char details[100];

	if( pageChanged || forceRedraw )
	{
		SDL_FillRect( display, 0, SDL_MapRGB( display->format, 0, 0, 0 ) );

		DrawString( (char*)&dateText, 400, 0, 1, ( dimMode == 0 ? white : black ), ( dimMode == 0 ? cyan : blue ), 2, alignTop );

		sprintf((char*)&details, "Song %d of %d", curSettings->MusicIndex + 1, musicFiles.size() );
		DrawString( details, 6, 440, 0, ( dimMode == 0 ? white : black ), ( dimMode == 0 ? orange : dkred ), 1, alignBottomLeft );
		if( musicFiles.size() > 0 )
		{
			if( BASS_StreamGetFilePosition( curMP3, BASS_FILEPOS_CURRENT ) == -1 )
				DrawString( "<< Paused >>", 400, 480, 0, ( dimMode == 0 ? white : black ), ( dimMode == 0 ? orange : dkred ), 1, alignBottom );
			else
				DrawString( musicFiles.at(curSettings->MusicIndex), 6, 480, 0, ( dimMode == 0 ? white : black ), ( dimMode == 0 ? orange : dkred ), 1, alignBottomLeft );
		} else if ( hasBASS ) {
			DrawString( "No playlist", 6, 480, 0, ( dimMode == 0 ? white : black ), ( dimMode == 0 ? orange : dkred ), 1, alignBottomLeft );
		} else {
			DrawString( "No audio", 6, 480, 0, ( dimMode == 0 ? white : black ), ( dimMode == 0 ? orange : dkred ), 1, alignBottomLeft );
		}
	}

	char curTime[3];
	curTime[2] = 0;
	if( pageChanged || renderHr != 0 )
	{
		curTime[0] = clockAscii[(hr - (hr % 10)) / 10];
		curTime[1] = clockAscii[hr % 10];
		DrawString( (char*)&curTime, 370, 240, 2, ( dimMode == 0 ? red : black ), ( dimMode == 0 ? dkred : red ), 3, alignRight );
		renderHr = 0;
		if( hr == 0 && !pageChanged )
			pageChanged = true;
	}
	if( pageChanged || renderMn != 0 )
	{
		curTime[0] = clockAscii[(mn - (mn % 10)) / 10];
		curTime[1] = clockAscii[mn % 10];
		DrawString( (char*)&curTime, 430, 240, 2, ( dimMode == 0 ? red : black ), ( dimMode == 0 ? dkred : red ), 3, alignLeft );
		renderMn = 0;
	}
	if( blpdim )
		DrawString( ":", 400, 240, 2, ( dimMode == 0 ? red : black ), ( dimMode == 0 ? dkred : red ), 3, alignCentre );

	DrawAt( ( curSettings->Alarms->count == 0 ? belldim : ( dimMode == 0 ? bell : belllow ) ), 780, 80, alignTopRight );

	if( lastVolumeOut == 0 )
		DrawAt( sleepdim, 780, 140, alignTopRight );
	else
		DrawAt( ( dimMode == 0 ? sleepico : sleeplow ), 780, 140, alignTopRight );

	DrawAt( ( dimMode == 0 ? volumeico : volumeicolow ), 780, 200, alignTopRight );
	int curVol = (int)(BASS_GetVolume() * 100.0f);

	DrawRect( 744, 250, 24, 100, SDL_MapRGB( display->format, gray.r, gray.g, gray.b ) );
	DrawRect( 744, 250 + (100-curVol), 24, curVol, SDL_MapRGB( display->format, ( dimMode == 0 ? red.r : dkred.r ), ( dimMode == 0 ? red.g : dkred.g ), ( dimMode == 0 ? red.b : dkred.b ) ) );


	if( pageChanged )
		Invalidate();

	forceRedraw = 0;
}