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

📄 ui.h

📁 一个3D的保龄球的源代码
💻 H
字号:
// UI.h: interface for the CUI class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_UI_H__D3AE5369_D977_4C3B_AC9F_EB1441FE18E6__INCLUDED_)
#define AFX_UI_H__D3AE5369_D977_4C3B_AC9F_EB1441FE18E6__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "..\System\gfx.h"
#include "..\System\font.h"
#include "def.h"
#include "match.h"
#include "animation.h"
#include "actiondef.h"

const int MAX_IMAGECOUNT = 30;
const int IMAGE_SMALLPIN = 1;
const int IMAGE_BG = 2;
const int IMAGE_BG2 = 3;
const int IMAGE_BG3 = 4;
const int IMAGE_REPTUT = 5;
const int IMAGE_STAR = 6;
const int IMAGE_MENULINE = 7;
const int IMAGE_GAMELOFT=8;
const int IMAGE_CLUB=9;
const int IMAGE_SPLASH = 10;
const int IMAGE_POWERFIRE = 11;
const int IMAGE_TVSPECULAR = 12;
const int IMAGE_TVSPLASHA1 = 13;
const int IMAGE_TVSPLASHA2 = 14;
const int IMAGE_TVSPLASHA3 = 15;
const int IMAGE_TVSPLASHA4 = 17;
const int IMAGE_TVSPLASHA5 = 18;
const int IMAGE_TVSPLASHA6 = 19;
const int IMAGE_TVSPLASHA7 = 20;
const int IMAGE_TVSPLASHA8 = 21;
const int IMAGE_TVSPLASHB1 = 22;
const int IMAGE_TVSPLASHB2 = 23;
const int IMAGE_TVSPLASHB3 = 24;
const int IMAGE_TVSPLASHB4 = 25;
const int IMAGE_TVSPLASHB5 = 26;
const int IMAGE_TVSPLASHB6 = 27;
const int IMAGE_TVSPLASHB7 = 28;
const int IMAGE_TVSPLASHB8 = 29;

const int ICON_COUNT = 8;
const int ICON_A = 1;
const int ICON_B = 2;
const int ICON_C = 3;
const int ICON_D = 4;
const int ICON_E = 5;
const int ICON_F = 6;
const int ICON_G = 7;

enum BUTTON_TYPE
{
	BUTTON_LEFTBOTTOM = 0,
	BUTTON_RIGHTBOTTOM,
	BUTTON_INGAME,
	BUTTONTYPE_COUNT
};

//Qiu Li, 2005/1/19
#define STRING_FROM_LEFT	1
#define STRING_FROM_RIGHT	2
#define	STRING_FLASH_INTO	3

#define	STRING_ONEBYONE		11
#define	STRING_ALL			12
//Qiu Li end

//this class will manager all 2d images used by menu, logo, interface
//and draw them
//additional, it will provide some implements like draw dialog, power bar etc..

class CUI  
{
public:

	enum	{
		MAXANIMFRAME = 4425789
	};

	// draw strike/spare/..., anim: 0 --> +inf
	void DrawDeliverResult(int resultType, int anim = 0);
	void DrawScoreNum(int x, int y, int num);
	void DrawHintInfo(int y, char *str, int x);
	void DrawScoreBoard(int y, const ScoreInfo *pScore, int pinMode, int playerid,int maxRound,
		int aimpinid, int aimpos, int aimdir, const char* p1name, const char*p2name, bool isDraw, int p2ExtraCount, int player2score=0);
	CUI(CEngine*);
	~CUI();
//	void SetEngine(CEngine*);
	
	void CollideMString(int y, int yinc, int xdir, int ydir, const char *str[], int frame);

	void DrawSmallPin(int x, int y, bool bInv);

	// tutorial Dialog box, position; tutorial string; left/right style dialog; if have several page
	void TutDialog(int x, int y, char *, int lr, int bAnim);

	// load resource
	void LoadRes(CEngine *pEngine);

	//TYPE: 0, LEFT BOTTOM BUTTON, 1, RIGHT BOTTOM, 2, IN GAME MENU
	void DrawButton(int type, const char *str);
	void DrawPowerBar(int, int, bool bflash=false);
	void StartPowerFire() { m_iPowerBarFlashCpt = -1;};

	// aim direction, offset/base
	void DrawDirection(const CGraphics3D *, int, int);
	void DrawBottle(int, int, int aimpinid, int aimpos, int aimdir);
	void DrawAllScoreBoard(const int maxRound,const ScoreInfo *pScore, int y, const char* name, bool isDraw);

	// draw +A*B !!! , A; B
	void DrawBonus(const int, const int, int = 3);

	// background in menu
	void DrawMenuBg(int);

	// gameloft logo :)
	void DrawGameloft();

	// player hand
	void DrawHand(int playerid, int x, int y);

	// Startx; Starty; String; Align: 0 left, 1 mid, 2 right; 0: red, 1: blue; 0: no left/right arrow; 1: o/w; max string length in pixel
	void DrawMenuString(int x, int y, const char *, int align = 0, int color = 1, int arrow = 0, int maxLength = SCREEN_WIDTH);
	int MStrLen(const char *) const;
	void RollingString(int x, int y, const char *, int color = 1);
	// Playerid; PlayerName; String; bKeyPressed;
	int StoryString(int, const char *, const char *, int);

	// Startx; Starty; String; Align: 0 for left, 1 for middle, 2 for right;
	void BigString(int, int, const char *, int = 0);
	int BStrLen(const char *) const;
	void BigString2(int, int, const char *, int = 0, int = -1);
	int BStr2Len(const char *) const;
	// x; y; num; size;
	void BigNum(int, int, int, int);

	// mainmenu effect: y, selection, item count, anim seed
	void MainMenuAnim(int, int, int, int);

	// Question Mark, x; y
	void QMark(int, int);

	// draw ball buffer to scr, buffer; offset: x, y;
	void Ball2D(unsigned short *, int, int);

	// menuhead effect, CurSelected; Selection Anim; Arrow or not; CanSelect
	void DrawMenuHead(int, int = 0, int = 1, int enable = 1);

	// ID; x; y
	void PlayerHead(int, int = 2, int = 3);

	// interleaved red background: midy; height; bg anim seed; return anim end flag
	int UISplash(int, int = 15, int = -1);

	// Dest; destx, y; w, h; src; srcx, y; flag
	void DrawBmp2Buf(GFXBMP*, int, int, int, int, int, int = 0);

	// Selection; Midy; Offset;
	void LaneEffect(int, int, int);

	//should be call at initialize.
	void FirstInit(CGfx *pGfx, CFont *pFont);

	// y; sel; total items; anim seed
	void PauseBg(int, int, int, int);

	// left indicator
	void DrawLButton(int);

	// right indicator
	void DrawRButton(int);

	inline CGfx* GetGfx() {	return m_pGfx;	}

	// rotation indicator: rotation value
	void Rotation(int);

	// loading interface: selected lane
	void Loading(int);

	// x, y
	void MainMenuArrow(int, int);

	// char only for beating heart effect: char, x, y, size
	void BHChar(int, int, int, int);

	// tv screen effect for replay: camera id, control command, max frame, cur frame
	void TVScreen(int = 0, int = 0, int = 0, int = 0);

	// tv anim: anim id, anim frame
	int TVAnim(int, int);

	// display reputation screen after match: var for display, anim seed
	void RepResult(const struct MoneySys&, int&, int = 0, int = 0);

	// bet screen: min, max, cur, total
	void Bet(int, int, int, int);

	// bet result: money, min, total, anim seed, win(1)/lose(0)
	void BetResult(int, int, int, int, int = 0);

	// unlock screen: unlock type(1: player, 2: cloth, 0:ball), player/ball name, in reputation(1) or bet(0)
	void Unlock(int, const char*, int);

	void BonusScoreBoard(int y, int pinMode, int playerid, 
		int aimpinid, int aimpos, int aimdir, const char* p1name, int level, int game, int trytime, int pass);
	
	//Qiu Li, 2005/1/19
	bool DrawStringEffect(const char ** strings, int strCount, int *lineFormats, int cpt, int timeType);
	//Qiu Li end
	bool DrawVStringEffect(const char ** strings, int strCount, int y, int cpt, int space);

	// tutorial indicator anim: type (0: move; 1: power; 2: aim; 3: rotate)
	void DrawTutAction(int);

	// selection arrow: x, y
	void SelArrow(int, int);

private:
	int GetMenuCharModuleid(char) const;
	int GetB2CharModuleid(char) const;
	int DrawRoundScore(const int maxRound,int roundindex, const ScoreInfo *pScore, int x, int y, int curround);

	// load animation
	void LoadAnimations(CEngine *pEngine);

	// rolling money: money, seed, return currently displayed money
	int RollMoney(int, int&);

	// store images
	GFXBMP * m_Images[MAX_IMAGECOUNT];
	GFXBMP * m_Icon[ICON_COUNT];

	CEngine* m_pEngine;
	CGfx *m_pGfx;
	CFont *m_pFont;
	
	//variables for 2d animation
	CAnimation *m_pAnim;
	int m_AnimCount;
	GFXBMP **m_pAnimImage;
	int m_aImageCount;
	char (*m_AnimString)[30];
	int m_arrAni;

	// var for storystring func
	const char *m_strStory;
	unsigned int m_iStoryStart;
	unsigned int m_iStoryCur;
	int m_iStoryFull;
	int m_iStoryWait;

	// var for rollingstr func
	const char *m_strRolling;

	int m_resultAnim;
	int m_lastresult;
	int m_angle;
	int m_rollinganim;
	int m_iPowerBarFlashCpt;

	// var for tutorial dialog
	const char *m_tutString;
	int m_tutFrame;

	int curLine;
	int curLine_deltacpt;
	int m_rotframe;
};

#endif // !defined(AFX_UI_H__D3AE5369_D977_4C3B_AC9F_EB1441FE18E6__INCLUDED_)

⌨️ 快捷键说明

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