コード例 #1
0
SquareComposedSprite::SquareComposedSprite (
    ISprite* topLeft,
    ISprite* topRight,
    ISprite* bottomLeft,
    ISprite* bottomRight)
    : ComposedSprite ()
{
    AddSprite (topLeft);
    AddSprite (topRight);
    AddSprite (bottomLeft);
    AddSprite (bottomRight);
}
コード例 #2
0
ファイル: Chaser.c プロジェクト: M-bot/EE319KLab10
uint8_t Pooter_Init(uint8_t x,uint8_t y)
{
	return (AddSprite(Pooter,14,10,x,y));

	
	
}
コード例 #3
0
ファイル: Chaser.c プロジェクト: M-bot/EE319KLab10
uint8_t Attack_Fly_Init(uint8_t x,uint8_t y)
{
	uint8_t id = AddSprite(Attack_Fly,10,4,x,y);

	return(id);
	
}
コード例 #4
0
ファイル: Sprite.cpp プロジェクト: GIT231/MyVim
Sprite::Sprite(
			   HINSTANCE hInstance,
			   ObjectType obj,
			   int x,
			   int y
			   )
{   
	m_Vx = x+obj.m_dx;
	m_Vy = y+obj.m_dy;
	SetRect(&m_Vrect,m_Vx,m_Vy,m_Vx+obj.m_Vwidth,m_Vy+obj.m_Vheight);
	SetRect(&m_rect,x,y,x+obj.m_width,y+obj.m_height);
	m_pSprite = this;

	m_hbm = obj.m_hbm;
	m_trans = obj.m_trans;
	m_transcolor = obj.m_color;
	m_hInstance = hInstance;
	m_Vwidth = obj.m_Vwidth;
	m_Vheight = obj.m_Vheight;
	m_x = x;
	m_y = y;
	m_width = obj.m_width;
	m_height = obj.m_height;
	AddSprite();

}
コード例 #5
0
IsometricSprite* IsometricScene::CreateSprite( Image* image, Layer layer )
{
	IsometricSprite* sprite = new IsometricSprite( image );
	AddSprite( sprite, layer );

	return sprite;
}
コード例 #6
0
ファイル: Chaser.c プロジェクト: M-bot/EE319KLab10
uint8_t Chaser_Init(uint8_t x,uint8_t y)
{
	uint8_t id = AddSprite(Chaser_Sprite,13,17,x,y);

	return(id);
	
}
コード例 #7
0
ファイル: poly_scene.cpp プロジェクト: usernameak/gzdoom
void RenderPolyScene::AddSprite(PolyRenderThread *thread, AActor *thing, double sortDistance, DVector2 left, DVector2 right, double t1, double t2, void *node)
{
	while (!((size_t)node & 1))  // Keep going until found a subsector
	{
		node_t *bsp = (node_t *)node;
		
		DVector2 planePos(FIXED2DBL(bsp->x), FIXED2DBL(bsp->y));
		DVector2 planeNormal = DVector2(FIXED2DBL(-bsp->dy), FIXED2DBL(bsp->dx));
		double planeD = planeNormal | planePos;
		
		int sideLeft = (left | planeNormal) > planeD;
		int sideRight = (right | planeNormal) > planeD;
		
		if (sideLeft != sideRight)
		{
			double dotLeft = planeNormal | left;
			double dotRight = planeNormal | right;
			double t = (planeD - dotLeft) / (dotRight - dotLeft);
			
			DVector2 mid = left * (1.0 - t) + right * t;
			double tmid = t1 * (1.0 - t) + t2 * t;
			
			AddSprite(thread, thing, sortDistance, mid, right, tmid, t2, bsp->children[sideRight]);
			right = mid;
			t2 = tmid;
		}
		node = bsp->children[sideLeft];
	}
	
	subsector_t *sub = (subsector_t *)((uint8_t *)node - 1);
	
	if (Cull.SubsectorDepths[sub->Index()] != 0xffffffff)
		thread->TranslucentObjects.push_back(thread->FrameMemory->NewObject<PolyTranslucentThing>(thing, sub, Cull.SubsectorDepths[sub->Index()], sortDistance, (float)t1, (float)t2, CurrentViewpoint->StencilValue));
}
コード例 #8
0
ファイル: Chaser.c プロジェクト: M-bot/EE319KLab10
uint8_t Fatty_Init(uint8_t x,uint8_t y)
{
	uint8_t id = AddSprite(Fatty,22,24,x,y);

	return(id);
	
}
コード例 #9
0
ファイル: modcreator.cpp プロジェクト: killaTW/teeworlds
int CModAPI_ModCreator::AddSpriteInternal(int ImageId, int x, int y, int w, int h, int gx, int gy)
{
	if(ImageId >= MODAPI_NB_INTERNALIMG || ImageId < 0)
	{
		dbg_msg("mod", "can't add the internal sprite : wrong image id (%i)", ImageId);
		return -1;
	}
	return AddSprite(ImageId, 0, x, y, w, h, gx, gy);
}
コード例 #10
0
ファイル: poly_scene.cpp プロジェクト: usernameak/gzdoom
void RenderPolyScene::Render(PolyPortalViewpoint *viewpoint)
{
	PolyPortalViewpoint *oldviewpoint = CurrentViewpoint;
	CurrentViewpoint = viewpoint;

	PolyRenderThread *thread = PolyRenderer::Instance()->Threads.MainThread();

	CurrentViewpoint->ObjectsStart = thread->TranslucentObjects.size();
	CurrentViewpoint->SectorPortalsStart = thread->SectorPortals.size();
	CurrentViewpoint->LinePortalsStart = thread->LinePortals.size();

	PolyCullCycles.Clock();
	Cull.CullScene(CurrentViewpoint->PortalEnterSector, CurrentViewpoint->PortalEnterLine);
	PolyCullCycles.Unclock();

	RenderSectors();

	PolyMaskedCycles.Clock();
	const auto &rviewpoint = PolyRenderer::Instance()->Viewpoint;
	for (uint32_t sectorIndex : Cull.SeenSectors)
	{
		sector_t *sector = &PolyRenderer::Instance()->Level->sectors[sectorIndex];
		for (AActor *thing = sector->thinglist; thing != nullptr; thing = thing->snext)
		{
			if (!RenderPolySprite::IsThingCulled(thing))
			{
				int spritenum = thing->sprite;
				bool isPicnumOverride = thing->picnum.isValid();
				FSpriteModelFrame *modelframe = isPicnumOverride ? nullptr : FindModelFrame(thing->GetClass(), spritenum, thing->frame, !!(thing->flags & MF_DROPPED));
				double distanceSquared = (thing->Pos() - rviewpoint.Pos).LengthSquared();
				if (r_modelscene && modelframe && distanceSquared < model_distance_cull)
				{
					AddModel(thread, thing, distanceSquared, thing->Pos());
				}
				else
				{
					DVector2 left, right;
					if (!RenderPolySprite::GetLine(thing, left, right))
						continue;
					AddSprite(thread, thing, distanceSquared, left, right);
				}
			}
		}
	}
	PolyMaskedCycles.Unclock();

	CurrentViewpoint->ObjectsEnd = thread->TranslucentObjects.size();
	CurrentViewpoint->SectorPortalsEnd = thread->SectorPortals.size();
	CurrentViewpoint->LinePortalsEnd = thread->LinePortals.size();

	Skydome.Render(thread, CurrentViewpoint->WorldToView, CurrentViewpoint->WorldToClip);

	RenderPortals();
	RenderTranslucent();

	CurrentViewpoint = oldviewpoint;
}
コード例 #11
0
ファイル: modcreator.cpp プロジェクト: killaTW/teeworlds
int CModAPI_ModCreator::AddSpriteExternal(int ImageId, int x, int y, int w, int h, int gx, int gy)
{	
	if(ImageId >= m_Images.size() || ImageId < 0)
	{
		dbg_msg("mod", "can't add the external sprite : wrong image id (%i)", ImageId);
		return -1;
	}
	return AddSprite(ImageId, 1, x, y, w, h, gx, gy);
}
コード例 #12
0
ファイル: spritesheet.cpp プロジェクト: pmprog/TugOfWar
SpriteSheet::SpriteSheet( std::string Filename, int FrameWidth, int FrameHeight )
{
	sheet = BitmapCache::LoadBitmap( Filename );

	for( int y = 0; y < al_get_bitmap_height( sheet ); y += FrameHeight )
	{
		for( int x = 0; x < al_get_bitmap_width( sheet ); x += FrameWidth )
		{
			AddSprite( x, y, FrameWidth, FrameHeight );
		}
	}
}
コード例 #13
0
ファイル: font.cpp プロジェクト: Volkanite/Push
VOID Draw( RECT* destinationRect, RECT* sourceRect, XMCOLOR color )
{
    Sprite sprite;
    sprite.SrcRect = *sourceRect;
    sprite.DestRect = *destinationRect;
    sprite.Color = color;
    sprite.Z = 0.0f;
    sprite.Angle = 0.0f;
    sprite.Scale = 1.0f;

    AddSprite(&sprite);
}
コード例 #14
0
ファイル: poly_scene.cpp プロジェクト: usernameak/gzdoom
void RenderPolyScene::AddSprite(PolyRenderThread *thread, AActor *thing, double sortDistance, const DVector2 &left, const DVector2 &right)
{
	if (PolyRenderer::Instance()->Level->nodes.Size() == 0)
	{
		subsector_t *sub = &PolyRenderer::Instance()->Level->subsectors[0];
		if (Cull.SubsectorDepths[sub->Index()] != 0xffffffff)
			thread->TranslucentObjects.push_back(thread->FrameMemory->NewObject<PolyTranslucentThing>(thing, sub, Cull.SubsectorDepths[sub->Index()], sortDistance, 0.0f, 1.0f, CurrentViewpoint->StencilValue));
	}
	else
	{
		AddSprite(thread, thing, sortDistance, left, right, 0.0, 1.0, PolyRenderer::Instance()->Level->HeadNode());
	}
}
コード例 #15
0
ファイル: gl_drawinfo.cpp プロジェクト: gamegenten/GZDoom-GPL
//==========================================================================
//
//
//
//==========================================================================
void GLDrawList::SortSpriteIntoPlane(SortNode * head,SortNode * sort)
{
	GLFlat * fh=&flats[drawitems[head->itemindex].index];
	GLSprite * ss=&sprites[drawitems[sort->itemindex].index];

	bool ceiling = fh->z > ViewPos.Z;

	if ((ss->z1>fh->z && ss->z2<fh->z) || ss->modelframe)
	{
		// We have to split this sprite
		GLSprite s=*ss;
		AddSprite(&s);	// add a copy to avoid reallocation issues.
	
		// Splitting is done in the shader with clip planes, if available
		if (gl.flags & RFL_NO_CLIP_PLANES)
		{
			GLSprite * ss1;
			ss1=&sprites[sprites.Size()-1];
			ss=&sprites[drawitems[sort->itemindex].index];	// may have been reallocated!
			float newtexv=ss->vt + ((ss->vb-ss->vt)/(ss->z2-ss->z1))*(fh->z-ss->z1);

			if (!ceiling)
			{
				ss->z1=ss1->z2=fh->z;
				ss->vt=ss1->vb=newtexv;
			}
			else
			{
				ss1->z1=ss->z2=fh->z;
				ss1->vt=ss->vb=newtexv;
			}
		}

		SortNode * sort2=SortNodes.GetNew();
		memset(sort2,0,sizeof(SortNode));
		sort2->itemindex=drawitems.Size()-1;

		head->AddToLeft(sort);
		head->AddToRight(sort2);
	}
	else if ((ss->z2<fh->z && !ceiling) || (ss->z1>fh->z && ceiling))	// completely on the left side
	{
		head->AddToLeft(sort);
	}
	else
	{
		head->AddToRight(sort);
	}

}
コード例 #16
0
ファイル: spritesheet.cpp プロジェクト: pmprog/TugOfWar
void SpriteSheet::ExtractSpriteFrom( char* Grid, int GridW, int GridH, int StartX, int StartY )
{
  // Know where we start
	gridalloc_minx = StartX;
	gridalloc_miny = StartY;
	gridalloc_maxx = StartX;
  gridalloc_maxy = StartY;

  // Follow the grid around for adjactent [1] cells
  AllocateGrid( Grid, GridW, GridH, StartX, StartY );

  // Add sprite to sheet
  AddSprite( gridalloc_minx * gridalloc_size, gridalloc_miny * gridalloc_size, ((gridalloc_maxx - gridalloc_minx) + 1) * gridalloc_size, ((gridalloc_maxy - gridalloc_miny) + 1) * gridalloc_size );
}
コード例 #17
0
ファイル: gl_drawinfo.cpp プロジェクト: AkumaKing/Xeu
//==========================================================================
//
//
//
//==========================================================================
void GLDrawList::SortSpriteIntoPlane(SortNode * head,SortNode * sort)
{
	GLFlat * fh=&flats[drawitems[head->itemindex].index];
	GLSprite * ss=&sprites[drawitems[sort->itemindex].index];
	GLSprite * ss1;

	bool ceiling = fh->z > FIXED2FLOAT(viewz);

	if (ss->z1>fh->z && ss->z2<fh->z)
	{
		// We have to split this sprite!
		GLSprite s=*ss;
		AddSprite(&s);
		ss1=&sprites[sprites.Size()-1];
		ss=&sprites[drawitems[sort->itemindex].index];	// may have been reallocated!
		float newtexv=ss->vt + ((ss->vb-ss->vt)/(ss->z2-ss->z1))*(fh->z-ss->z1);

		if (!ceiling)
		{
			ss->z1=ss1->z2=fh->z;
			ss->vt=ss1->vb=newtexv;
		}
		else
		{
			ss1->z1=ss->z2=fh->z;
			ss1->vt=ss->vb=newtexv;
		}

		SortNode * sort2=SortNodes.GetNew();
		memset(sort2,0,sizeof(SortNode));
		sort2->itemindex=drawitems.Size()-1;

		head->AddToLeft(sort);
		head->AddToRight(sort2);
	}
	else if ((ss->z2<fh->z && !ceiling) || (ss->z1>fh->z && ceiling))	// completely on the left side
	{
		head->AddToLeft(sort);
	}
	else
	{
		head->AddToRight(sort);
	}

}
コード例 #18
0
void GameEngine::UpdateSprites()
{
  // Update the sprites in the sprite vector
  SDL_Rect      rcOldSpritePos;
  SPRITEACTION  saSpriteAction;
  vector<Sprite*>::iterator siSprite;

  //merge the sprite list with the sprite to add vector (if any)
  m_vSprites.insert(m_vSprites.begin(),
		    m_vSpritesToAdd.begin(),
		    m_vSpritesToAdd.end());
  m_vSpritesToAdd.clear();
  
  for (siSprite = m_vSprites.begin(); siSprite != m_vSprites.end(); siSprite++)
  {
    // Save the old sprite position in case we need to restore it
    rcOldSpritePos = (*siSprite)->GetPosition();

    // Update the sprite
    saSpriteAction = (*siSprite)->Update();

    // Handle the SA_ADDSPRITE sprite action
    if (saSpriteAction & SA_ADDSPRITE)
      // Allow the sprite to add its sprite
      AddSprite((*siSprite)->AddSprite());
    
    // Handle the SA_KILL sprite action
    if (saSpriteAction & SA_KILL)
    {
      // Notify the game that the sprite is dying
      m_game->SpriteDying(*siSprite);
      
      // Kill the sprite
      delete (*siSprite);
      m_vSprites.erase(siSprite);
      siSprite--;
      continue;
    }

    // See if the sprite collided with any others
    if (CheckSpriteCollision(*siSprite))
      // Restore the old sprite position
      (*siSprite)->SetPosition(rcOldSpritePos);
  }
}
コード例 #19
0
void GameEngine::UpdateSprites()
{
	//Update the sprites in the sprite vector
	RECT			rcOldSpritePos;
	SPRITEACTION	saSpriteAction;
	vector<Sprite*>::iterator siSprite;
	siSprite = m_vSprites.begin(); 
	while (siSprite != m_vSprites.end())
	{
		//Save the old sprite position in case we need to restore it
		rcOldSpritePos = (*siSprite)->GetPosition();

		//Update the sprite
		saSpriteAction = (*siSprite)->Update();

		//Handle the SA_ADDSPRITE sprite action
		if (saSpriteAction & SA_ADDSPRITE)
			//Allow the sprite to add its sprite
			AddSprite((*siSprite)->AddSprite());

		//Handle the SA_KILL sprite action
		if (saSpriteAction & SA_KILL)
		{
			//Notify the game that the sprite is dying
			SpriteDying(*siSprite);

			siSprite = m_vSprites.erase(siSprite);
			continue;
		}

		//See if the sprite collided with any others
		if (CheckSpriteCollision(*siSprite))
			//Restore old sprite position
			(*siSprite)->SetPosition(rcOldSpritePos);

		if (siSprite == m_vSprites.end() || m_vSprites.size() == 0)
		{
			break;
		}
			++siSprite;
	}
}
コード例 #20
0
ファイル: Items.c プロジェクト: M-bot/EE319KLab10
uint8_t Blue_Cap_Item_Init()
{
	return (AddSprite(bluecap,10,10,140/2-5,70/2-5));
} 
コード例 #21
0
ファイル: Items.c プロジェクト: M-bot/EE319KLab10
uint8_t Blood_Clot_Item_Init()
{
	return (AddSprite(bloodclot,10,10,140/2-5,70/2-5));
} 
コード例 #22
0
ファイル: Items.c プロジェクト: M-bot/EE319KLab10
uint8_t Heart_Item_Init(uint8_t x,uint8_t y)
{
	return (AddSprite(heart,10,10,x,y));
} 
コード例 #23
0
ファイル: scene.cpp プロジェクト: AlvaroAbad/P2D
Sprite* Scene::CreateSprite(Image* image, Layer layer) {
	Sprite* spr = new Sprite(image);
	AddSprite(spr, layer);
	return spr;
}
コード例 #24
0
ファイル: Chaser.c プロジェクト: M-bot/EE319KLab10
uint8_t Horf_Init(uint8_t x,uint8_t y)
{
	return (AddSprite(Horf,16,14,x,y));
} 
コード例 #25
0
ファイル: Items.c プロジェクト: M-bot/EE319KLab10
uint8_t Blood_Bag_Item_Init()
{
	return (AddSprite(bloodbag,10,10,140/2-5,70/2-5));
} 
コード例 #26
0
ファイル: Chaser.c プロジェクト: M-bot/EE319KLab10
uint8_t Arrow_Up_Init()
{
	return (AddSprite(Arrow_Up,5,7,70-2,1));
} 
コード例 #27
0
ファイル: gl_drawinfo.cpp プロジェクト: gamegenten/GZDoom-GPL
void GLDrawList::SortSpriteIntoWall(SortNode * head,SortNode * sort)
{
	GLWall * wh=&walls[drawitems[head->itemindex].index];
	GLSprite * ss=&sprites[drawitems[sort->itemindex].index];
	GLSprite * ss1;

	float v1 = wh->PointOnSide(ss->x1, ss->y1);
	float v2 = wh->PointOnSide(ss->x2, ss->y2);

	if (fabs(v1)<MIN_EQ && fabs(v2)<MIN_EQ) 
	{
		if (wh->type==RENDERWALL_FOGBOUNDARY) 
		{
			head->AddToLeft(sort);
		}
		else 
		{
			head->AddToEqual(sort);
		}
	}
	else if (v1<MIN_EQ && v2<MIN_EQ) 
	{
		head->AddToLeft(sort);
	}
	else if (v1>-MIN_EQ && v2>-MIN_EQ) 
	{
		head->AddToRight(sort);
	}
	else
	{
		const bool drawWithXYBillboard = ((ss->particle && gl_billboard_particles) || (!(ss->actor && ss->actor->renderflags & RF_FORCEYBILLBOARD)
			&& (gl_billboard_mode == 1 || (ss->actor && ss->actor->renderflags & RF_FORCEXYBILLBOARD))));

		const bool drawBillboardFacingCamera = gl_billboard_faces_camera;
		// [Nash] has +ROLLSPRITE
		const bool rotated = (ss->actor != nullptr && ss->actor->renderflags & (RF_ROLLSPRITE | RF_WALLSPRITE | RF_FLATSPRITE));

		// cannot sort them at the moment. This requires more complex splitting.
		if (drawWithXYBillboard || drawBillboardFacingCamera || rotated)
		{
			float v1 = wh->PointOnSide(ss->x, ss->y);
			if (v1 < 0)
			{
				head->AddToLeft(sort);
			}
			else
			{
				head->AddToRight(sort);
			}
			return;
		}
		double r=ss->CalcIntersectionVertex(wh);

		float ix=(float)(ss->x1 + r * (ss->x2-ss->x1));
		float iy=(float)(ss->y1 + r * (ss->y2-ss->y1));
		float iu=(float)(ss->ul + r * (ss->ur-ss->ul));

		GLSprite s=*ss;
		AddSprite(&s);
		ss1=&sprites[sprites.Size()-1];
		ss=&sprites[drawitems[sort->itemindex].index];	// may have been reallocated!

		ss1->x1=ss->x2=ix;
		ss1->y1=ss->y2=iy;
		ss1->ul=ss->ur=iu;

		SortNode * sort2=SortNodes.GetNew();
		memset(sort2,0,sizeof(SortNode));
		sort2->itemindex=drawitems.Size()-1;

		if (v1>0)
		{
			head->AddToLeft(sort2);
			head->AddToRight(sort);
		}
		else
		{
			head->AddToLeft(sort);
			head->AddToRight(sort2);
		}
	}
}
コード例 #28
0
ファイル: Chaser.c プロジェクト: M-bot/EE319KLab10
uint8_t Arrow_Left_Init()
{
	return (AddSprite(Arrow_Left,7,5,1,40-2));
} 
コード例 #29
0
ファイル: gl_drawinfo.cpp プロジェクト: AkumaKing/Xeu
//==========================================================================
//
// 
//
//==========================================================================
void GLDrawList::SortSpriteIntoWall(SortNode * head,SortNode * sort)
{
	GLWall * wh=&walls[drawitems[head->itemindex].index];
	GLSprite * ss=&sprites[drawitems[sort->itemindex].index];
	GLSprite * ss1;

	float v1 = wh->PointOnSide(ss->x1, ss->y1);
	float v2 = wh->PointOnSide(ss->x2, ss->y2);

	if (fabs(v1)<MIN_EQ && fabs(v2)<MIN_EQ) 
	{
		if (wh->type==RENDERWALL_FOGBOUNDARY) 
		{
			head->AddToLeft(sort);
		}
		else 
		{
			head->AddToEqual(sort);
		}
	}
	else if (v1<MIN_EQ && v2<MIN_EQ) 
	{
		head->AddToLeft(sort);
	}
	else if (v1>-MIN_EQ && v2>-MIN_EQ) 
	{
		head->AddToRight(sort);
	}
	else
	{
		double r=ss->CalcIntersectionVertex(wh);

		float ix=(float)(ss->x1 + r * (ss->x2-ss->x1));
		float iy=(float)(ss->y1 + r * (ss->y2-ss->y1));
		float iu=(float)(ss->ul + r * (ss->ur-ss->ul));

		GLSprite s=*ss;
		AddSprite(&s);
		ss1=&sprites[sprites.Size()-1];
		ss=&sprites[drawitems[sort->itemindex].index];	// may have been reallocated!

		ss1->x1=ss->x2=ix;
		ss1->y1=ss->y2=iy;
		ss1->ul=ss->ur=iu;

		SortNode * sort2=SortNodes.GetNew();
		memset(sort2,0,sizeof(SortNode));
		sort2->itemindex=drawitems.Size()-1;

		if (v1>0)
		{
			head->AddToLeft(sort2);
			head->AddToRight(sort);
		}
		else
		{
			head->AddToLeft(sort);
			head->AddToRight(sort2);
		}
	}
}
コード例 #30
0
ファイル: Chaser.c プロジェクト: M-bot/EE319KLab10
uint8_t Arrow_Down_Init()
{
	return (AddSprite(Arrow_Down,5,7,70-2,80-7));
}