📄 rstatus.h
字号:
// Copyright 2002 Kenneth Guy,
//
// RStatus.h
#ifndef _RSTATUS_H_
#define _RSTATUS_H_
/** \file RStatus.h
defines class RStatus */
#include <e32std.h>
#include "RScreenUtils.h"
/** Status pane.
This class handles drawing and updating the status pane, which contains
the number of lives, health, and score the player has.
Draw() will cause the whole status pane to be rendered, Update() will
only render what has changed since the last Draw()/Update(). If Update()
is called and no previous Draw()/Update() has occured the whole pane
will be rendered.
The status area is defined by the status section of the level file. This
is a series of TUint16s these are:
first background sprites to be drawn when pane is first rendered:
1,offset to sprite,x size, ysize, x pos, ypos
....
this list is terminated with a 0xffff
then the health status area:
health sprite offset, sprite x size, sprite y size, background color,
then a list of locations to draw the sprite
x,y,
x,y,
...
terminated with 0xffff
if the players health level is one then only the first location will be
filled, two the first and second locations, etc. If the players health
is greater that the number of locations then all locations are filled.
then there is the lives status area, this is the same format as the
health status area.
then there is the location to draw the players score
xpos, ypox, foreground color, background color.
then there is an alignment TInt16 if it is required to align to
a 32 bit word boundary.
finally there is sprite data refered to by the offsets above. Sprite
offsets are all from the start of the status data.
*/
class RStatus {
public:
RStatus();
TInt Open(const TUint16 *aStatusData);
void Close();
void Update(TInt aScore, TInt aLives, TInt aHealth);
void Draw(TInt aScore, TInt aLives, TInt aHealth);
private:
void UpdateSingle(TInt &aOffset,TInt &aSaved, TInt aNew);
private:
RScreenUtils iScreen; ///< Utilities for drawing to screen memory
TInt iSavedScore; ///< Last score that was plotted
TInt iSavedLives; ///< Number of lives last time status was updated
TInt iSavedHealth; ///< Number of health last time status was updated
const TUint16 *iStatusData; ///<Status data, see class description
};
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -