// xna.cpp : Defines the entry point for the application. // #include "xna.h" using namespace std; using namespace xna; namespace xna { class Game1 : public Game { public: Game1() { auto _game = reinterpret_cast(this); graphics = New(_game); graphics->PreferredBackBufferWidth(1280); graphics->PreferredBackBufferHeight(720); } void Initialize() override { graphics->Initialize(); Game::Initialize(); } void LoadContent() override { spriteBatch = New(*_graphicsDevice); XnaErrorCode err{0}; //texture = Texture2D::FromStream(*_graphicsDevice, "D:\\sprite.jpg", &err); texture = New(_graphicsDevice.get(), 256, 256); std::vector data(256 * 256, 4278190080U); //std::vector data(256 * 256, 0xffffffff); //std::vector data(256 * 256, 4278190080U); texture->SetData(data, 0, data.size()); Game::LoadContent(); } void Update(GameTime const& gameTime) override { if (Keyboard::GetState().IsKeyDown(Keys::Escape) || GamePad.GetState(PlayerIndex::One).IsButtonDown(Buttons::Back)) Exit(); Game::Update(gameTime); } void Draw(GameTime const& gameTime) override { _graphicsDevice->Clear(Colors::CornflowerBlue); spriteBatch->Begin(); spriteBatch->Draw(*texture, position, Colors::White); spriteBatch->End(); Game::Draw(gameTime); } private: sptr graphics = nullptr; sptr spriteBatch = nullptr; sptr texture = nullptr; //200x200 Vector2 position{}; std::vector points; MouseState currentState{}; MouseState oldState{}; float vel = 1; int var = 0; sptr contentManager; }; } int APIENTRY WinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ LPSTR lpCmdLine, _In_ int nCmdShow) { auto game = xna::Game1(); const auto result = game.Run(); return result; }