⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 block.cpp

📁 使用symbian的s60实现的小游戏俄罗斯方块(第而步)
💻 CPP
字号:
#include "block.h"
#include <e32math.h>

const int numBlocks=7;
const TUint16 bl_types[4][numBlocks]=
//  ####     ###      ###     ##     ##      ##      ###
//             #      #      ##       ##     ##       #
  {{0x4444, 0x0e20, 0x0740, 0x06c0, 0x0c60, 0x6600, 0xe400},
   {0x0f00, 0x0644, 0x4460, 0x4620, 0x2640, 0x6600, 0x8c80},
   {0x4444, 0x0470, 0x02e0, 0x06c0, 0x0c60, 0x6600, 0x04e0},
   {0x0f00, 0x2260, 0x0622, 0x4620, 0x2640, 0x6600, 0x2620},
  };

int TBlock::BlockCount()
{
  return numBlocks;
}

TBlock TBlock::Block(int id)
{
  return TBlock(id, 0);
}

TBlock TBlock::RandomBlock(TInt64 &seed)
{
  return Block(Math::Rand(seed)%numBlocks);
}

void TBlock::Rotate(int dir)
{
  if (dir>0) iRot++;
  if (dir<0) iRot+=3;
  iRot%=4;
}

TInt8 TBlock::RowMask(int nr) const
{
  return (bl_types[iRot][iType]>>(4*nr))&0xf;
}

TInt8 TBlock::Color() const
{
  return iType+1;
}

⌨️ 快捷键说明

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