sspritefactory.h

来自「用VC++及DirectX实现的SuperMario小游戏」· C头文件 代码 · 共 40 行

H
40
字号
/*
Author: Bear

This source is free to anybody.
If you have any problem with this or some advice to me, please:
    mailto: heyang22118952.student@sina.com
        or  yang45249.student@sina.com
or you can contact me through my QQ:     261570581

Welcome to discuss game programming techniques with me :)
And I like to play games!
*/
#pragma once

#include "SuperMarioDemo.h"
#include "SSprite.h"
#include <string>

class SSpriteFactory
{
public:
	SSpriteFactory(void);
	~SSpriteFactory(void);
	bool Load(BDirectDraw* pdd, BBitmap* pBitmap, const char* spriteFileName);
	void UnLoad(void);
	SSprite* Create(const char* spriteName, int posX, int posY);
	bool DrawSprites(BDirectDrawSurface* pDest, int startX, int startY, float scale = 1);
	BDirectDrawSurface* GetSurface(int index);
	SSprite* Create(int index, int posX, int posY);
private:
	bool loaded;
	std::string name[SPRITE_KINDS];
	int type[SPRITE_KINDS], width[SPRITE_KINDS], height[SPRITE_KINDS],
		speedX[SPRITE_KINDS], speedY[SPRITE_KINDS],
		row[SPRITE_KINDS], colStart[SPRITE_KINDS], colEnd[SPRITE_KINDS];
	std::string animSeq[SPRITE_KINDS];
	int nKinds;
	BDirectDrawSurface* ppSurfaces[SPRITE_KINDS][MAX_FRAME_NUM];
};

⌨️ 快捷键说明

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