⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cbrick.h

📁 我在资源网上发布的一个brickshorterjr的代码
💻 H
字号:
#ifndef	CBRICK_H
#define	CBRICK_H

#include	<hge.h>
#include	<hgeresource.h>
#include	<hgesprite.h>
#include    <stdio.h>

#include    "g_info.h"


//the type of the brick 
enum	e_BrickType
{
	BRICK_RED = 0,
	BRICK_GREEN,
	BRICK_BLUE,
	BRICK_SKYYELLOW,
	BRICK_YELLOW,
	BRICK_GRAY,
	BRICK_CYAN,
	BRICK_PINK,
	BRICK_UNIVERSAL,     //8
	BRICK_BOMB,          //9
	BRICK_ARROW_CHANGER,  //10
	BRICK_LIGHT,  //11
	BRICK_COLOR   //12
};

enum    e_BrickState
{
	STATE_1 = 0,
	STATE_2,
	STATE_3, 
	STATE_4, 	
	STATE_5, 	
	STATE_SLEEP //5
};

//the direction of the brick
enum	e_BrickDirection
{
	BRICK_NODIR1 = 0,
	BRICK_RIGHT,
	BRICK_UP,
	BRICK_LEFT,
	BRICK_DOWN,
	BRICK_SLEEP,
	BRICK_NODIR2
};

enum	e_BrickMoveResult
{
	BRICK_MOVE_NOTHING = 0,
	BRICK_MOVE_STOP,
	BRICK_MOVE_INLAYER				//the brick will inert in the layers
};



class CBrick
{

public:
	CBrick( HGE	*hgeEngine , hgeResourceManager *resMgr );

	bool            Init( int arrayX, int arrayY, e_BrickDirection direction, e_BrickType type, e_BrickState state,bool visible );
	void            LoadRes();
	bool            Update();
	void            Render();
	void            RenderToBuffer();
	void            RenderRotate(float angle);
	void            Release();

	void            SrcToArray();
	void            ArrayToSrc();

	void            UpdateFace();
	void            Play() { m_moving = true; }
	void            SetBeCheckLinked() { m_bCheckLinked = true; }
	void            SetBeNotCheckLinked() { m_bCheckLinked = false; }

	void            SetEndX( float endX ) { m_endX = endX; }
	void            SetEndY( float endY ) { m_endY = endY; }
	void            SetVX( float vx ) { m_vx = vx; }
	void            SetVY( float vy ) { m_vy = vy; }
	void            SetNewArrayX( int arrayX ) { m_NewArrayX = arrayX; }
	void            SetNewArrayY( int arrayY ) { m_NewArrayY = arrayY; }
	void            SetState( e_BrickState state );
	void            MoveTo( e_BrickDirection direction, int newArrayX, int newArrayY , float vx, float vy );

	void            RandSetType();
	void            RandSetState();

	void            SetNotSleepState();

	float           GetX() { return m_x; }
	float           GetY() { return m_y; }
	int             GetArrayX() { return m_arrayX; }
	int             GetArrayY() { return m_arrayY; }
	e_BrickType     GetType() { return m_type; }
	e_BrickState    GetState() { return m_state; }

	bool            IsMoving() { return m_moving; }
	bool            IsBeCheckLinked() { return m_bCheckLinked; }


	void            SetDirection( e_BrickDirection direction ) { m_direction = direction; }

	e_BrickDirection GetDirection() { return m_direction; }

	enum {	BrickTypeCount = 11, BrickStateCount = 6 };

private:
		
	HGE			         *m_hgeEngine;
	hgeResourceManager   *m_resMgr;
	hgeSprite	         *m_sp;

	float m_x;
	float m_y;
	float m_vx;
	float m_vy;
	float m_endX;
	float m_endY;

	int m_arrayX;
	int m_arrayY;

	int m_NewArrayX;
	int m_NewArrayY;
	
	bool m_visible;
	bool m_moving;
	bool m_bCheckLinked;
	
	e_BrickDirection m_direction;
	e_BrickType m_type;
	e_BrickState m_state;
	float m_stateStep;

	e_BrickDirection m_Newdirection;
	e_BrickType m_Newtype;
	e_BrickState m_Newstate;

};




#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -