mirror of
https://github.com/borgesdan/xn65
synced 2024-12-29 21:54:47 +01:00
Aplica modificações antes de push para github
This commit is contained in:
parent
e5177cd8e3
commit
c06de0cf79
@ -6,85 +6,84 @@
|
|||||||
namespace xna {
|
namespace xna {
|
||||||
//Framework
|
//Framework
|
||||||
class BoundingBox;
|
class BoundingBox;
|
||||||
|
using PBoundingBox = std::shared_ptr<BoundingBox>;
|
||||||
class BoundingFrustum;
|
class BoundingFrustum;
|
||||||
|
using PBoundingFrustum = std::shared_ptr<BoundingFrustum>;
|
||||||
class BoundinSphere;
|
class BoundinSphere;
|
||||||
|
using PBoundinSphere = std::shared_ptr<BoundinSphere>;
|
||||||
struct Color;
|
struct Color;
|
||||||
|
using PColor = std::shared_ptr<Color>;
|
||||||
class Curve;
|
class Curve;
|
||||||
|
using PCurve = std::shared_ptr<Curve>;
|
||||||
class CurveContinuity;
|
class CurveContinuity;
|
||||||
|
using PCurveContinuity = std::shared_ptr<CurveContinuity>;
|
||||||
class CurveKey;
|
class CurveKey;
|
||||||
|
using PCurveKey = std::shared_ptr<CurveKey>;
|
||||||
class CurveKeyCollection;
|
class CurveKeyCollection;
|
||||||
|
using PCurveKeyCollection = std::shared_ptr<CurveKeyCollection>;
|
||||||
struct Matrix;
|
struct Matrix;
|
||||||
|
using PMatrix = std::shared_ptr<Matrix>;
|
||||||
class Plane;
|
class Plane;
|
||||||
|
using PPlane = std::shared_ptr<Plane>;
|
||||||
struct Point;
|
struct Point;
|
||||||
|
using PPoint = std::shared_ptr<Point>;
|
||||||
class Quaternion;
|
class Quaternion;
|
||||||
|
using PQuaternion = std::shared_ptr<Quaternion>;
|
||||||
class Ray;
|
class Ray;
|
||||||
|
using PRay = std::shared_ptr<Ray>;
|
||||||
struct Rectangle;
|
struct Rectangle;
|
||||||
|
using PRectangle = std::shared_ptr<Rectangle>;
|
||||||
struct Vector2;
|
struct Vector2;
|
||||||
|
using PVector2 = std::shared_ptr<Vector2>;
|
||||||
struct Vector3;
|
struct Vector3;
|
||||||
|
using PVector3 = std::shared_ptr<Vector3>;
|
||||||
struct Vector4;
|
struct Vector4;
|
||||||
|
using PVector4 = std::shared_ptr<Vector4>;
|
||||||
|
|
||||||
|
|
||||||
//Game
|
//Game
|
||||||
class DrawableGameComponent;
|
class DrawableGameComponent;
|
||||||
|
using PDrawableGameComponent = std::shared_ptr<DrawableGameComponent>;
|
||||||
class Game;
|
class Game;
|
||||||
|
using PGame = std::shared_ptr<Game>;
|
||||||
class GameComponent;
|
class GameComponent;
|
||||||
|
using PGameComponent = std::shared_ptr<GameComponent>;
|
||||||
class GameComponentCollection;
|
class GameComponentCollection;
|
||||||
|
using PGameComponentCollection = std::shared_ptr<GameComponentCollection>;
|
||||||
class GameClock;
|
class GameClock;
|
||||||
|
using PGameClock = std::shared_ptr<GameClock>;
|
||||||
class GameTime;
|
class GameTime;
|
||||||
|
using PGameTime = std::shared_ptr<GameTime>;
|
||||||
class GameWindow;
|
class GameWindow;
|
||||||
|
using PGameWindow = std::shared_ptr<GameWindow>;
|
||||||
class IDrawable;
|
class IDrawable;
|
||||||
|
using PIDrawable = std::shared_ptr<IDrawable>;
|
||||||
class IGameComponent;
|
class IGameComponent;
|
||||||
|
using PIGameComponent = std::shared_ptr<IGameComponent>;
|
||||||
class IUpdatable;
|
class IUpdatable;
|
||||||
|
using PIUpdatable = std::shared_ptr<IUpdatable>;
|
||||||
|
|
||||||
//Graphics
|
//Graphics
|
||||||
class BlendState;
|
class BlendState;
|
||||||
|
using PBlendState = std::shared_ptr<BlendState>;
|
||||||
class DisplayMode;
|
class DisplayMode;
|
||||||
|
using PDisplayMode = std::shared_ptr<DisplayMode>;
|
||||||
class DisplayModeCollection;
|
class DisplayModeCollection;
|
||||||
|
using PDisplayModeCollection = std::shared_ptr<DisplayModeCollection>;
|
||||||
class GraphicsAdapter;
|
class GraphicsAdapter;
|
||||||
|
using PGraphicsAdapter = std::shared_ptr<GraphicsAdapter>;
|
||||||
class GraphicsDevice;
|
class GraphicsDevice;
|
||||||
|
using PGraphicsDevice = std::shared_ptr<GraphicsDevice>;
|
||||||
class RenderTarget2D;
|
class RenderTarget2D;
|
||||||
|
using PRenderTarget2D = std::shared_ptr<RenderTarget2D>;
|
||||||
class SwapChain;
|
class SwapChain;
|
||||||
|
using PSwapChain = std::shared_ptr<SwapChain>;
|
||||||
class Texture;
|
class Texture;
|
||||||
|
using PTexture = std::shared_ptr<Texture>;
|
||||||
class Texture2D;
|
class Texture2D;
|
||||||
|
using PTexture2D = std::shared_ptr<Texture2D>;
|
||||||
struct Viewport;
|
struct Viewport;
|
||||||
|
using PViewport = std::shared_ptr<Viewport>;
|
||||||
using PBoundingBox = std::shared_ptr<BoundingBox>;
|
|
||||||
using PBoundingFrustum = std::shared_ptr<BoundingFrustum>;
|
|
||||||
using PBoundinSphere = std::shared_ptr<BoundinSphere>;
|
|
||||||
using PColor = std::shared_ptr<Color>;
|
|
||||||
using PCurve = std::shared_ptr<Curve>;
|
|
||||||
using PCurveContinuity = std::shared_ptr<CurveContinuity>;
|
|
||||||
using PCurveKey = std::shared_ptr<CurveKey>;
|
|
||||||
using PCurveKeyCollection = std::shared_ptr<CurveKeyCollection>;
|
|
||||||
using PMatrix = std::shared_ptr<Matrix>;
|
|
||||||
using PPlane = std::shared_ptr<Plane>;
|
|
||||||
using PPoint = std::shared_ptr<Point>;
|
|
||||||
using PQuaternion = std::shared_ptr<Quaternion>;
|
|
||||||
using PRay = std::shared_ptr<Ray>;
|
|
||||||
using PRectangle = std::shared_ptr<Rectangle>;
|
|
||||||
using PVector2 = std::shared_ptr<Vector2>;
|
|
||||||
using PVector3 = std::shared_ptr<Vector3>;
|
|
||||||
using PVector4 = std::shared_ptr<Vector4>;
|
|
||||||
|
|
||||||
using PDrawableGameComponent = std::shared_ptr<DrawableGameComponent>;
|
|
||||||
using PGame = std::shared_ptr<Game>;
|
|
||||||
using PGameComponent = std::shared_ptr<GameComponent>;
|
|
||||||
using PGameComponentCollection = std::shared_ptr<GameComponentCollection>;
|
|
||||||
using PGameTime = std::shared_ptr<GameTime>;
|
|
||||||
using PGameWindow = std::shared_ptr<GameWindow>;
|
|
||||||
using PIDrawable = std::shared_ptr<IDrawable>;
|
|
||||||
using PIGameComponent = std::shared_ptr<IGameComponent>;
|
|
||||||
using PIUpdatable = std::shared_ptr<IUpdatable>;
|
|
||||||
|
|
||||||
using PBlendState = std::shared_ptr<BlendState>;
|
|
||||||
using PDisplayMode = std::shared_ptr<DisplayMode>;
|
|
||||||
using PDisplayModeCollection = std::shared_ptr<DisplayModeCollection>;
|
|
||||||
using PGraphicsAdapter = std::shared_ptr<GraphicsAdapter>;
|
|
||||||
using PGraphicsDevice = std::shared_ptr<GraphicsDevice>;
|
|
||||||
using PRenderTarget2D = std::shared_ptr<RenderTarget2D>;
|
|
||||||
using PSwapChain = std::shared_ptr<SwapChain>;
|
|
||||||
using PTexture = std::shared_ptr<Texture>;
|
|
||||||
using PTexture2D = std::shared_ptr<Texture2D>;
|
|
||||||
using PViewport = std::shared_ptr<Viewport>;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
@ -10,15 +10,21 @@ namespace xna {
|
|||||||
|
|
||||||
D3D11_BLEND_DESC blendDesc{};
|
D3D11_BLEND_DESC blendDesc{};
|
||||||
blendDesc.AlphaToCoverageEnable = AlphaToCoverage;
|
blendDesc.AlphaToCoverageEnable = AlphaToCoverage;
|
||||||
blendDesc.IndependentBlendEnable = IndependentBlendEnable;
|
blendDesc.IndependentBlendEnable = IndependentBlendEnable;
|
||||||
blendDesc.RenderTarget[0].BlendEnable = RenderTargets[0]->Enabled;
|
|
||||||
blendDesc.RenderTarget[0].SrcBlend = BlendMapper::ConvertBlend(RenderTargets[0]->Source);
|
for (size_t i = 0; i < 8; ++i) {
|
||||||
blendDesc.RenderTarget[0].DestBlend = BlendMapper::ConvertBlend(RenderTargets[0]->Destination);
|
if (RenderTargets[i] == nullptr)
|
||||||
blendDesc.RenderTarget[0].BlendOp = BlendMapper::ConvertOperation(RenderTargets[0]->Operation);
|
break;
|
||||||
blendDesc.RenderTarget[0].SrcBlendAlpha = BlendMapper::ConvertBlend(RenderTargets[0]->SourceAlpha);
|
|
||||||
blendDesc.RenderTarget[0].DestBlendAlpha = BlendMapper::ConvertBlend(RenderTargets[0]->DestinationAlpha);
|
blendDesc.RenderTarget[0].BlendEnable = RenderTargets[0]->Enabled;
|
||||||
blendDesc.RenderTarget[0].BlendOpAlpha = BlendMapper::ConvertOperation(RenderTargets[0]->OperationAlpha);
|
blendDesc.RenderTarget[0].SrcBlend = BlendMapper::ConvertBlend(RenderTargets[0]->Source);
|
||||||
blendDesc.RenderTarget[0].RenderTargetWriteMask = BlendMapper::ConvertColorWrite(RenderTargets[0]->WriteMask);
|
blendDesc.RenderTarget[0].DestBlend = BlendMapper::ConvertBlend(RenderTargets[0]->Destination);
|
||||||
|
blendDesc.RenderTarget[0].BlendOp = BlendMapper::ConvertOperation(RenderTargets[0]->Operation);
|
||||||
|
blendDesc.RenderTarget[0].SrcBlendAlpha = BlendMapper::ConvertBlend(RenderTargets[0]->SourceAlpha);
|
||||||
|
blendDesc.RenderTarget[0].DestBlendAlpha = BlendMapper::ConvertBlend(RenderTargets[0]->DestinationAlpha);
|
||||||
|
blendDesc.RenderTarget[0].BlendOpAlpha = BlendMapper::ConvertOperation(RenderTargets[0]->OperationAlpha);
|
||||||
|
blendDesc.RenderTarget[0].RenderTargetWriteMask = BlendMapper::ConvertColorWrite(RenderTargets[0]->WriteMask);
|
||||||
|
}
|
||||||
|
|
||||||
if (_device == nullptr || _device != device)
|
if (_device == nullptr || _device != device)
|
||||||
_device = device;
|
_device = device;
|
||||||
|
@ -31,6 +31,9 @@ namespace xna {
|
|||||||
MSG msg{};
|
MSG msg{};
|
||||||
_clock.Start();
|
_clock.Start();
|
||||||
|
|
||||||
|
GameTime gameTime{};
|
||||||
|
TimeSpan endElapsedTime{};
|
||||||
|
|
||||||
do {
|
do {
|
||||||
if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
|
if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
|
||||||
{
|
{
|
||||||
@ -38,23 +41,23 @@ namespace xna {
|
|||||||
DispatchMessage(&msg);
|
DispatchMessage(&msg);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
GameTime gt;
|
auto elapsed = _clock.ElapsedTime();
|
||||||
|
gameTime.ElapsedGameTime = elapsed - endElapsedTime;
|
||||||
|
gameTime.TotalGameTime = _clock.TotalTime();
|
||||||
|
|
||||||
gt.ElapsedGameTime = _clock.ElapsedTime();
|
this->Update(gameTime);
|
||||||
gt.TotalGameTime = _clock.TotalTime();
|
|
||||||
auto ml = gt.ElapsedGameTime.Milliseconds();
|
|
||||||
|
|
||||||
this->Update(gt);
|
//_graphicsDevice->Clear();
|
||||||
|
|
||||||
_graphicsDevice->Clear();
|
elapsed = _clock.ElapsedTime();
|
||||||
|
gameTime.ElapsedGameTime = elapsed - endElapsedTime;
|
||||||
|
gameTime.TotalGameTime = _clock.TotalTime();
|
||||||
|
|
||||||
gt.ElapsedGameTime = _clock.ElapsedTime();
|
this->Draw(gameTime);
|
||||||
gt.TotalGameTime = _clock.TotalTime();
|
|
||||||
ml = gt.ElapsedGameTime.Milliseconds();
|
|
||||||
|
|
||||||
this->Draw(gt);
|
|
||||||
|
|
||||||
_graphicsDevice->Present();
|
_graphicsDevice->Present();
|
||||||
|
|
||||||
|
endElapsedTime = _clock.ElapsedTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
} while (msg.message != WM_QUIT);
|
} while (msg.message != WM_QUIT);
|
||||||
|
@ -22,9 +22,9 @@ namespace xna {
|
|||||||
virtual void Initialize() override{}
|
virtual void Initialize() override{}
|
||||||
virtual void Update(GameTime const& gameTime) override{}
|
virtual void Update(GameTime const& gameTime) override{}
|
||||||
|
|
||||||
private:
|
protected:
|
||||||
|
PGraphicsDevice _graphicsDevice{ nullptr };
|
||||||
PGameWindow _gameWindow{ nullptr };
|
PGameWindow _gameWindow{ nullptr };
|
||||||
PGraphicsDevice _graphicsDevice{ nullptr };
|
|
||||||
|
|
||||||
GameClock _clock{};
|
GameClock _clock{};
|
||||||
GameTime _currentGameTime{};
|
GameTime _currentGameTime{};
|
||||||
|
@ -12,8 +12,23 @@ using namespace xna;
|
|||||||
// return 0;
|
// return 0;
|
||||||
//}
|
//}
|
||||||
|
|
||||||
|
class Game1 : public Game {
|
||||||
|
virtual void Update(GameTime const& gameTime) {
|
||||||
|
|
||||||
|
Game::Update(gameTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void Draw(GameTime const& gameTime) {
|
||||||
|
_graphicsDevice->Clear();
|
||||||
|
|
||||||
|
Game::Draw(gameTime);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
int APIENTRY WinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ LPSTR lpCmdLine, _In_ int nCmdShow) {
|
int APIENTRY WinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ LPSTR lpCmdLine, _In_ int nCmdShow) {
|
||||||
Game game;
|
/*Game game;
|
||||||
|
game.Run();*/
|
||||||
|
Game1 game;
|
||||||
game.Run();
|
game.Run();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user