private int CharWidth(byte ch) { if (ch < ' ') { ch = 64; } return(_resMan.ReadUInt16(new FrameHeader(_resMan.FetchFrame(_font, (uint)(ch - ' '))).width)); }
public Text(ObjectMan objMan, ResMan resMan, bool czechVersion) { _objMan = objMan; _resMan = resMan; _textCount = 0; _fontId = (uint)(czechVersion ? SwordRes.CZECH_GAME_FONT : SwordRes.GAME_FONT); _font = _resMan.OpenFetchRes(_fontId); _joinWidth = (ushort)(CharWidth((byte)' ') - 2 * Overlap); _charHeight = _resMan.ReadUInt16(new FrameHeader(_resMan.FetchFrame(_font, 0)).height); // all chars have the same height }
public ControlButton(ushort x, ushort y, uint resId, ButtonIds id, byte flag, ResMan pResMan, byte[] screenBuf, ISystem system) { _x = x; _y = y; _id = id; _flag = flag; _resId = resId; _resMan = pResMan; _frameIdx = 0; _resMan.ResOpen(_resId); FrameHeader tmp = new FrameHeader(_resMan.FetchFrame(_resMan.FetchRes(_resId), 0)); _width = _resMan.ReadUInt16(tmp.width); _width = (ushort)((_width > Screen.SCREEN_WIDTH) ? Screen.SCREEN_WIDTH : _width); _height = _resMan.ReadUInt16(tmp.height); if ((x == 0) && (y == 0)) { // center the frame (used for panels); _x = (ushort)((((640 - _width) / 2) < 0) ? 0 : ((640 - _width) / 2)); _y = (ushort)((((480 - _height) / 2) < 0) ? 0 : ((480 - _height) / 2)); } _dstBuf = new ByteAccess(screenBuf, _y * Screen.SCREEN_WIDTH + _x); _system = system; }