1
0
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:
Danilo 2024-03-24 18:37:55 -03:00
parent e5177cd8e3
commit c06de0cf79
5 changed files with 85 additions and 62 deletions

View File

@ -6,85 +6,84 @@
namespace xna {
//Framework
class BoundingBox;
using PBoundingBox = std::shared_ptr<BoundingBox>;
class BoundingFrustum;
using PBoundingFrustum = std::shared_ptr<BoundingFrustum>;
class BoundinSphere;
using PBoundinSphere = std::shared_ptr<BoundinSphere>;
struct Color;
using PColor = std::shared_ptr<Color>;
class Curve;
using PCurve = std::shared_ptr<Curve>;
class CurveContinuity;
using PCurveContinuity = std::shared_ptr<CurveContinuity>;
class CurveKey;
using PCurveKey = std::shared_ptr<CurveKey>;
class CurveKeyCollection;
using PCurveKeyCollection = std::shared_ptr<CurveKeyCollection>;
struct Matrix;
using PMatrix = std::shared_ptr<Matrix>;
class Plane;
using PPlane = std::shared_ptr<Plane>;
struct Point;
using PPoint = std::shared_ptr<Point>;
class Quaternion;
using PQuaternion = std::shared_ptr<Quaternion>;
class Ray;
using PRay = std::shared_ptr<Ray>;
struct Rectangle;
using PRectangle = std::shared_ptr<Rectangle>;
struct Vector2;
using PVector2 = std::shared_ptr<Vector2>;
struct Vector3;
using PVector3 = std::shared_ptr<Vector3>;
struct Vector4;
using PVector4 = std::shared_ptr<Vector4>;
//Game
class DrawableGameComponent;
using PDrawableGameComponent = std::shared_ptr<DrawableGameComponent>;
class Game;
using PGame = std::shared_ptr<Game>;
class GameComponent;
using PGameComponent = std::shared_ptr<GameComponent>;
class GameComponentCollection;
using PGameComponentCollection = std::shared_ptr<GameComponentCollection>;
class GameClock;
using PGameClock = std::shared_ptr<GameClock>;
class GameTime;
using PGameTime = std::shared_ptr<GameTime>;
class GameWindow;
using PGameWindow = std::shared_ptr<GameWindow>;
class IDrawable;
using PIDrawable = std::shared_ptr<IDrawable>;
class IGameComponent;
using PIGameComponent = std::shared_ptr<IGameComponent>;
class IUpdatable;
using PIUpdatable = std::shared_ptr<IUpdatable>;
//Graphics
class BlendState;
using PBlendState = std::shared_ptr<BlendState>;
class DisplayMode;
using PDisplayMode = std::shared_ptr<DisplayMode>;
class DisplayModeCollection;
using PDisplayModeCollection = std::shared_ptr<DisplayModeCollection>;
class GraphicsAdapter;
using PGraphicsAdapter = std::shared_ptr<GraphicsAdapter>;
class GraphicsDevice;
using PGraphicsDevice = std::shared_ptr<GraphicsDevice>;
class RenderTarget2D;
using PRenderTarget2D = std::shared_ptr<RenderTarget2D>;
class SwapChain;
using PSwapChain = std::shared_ptr<SwapChain>;
class Texture;
using PTexture = std::shared_ptr<Texture>;
class Texture2D;
using PTexture2D = std::shared_ptr<Texture2D>;
struct 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>;
using PViewport = std::shared_ptr<Viewport>;
}
#endif

View File

@ -10,15 +10,21 @@ namespace xna {
D3D11_BLEND_DESC blendDesc{};
blendDesc.AlphaToCoverageEnable = AlphaToCoverage;
blendDesc.IndependentBlendEnable = IndependentBlendEnable;
blendDesc.RenderTarget[0].BlendEnable = RenderTargets[0]->Enabled;
blendDesc.RenderTarget[0].SrcBlend = BlendMapper::ConvertBlend(RenderTargets[0]->Source);
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);
blendDesc.IndependentBlendEnable = IndependentBlendEnable;
for (size_t i = 0; i < 8; ++i) {
if (RenderTargets[i] == nullptr)
break;
blendDesc.RenderTarget[0].BlendEnable = RenderTargets[0]->Enabled;
blendDesc.RenderTarget[0].SrcBlend = BlendMapper::ConvertBlend(RenderTargets[0]->Source);
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)
_device = device;

View File

@ -31,6 +31,9 @@ namespace xna {
MSG msg{};
_clock.Start();
GameTime gameTime{};
TimeSpan endElapsedTime{};
do {
if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
{
@ -38,23 +41,23 @@ namespace xna {
DispatchMessage(&msg);
}
else {
GameTime gt;
auto elapsed = _clock.ElapsedTime();
gameTime.ElapsedGameTime = elapsed - endElapsedTime;
gameTime.TotalGameTime = _clock.TotalTime();
gt.ElapsedGameTime = _clock.ElapsedTime();
gt.TotalGameTime = _clock.TotalTime();
auto ml = gt.ElapsedGameTime.Milliseconds();
this->Update(gameTime);
this->Update(gt);
//_graphicsDevice->Clear();
_graphicsDevice->Clear();
elapsed = _clock.ElapsedTime();
gameTime.ElapsedGameTime = elapsed - endElapsedTime;
gameTime.TotalGameTime = _clock.TotalTime();
gt.ElapsedGameTime = _clock.ElapsedTime();
gt.TotalGameTime = _clock.TotalTime();
ml = gt.ElapsedGameTime.Milliseconds();
this->Draw(gt);
this->Draw(gameTime);
_graphicsDevice->Present();
endElapsedTime = _clock.ElapsedTime();
}
} while (msg.message != WM_QUIT);

View File

@ -22,9 +22,9 @@ namespace xna {
virtual void Initialize() override{}
virtual void Update(GameTime const& gameTime) override{}
private:
protected:
PGraphicsDevice _graphicsDevice{ nullptr };
PGameWindow _gameWindow{ nullptr };
PGraphicsDevice _graphicsDevice{ nullptr };
GameClock _clock{};
GameTime _currentGameTime{};

View File

@ -12,8 +12,23 @@ using namespace xna;
// 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) {
Game game;
/*Game game;
game.Run();*/
Game1 game;
game.Run();
return 0;
}