資源簡介
基于DirectX11和xna數學庫開發的游戲引擎框架,因需要積分,所以含淚共享
代碼片段和文件信息
#include?“stdafx.h“
#include?
const?int?g_WindowWidth?=?800;
const?int?g_WindowHeight?=?600;
float?fRad?=?0.0f;
const?float?fSpeed?=?0.0003f;
struct?SpriteInfos
{
int?UpKeyDownStartframe;
int?UpKeyDownEndframe;
int?DownKeyDownStartframe;
int?DownKeyDownEndframe;
int?LeftKeyDownStartframe;
int?LeftKeyDownEndframe;
int?RightKeyDownStartframe;
int?RightKeyDownEndframe;
};
class?cD3DSampleApp?:?public?CApplication?public?iKeyboardReceiver?public?iMouseReceiver?public?iXInputReceiver
{
protected:
CbaseframeSprite*?m_pSprite;
Cbase2DCamera*?m_p2DCamera;
SpriteInfos?m_Spriteframe;
public:
cD3DSampleApp()?:
CApplication()
{
m_width?=?g_WindowWidth;
m_height?=?g_WindowHeight;
m_title?=?L“Jay?Yea?Engine“;
m_pSprite?=?new?CbaseframeSprite();
m_p2DCamera?=?new?Cbase2DCamera();
}
~cD3DSampleApp()
{
delete?m_pSprite;
delete?m_p2DCamera;
}
// 場景初始化
virtual?void?OnSceneInit();
// 場景結束銷毀數據
virtual?void?OnSceneEnd();
// 更新場景接口
virtual?void?OnUpdate(float?delay);
// 繪制場景接口
virtual?void?OnPresent();
// 閑置畫面接口
virtual?void?OnIdleUpdate(float?timeDelta);
// 閑置畫面接口
virtual?void?OnIdlePresent();
// 鍵盤按鍵保持
virtual?void?onkeypress(int?key);
// 鍵盤按鍵按下
virtual?void?onkeydown(int?key);
// 鍵盤按鍵釋放
virtual?void?onkeyup(int?key);
// 鼠標按下
virtual?void?OnMouseButtonDown(char?button);
// 鼠標按鍵保持
virtual?void?OnMouseButtonKeep(char?button);
// 鼠標按鍵釋放
virtual?void?OnMouseButtonUp(char?button);
// 鼠標移動事件
virtual?void?onmousemoved(int?dx?int?dy);
// 鼠標中間滾輪值改變
virtual?void?onmousewheelLenth(long?mouseWheelLenth);
// XBOX360設備按鍵信息發生變化
virtual?void?OnXInputKeyChange();
};
CApplication*?CreateApplication()
{
return?new?cD3DSampleApp();
}
void?DestroyApplication(CApplication*?pApp)
{
delete?pApp;
}
void?cD3DSampleApp::OnSceneInit()
{
ChangeWindowFactor();
Input()->GetKeyboard()->SetReceiver(this);
Input()->GetMouse()->SetReceiver(this);
if?(Input()->GetXInput())
{
Input()->GetXInput()->SetReceiver(this);
}
Graphics()->InitDefaultShader();
m_Spriteframe.DownKeyDownStartframe?=?0;
m_Spriteframe.DownKeyDownEndframe?=?3;
m_Spriteframe.LeftKeyDownStartframe?=?4;
m_Spriteframe.LeftKeyDownEndframe?=?7;
m_Spriteframe.RightKeyDownStartframe?=?8;
m_Spriteframe.RightKeyDownEndframe?=?11;
m_Spriteframe.UpKeyDownStartframe?=?12;
m_Spriteframe.UpKeyDownEndframe?=?15;
GetGameFontSystem()->ChangeDrawText(L“Jay?Engine“?1.0f?0.0f?XMFLOAT4(0.0f?1.0f?1.0f?1.0f));
m_pSprite->LoadTextureFromFile(L“04_G.png“);
m_pSprite->SetSize(32.0f?48.0f);
m_pSprite->InitUVframeSize(32.0f?48.0f);
m_pSprite->SetSpriteListAnimationData(4?4?0?3?1?0.25f);
m_pSprite->UpdateScaling(1.0f?1.0f);
m_pSprite->UpdatePosition(200.0f?100.0f);
m_p2DCamera->Init();
m_pSprite->Regist2DCamera(m_p2DCamera);
m_pSprite->Init();
}
void?cD3DSampleApp::OnScen
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????5005??2013-11-15?10:03??EngineSystem\03.png
?????文件???????5827??2013-11-15?10:03??EngineSystem\04_G.png
?????文件?????165376??2018-09-17?20:54??EngineSystem\Bin\Debug\x86\EngineSystem.exe
?????文件????4123648??2018-09-17?20:54??EngineSystem\Bin\Debug\x86\EngineSystem.pdb
?????文件???????2812??2018-08-29?16:32??EngineSystem\Bin\Debug\x86tlog\EngineSystem.Build.CppClean.log
?????文件???28442624??2018-09-17?20:54??EngineSystem\Bin\Debug\x86tlog\EngineSystem.pch
?????文件???????3356??2018-08-29?16:32??EngineSystem\Bin\Debug\x86tlog\EngineSystem.res
?????文件????????760??2018-09-17?20:54??EngineSystem\Bin\Debug\x86tlog\EngineSystem.tlog\cl.command.1.tlog
?????文件??????37510??2018-09-17?20:54??EngineSystem\Bin\Debug\x86tlog\EngineSystem.tlog\CL.read.1.tlog
?????文件????????648??2018-09-17?20:54??EngineSystem\Bin\Debug\x86tlog\EngineSystem.tlog\CL.write.1.tlog
?????文件????????198??2018-09-17?20:54??EngineSystem\Bin\Debug\x86tlog\EngineSystem.tlog\EngineSystem.lastbuildstate
?????文件???????2578??2018-09-17?20:54??EngineSystem\Bin\Debug\x86tlog\EngineSystem.tlog\EngineSystem.write.1u.tlog
?????文件????????808??2018-08-29?16:32??EngineSystem\Bin\Debug\x86tlog\EngineSystem.tlog\FXC.command.1.tlog
?????文件????????700??2018-08-29?16:32??EngineSystem\Bin\Debug\x86tlog\EngineSystem.tlog\fxc.read.1.tlog
?????文件????????522??2018-08-29?16:32??EngineSystem\Bin\Debug\x86tlog\EngineSystem.tlog\fxc.write.1.tlog
?????文件???????1296??2018-09-17?20:54??EngineSystem\Bin\Debug\x86tlog\EngineSystem.tlog\li
?????文件???????5620??2018-09-17?20:54??EngineSystem\Bin\Debug\x86tlog\EngineSystem.tlog\li
?????文件????????562??2018-09-17?20:54??EngineSystem\Bin\Debug\x86tlog\EngineSystem.tlog\li
?????文件????????500??2018-08-29?16:32??EngineSystem\Bin\Debug\x86tlog\EngineSystem.tlog\rc.command.1.tlog
?????文件???????2302??2018-08-29?16:32??EngineSystem\Bin\Debug\x86tlog\EngineSystem.tlog\rc.read.1.tlog
?????文件????????262??2018-08-29?16:32??EngineSystem\Bin\Debug\x86tlog\EngineSystem.tlog\rc.write.1.tlog
?????文件????1025392??2018-09-17?20:54??EngineSystem\Bin\Debug\x86tlog\main.obj
?????文件????1043456??2018-09-17?20:54??EngineSystem\Bin\Debug\x86tlog\vc120.idb
?????文件????2510848??2018-09-17?20:54??EngineSystem\Bin\Debug\x86tlog\vc120.pdb
?????文件???????1947??2018-09-17?20:54??EngineSystem\Bin\Debug\x86tlog\窗口化測試程序.log
?????文件???????2572??2018-08-29?16:31??EngineSystem\Bin\Release\x86\DefaultPixelShader.cso
?????文件???????1028??2018-08-29?16:31??EngineSystem\Bin\Release\x86\DefaultVertexShader.cso
?????文件?????227840??2018-08-29?16:31??EngineSystem\Bin\Release\x86\EngineSystem.exe
?????文件????4795392??2018-08-29?16:31??EngineSystem\Bin\Release\x86\EngineSystem.pdb
?????文件???????2777??2018-08-29?16:31??EngineSystem\Bin\Release\x86tlog\EngineSystem.Build.CppClean.log
............此處省略226個文件信息
評論
共有 條評論