popcap sexyframework - Demo2 图像 声音 字体 窗体部件 按钮 事件 监听器

//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
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值