Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


My D3D 2D Tile System

This topic is 5739 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Ok here is the definition for my tile class, that is a single tile on the map:
//--Note, GFXObjects is a class I created earlier holding D3D

//Objects to draw and such

class TILE2D : protected GFXObject
	float	cd_WorldX, cd_WorldY;				//center x,y position relative to world

	float	cd_TextureTop, cd_TextureLeft;		//Texel coordinates

	float	cd_TextureBottom, cd_TextureRight;

	long	cd_ID;								//tile ID, indicate terrain type and thus texture

	GFXVertex5			cd_Vertices[4];			//rectangle contruct vertices

	LPD3DVERTEXBUFFER	cd_pVB;					//D3D vertex buffer

	BOOL	cd_bCreated;						//status indication



	void SetPosition(float x, float y)
		cd_WorldX = x;
		cd_WorldY = y;

	void SetTexel(float Top, float Left, float Bottom, float Right)
		cd_TextureTop = Top;
		cd_TextureLeft = Left;
		cd_TextureBottom = Bottom;
		cd_TextureRight = Right;

	void SetID(long ID)
		cd_ID = ID;

	float GetY() const { return(cd_WorldY); }
	float GetX() const { return(cd_WorldX); }

	long Create();
	void Destroy();

	long Draw();

Share this post

Link to post
Share on other sites
I''m not sure what your purpose in posting this was? Were you looking for critique or just posting a sample for other people to use in their own stuff?

Just curious.

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!