//board.h
#ifndef __BOARD_H__
#define __BOARD_H__
#include "SexyAppFramework/Widget.h"
class Graphics;
class GameApp;
class Board : public Widget
{
GameApp* mApp;
int mPulseAmt; // 一个在每次Update()时波动的值. 用于在Draw()时构造变化的颜色.
bool mIncPulse; // 用来控制前边的 mPulseAmt 变大还是变小.
public:
Board(GameApp* theApp){
mApp = theApp;
mPulseAmt = 255;
mIncPulse = false;
}
virtual ~Board(){}
virtual void Draw(Graphics* g);
virtual void Update();
};
#endif // __BOARD_H__
//gameapp.h
#ifndef __GAMEAPP_H__
#define __GAMEAPP_H__
#include "SexyAppFramework/SexyAppBase.h"
class Board;
//图像和字体的类
class ImageFont;
class Image;
class GameApp : public SexyAppBase
{
Board* mBoard;
public:
// 资源
ImageFont* mTextFont;
ImageFont* mNumberFont;
Image* mOpaqueBeamImg;
Image* mMoonImg;
Image* mTurbotImg;
public:
GameApp();
virtual ~GameApp();
virtual void Init();
virtual void LoadingThreadProc();
virtual void LoadingThreadCompleted();
};
#endif // __GAMEAPP_H__
//board.cpp
#include "Board.h"
#include "GameApp.h"
#include "SexyAppFramework/Graphics.h"
// See the Draw method for more information on using the Color class.
#include "SexyAppFramework/Color.h"
// Why are we including ImageFont.h and not Font.h? Font.h is just a generic
// base class. ImageFont creates fonts from an image that contains all the
// text characters as well as a text file that indicates character widths
// and kerning information, as well as some more advanced features not used
// in this tutorial such as font layers, etc.
#include "SexyAppFramework/ImageFont.h"
// The Image.h file just declares basic functions. All images are either of
// the DDImage or MemoryImage type. For this demo, we will use DDImage
// types, as they are the type returned by the image loading code.
// A DDImage is actually derived from MemoryImage, so where an Image or
// MemoryImage is required, a DDImage will suffice as well. A DDImage
// contains optimized code for use with DirectX 7+.
#include "SexyAppFramework/DDImage.h"
// The Rectangle template, used to specify X, Y, Width, Height
#include "SexyA
popcap sexyframework - Demo2 图像 声音 字体 窗体部件 按钮 事件 监听器
最新推荐文章于 2017-02-27 01:31:16 发布