HGE引擎棋牌游戏简单例子

  • s2_325823
    了解作者
  • 3.8MB
    文件大小
  • zip
    文件格式
  • 0
    收藏次数
  • VIP专享
    资源类型
  • 0
    下载次数
  • 2022-04-15 06:07
    上传日期
用HGE游戏引擎制作的棋牌游戏发牌动画,包括点击牌提起,拖动选牌,自定义的按钮等。想制作游戏的可以参考此例。
PokeGame.zip
  • PokeGame
  • Debug
  • res
  • hgeDllLoad.rc2
    366B
  • pokeBack.png
    6.6KB
  • poke.png
    223.6KB
  • bg.bmp
    2.3MB
  • hgeDllLoad.ico
    21.1KB
  • ok.png
    10.1KB
  • hgeDllLoad.manifest
    699B
  • PokeGame.dll
    276KB
  • hgeDllLoad.exe
    144KB
  • PokeGame.lib
    1.7KB
  • GameView.obj
    36.7KB
  • PokeGame.pdb
    851KB
  • BuildLog.htm
    2.5KB
  • PokeGuiObj.obj
    133.1KB
  • GameButton.obj
    19.3KB
  • hge.dll
    162.5KB
  • PokeGame.exp
    642B
  • font1.fnt
    2.5KB
  • font1.png
    9.9KB
  • YhLordServer.dll
    60KB
  • font2.fnt
    3.6KB
  • PokeGame.ilk
    730.6KB
  • font2.png
    2.1KB
  • vc70.pdb
    132KB
  • vc70.idb
    427KB
  • bass.dll
    91.1KB
  • PokeGame.obj
    10.1KB
  • res
  • pokeBack.png
    6.6KB
  • poke.png
    223.6KB
  • bg.bmp
    2.3MB
  • ok.png
    10.1KB
  • PokeGuiObj.h
    1.5KB
  • PokeGame.h
    180B
  • GameButton.cpp
    228B
  • PokeGame.vcproj
    4KB
  • GameButton.h
    305B
  • PokeGame.def
    43B
  • PokeGame.suo
    13KB
  • PokeGame.ncb
    131KB
  • GameView.h
    198B
  • PokeGame.cpp
    164B
  • PokeGame.sln
    905B
  • GameView.cpp
    6.4KB
  • PokeGuiObj.cpp
    3.5KB
内容介绍
#include ".\gameview.h" #include "PokeGuiObj.h" #include "..\include\hgefont.h" #define POKE_ANIMATE_COUNT 3 #define POKE_HAND_COUNT 17 #define IDBTNOK 1 #define IDBTNTIP 2 #define IDBTNPASS 3 #define IDBTNRESET 4 #define SCREEN_WIDTH 1024 #define SCREEN_HEIGHT 768 CPokeGuiObj * m_pGuiObj; hgeFont * m_font; HGE * m_phge; hgeGUI * m_gui; hgeSprite * m_pBgSpr; // 背景 hgeSprite * m_pPokeBackSpr; // 牌背面 hgeSprite * m_pPokeSpr; // 牌正面 int m_cardIndex; // 当前牌索引 PokeSprite * m_pCardArr; // 牌数组 HTEXTURE m_bgTex; // HTEXTURE m_PokeBackTex; // HTEXTURE m_PokeTex; // HTEXTURE m_okTex; // 开始 bool m_bPlay; // 是否播放发牌动画 void GetPokerTexturePos( float &tx,float &ty,const BYTE bCard ) { int width = 76; int height = 100; BYTE bValue = bCard & 0x0F; BYTE bColor = bCard & 0xF0; tx = (float)(bValue - 1) * width; switch(bColor) { case 16: { ty = 0.0f; break; } case 32: { ty = (float)height; break; } case 48: { ty = (float) 2 * height; break; } case 64: { ty = (float) 3 * height; break; } default: { int a = 10; break; } } } void DoPokeAnimate() { } void InitAnimateParam() { int width = m_phge->Texture_GetWidth(m_PokeTex)/13; int height = m_phge->Texture_GetHeight(m_PokeTex)/4; float x = 350.0f; float y = 150.0f; for (int i = 0; i < 52; i++) { m_pCardArr[i].cardValue = Card[i]; GetPokerTexturePos(m_pCardArr[i].tx,m_pCardArr[i].ty,Card[i]); m_pCardArr[i].x = x; m_pCardArr[i].y = y; x +=2.0f; m_pCardArr[i].dx = 1000.0f; m_pCardArr[i].dy = 1000.0f; m_pCardArr[i].rot = 0.0f; m_pCardArr[i].w = (float)76; m_pCardArr[i].h = (float)100; } } void RenderCard() { if (!m_bPlay) { return; } if (m_cardIndex + POKE_ANIMATE_COUNT > 51) { return; } float x = 350.0f; float y = 150.0f; // 牌堆 for (int i = 0; i < 52 - m_cardIndex - 1;i++) { m_pPokeBackSpr->Render(x,y); x += 2; } // 飞的 for (int i = 0;i < POKE_ANIMATE_COUNT;i++) { m_pPokeSpr->SetTextureRect(m_pCardArr[m_cardIndex + i].tx,m_pCardArr[m_cardIndex + i].ty, m_pCardArr[m_cardIndex + i].w,m_pCardArr[m_cardIndex + i].h); m_pPokeSpr->RenderEx(m_pCardArr[m_cardIndex + i].x,m_pCardArr[m_cardIndex + i].y, m_pCardArr[m_cardIndex + i].rot); } // 手中的 for (int i = 0; i < m_cardIndex ;i++) { m_pPokeSpr->SetTextureRect(m_pCardArr[i].tx,m_pCardArr[i].ty,m_pCardArr[i].w,m_pCardArr[i].h); m_pPokeSpr->RenderEx(m_pCardArr[i].x,m_pCardArr[i].y,m_pCardArr[i].rot); } } void StartPlay() { if (m_bPlay) { return; } InitAnimateParam(); m_bPlay = true; m_cardIndex = 0; } bool RenderFunc() { m_phge->Gfx_BeginScene(); m_pBgSpr->Render(0,0); m_gui->Render(); RenderCard(); m_font->printf(200, 20, HGETEXT_LEFT, "dt:%.3f\nFPS:%d", m_phge->Timer_GetDelta(), m_phge->Timer_GetFPS()); m_phge->Gfx_EndScene(); return false; } bool FrameFunc() { float dt = m_phge->Timer_GetDelta(); int id = m_gui->Update(dt); if (m_bPlay) { bool bf = false; for (int i = 0; i < POKE_ANIMATE_COUNT; i++) { switch(i) { case 0: { m_pCardArr[m_cardIndex + i].x -= m_pCardArr[m_cardIndex + i].dx*dt; m_pCardArr[m_cardIndex + i].y += m_pCardArr[m_cardIndex + i].dy*dt; break; } case 1: { m_pCardArr[m_cardIndex + i].x += m_pCardArr[m_cardIndex + i].dx*dt; m_pCardArr[m_cardIndex + i].y += m_pCardArr[m_cardIndex + i].dy*dt; break; } case 2: { //m_pCardArr[m_cardIndex + i].x += m_pCardArr[m_cardIndex + i].dx*dt; m_pCardArr[m_cardIndex + i].y += m_pCardArr[m_cardIndex + i].dy*dt; if (m_pCardArr[m_cardIndex + i].y > 600.0f) { bf = true; m_pGuiObj->AddOneCard(m_pCardArr[m_cardIndex + i]); } break; } } } if (bf) { m_cardIndex += 3; if (m_cardIndex >= 53) { m_cardIndex = 0; m_bPlay = false; } } } return false; } CGameView::CGameView(void) { m_cardIndex = 0; m_phge = hgeCreate(HGE_VERSION); m_phge->System_SetState(HGE_FRAMEFUNC,FrameFunc); m_phge->System_SetState(HGE_RENDERFUNC,RenderFunc); //m_phge->System_SetState(HGE_TITLE,"斗地主游戏(HGE引擎设计)"); m_phge->System_SetState(HGE_USESOUND, false); m_phge->System_SetState(HGE_WINDOWED, true); m_phge->System_SetState(HGE_SCREENWIDTH, SCREEN_WIDTH); m_phge->System_SetState(HGE_SCREENHEIGHT, SCREEN_HEIGHT); m_phge->System_SetState(HGE_SCREENBPP, 32); m_phge->System_SetState(HGE_SHOWSPLASH,false); m_phge->System_SetState(HGE_HIDEMOUSE,false); if (m_phge->System_Initiate()) { m_bgTex = m_phge->Texture_Load("res\\bg.bmp"); m_PokeBackTex = m_phge->Texture_Load("res\\pokeBack.png"); m_PokeTex = m_phge->Texture_Load("res\\poke.png"); m_okTex = m_phge->Texture_Load("res\\ok.png"); // 构造运动对象 int width = m_phge->Texture_GetWidth(m_bgTex); int height = m_phge->Texture_GetHeight(m_bgTex); m_pBgSpr = new hgeSprite(m_bgTex,0,0,1024,768); //m_pBgSpr->SetBlendMode(BLEND_ALPHAADD|BLEND_COLORMUL|BLEND_ZWRITE); width = m_phge->Texture_GetWidth(m_PokeBackTex); height = m_phge->Texture_GetHeight(m_PokeBackTex); m_pPokeBackSpr = new hgeSprite(m_PokeBackTex,0,0,60,80); //m_pPokeBackSpr->SetBlendMode(BLEND_ALPHAADD|BLEND_COLORMUL|BLEND_ZWRITE); width = m_phge->Texture_GetWidth(m_PokeTex); height = m_phge->Texture_GetHeight(m_PokeTex); m_pPokeSpr = new hgeSprite(m_PokeTex,0,0,76,100); m_pPokeSpr->SetHotSpot(38,50); //m_pPokeSpr->SetBlendMode(BLEND_ALPHAADD|BLEND_COLORMUL|BLEND_ZWRITE); m_pCardArr = new PokeSprite[52];// 54张牌 m_gui = new hgeGUI(); m_font = new hgeFont("font1.fnt"); m_font->SetBlendMode(BLEND_ALPHAADD|BLEND_COLORMUL); m_pGuiObj = new CPokeGuiObj(m_pPokeSpr,0.0f,0.0f); m_gui->AddCtrl(m_pGuiObj); m_gui->AddCtrl(new hgeGUIButton(0,100.0f,500.0f,94,34,m_okTex,0,0)); InitAnimateParam(); m_bPlay = true; m_gui->SetFocus(1); m_gui->Enter(); m_phge->System_Start(); delete [] m_pCardArr; delete m_pBgSpr; delete m_pPokeBackSpr; delete m_pPokeSpr; delete m_gui; delete m_font; m_phge->Texture_Free(m_bgTex); m_phge->Texture_Free(m_PokeBackTex); m_phge->Texture_Free(m_PokeTex); m_phge->Texture_Free(m_okTex); } } CGameView::~CGameView(void) { }
评论
    相关推荐
    • 游戏引擎架构
      这个是带完整目录书签的文字版本,文本内容可以复制的哦
    • AnimGroup:动漫游戏引擎动画组库
      小型游戏引擎动画库取决于可以制作动画组,包括顺序和并行动画组,并在指定的秒数内插入暂停并在动画组内调用函数,或在特定时间循环动画。 用法 只需将放到您的Löve项目中,然后要求它即可。 基本补间动画 local...
    • 游戏引擎
      OpenGL前向渲染器。 经过Zig 0.6.0测试 ...ModelFiles:从自定义文件格式加载模型和动画 RTRenderEngine:场景的实时渲染。 取决于:WindowGraphicsInput,数学,ModelFiles,Assets,Files.zig,R
    • rokon游戏引擎API
      rokon游戏引擎 类与方法介绍 游戏引擎开发步骤
    • ngc游戏引擎 2D
      ngc游戏引擎,支持中文,button,edit,list,tab... TILE地图,内含动画编辑器,地图编辑器,纹理打包
    • 游戏引擎剖析
      游戏引擎剖析 还不错 收录网站的
    • 3D 游戏 引擎
      一个开源3D游戏引擎 画面渲染很牛逼动画管理还不是很完善你自己可以改造下 里面有好多技术范例
    • 游戏引擎架构文档
      本文件包含2个文档 主要描述了游戏引擎的架构以及引擎的快速入门
    • HGE游戏引擎动画效果展示
      使用HGE引擎写的一个田园风景动画展示例子,需要的可以下来看看。
    • GaussDB_100_1.0.1-DATABASE-REDHAT-64bit.tar.gz
      guassdb100在redhat上安装包,单机部署的包,安装步骤请看我的文中介绍,经过大量实验搭建总结出来的文档