1
0
mirror of https://github.com/borgesdan/xn65 synced 2024-12-29 21:54:47 +01:00

Implementações em Platform

This commit is contained in:
Danilo 2024-05-30 22:14:01 -03:00
parent 77e1b316e2
commit 3e93d0ffbe
7 changed files with 14 additions and 19 deletions

View File

@ -88,15 +88,15 @@ namespace xna {
void SoundEffect::Play() {
if (!impl->_dxSoundEffect)
return;
impl->_dxSoundEffect->Play();
impl->_dxSoundEffect->Play();
}
void SoundEffect::Play(float volume, float pitch, float pan) {
if (!impl->_dxSoundEffect)
return;
impl->_dxSoundEffect->Play(volume, pitch, pan);
return;
impl->_dxSoundEffect->Play(volume, pitch, pan);
}
uptr<SoundEffectInstance> SoundEffect::CreateInstance() {

View File

@ -19,7 +19,7 @@ namespace xna {
public:
static constexpr int DefaultBackBufferWidth = 800;
static constexpr int DefaultBackBufferHeight = 600;
static constexpr int DefaultBackBufferHeight = 480;
protected:
bool CreateDevice();

View File

@ -406,7 +406,7 @@ namespace xna {
HINSTANCE _hInstance{ nullptr };
HWND _windowHandle{ nullptr };
int _windowWidth{ 800 };
int _windowHeight{ 600 };
int _windowHeight{ 480 };
HICON _windowIcon{ nullptr };
HCURSOR _windowCursor{ nullptr };
COLORREF _windowColor{ RGB(0,0,0) };

View File

@ -20,9 +20,7 @@ namespace PlatformerStarterKit {
void Initialize() override {
auto game = reinterpret_cast<Game*>(this);
graphics = New<GraphicsDeviceManager>(game->shared_from_this());
graphics->PreferredBackBufferWidth(BackBufferWidth);
graphics->PreferredBackBufferHeight(BackBufferHeight);
graphics = New<GraphicsDeviceManager>(game->shared_from_this());
graphics->Initialize();
std::any device = graphicsDevice;
@ -130,11 +128,9 @@ namespace PlatformerStarterKit {
sptr<Texture2D> diedOverlay = nullptr;
int levelIndex = -1;
sptr<Level> level = nullptr;
bool wasContinuePressed;
bool wasContinuePressed = false;
TimeSpan WarningTime = TimeSpan::FromSeconds(30);
static constexpr int TargetFrameRate = 60;
static constexpr int BackBufferWidth = 1280;
static constexpr int BackBufferHeight = 720;
static constexpr Buttons ContinueButton = Buttons::A;
};
}

View File

@ -28,7 +28,7 @@ namespace PlatformerStarterKit {
void Gem::OnCollected(xna::sptr<Player>& collectedBy)
{
collectedSound->Play();
collectedSound->Play();
}
void Gem::Draw(xna::GameTime const& gameTime, xna::SpriteBatch& spriteBatch)

View File

@ -186,10 +186,9 @@ namespace PlatformerStarterKit {
for (size_t y = 0; y < Height(); ++y) {
for (size_t x = 0; x < Width(); ++x) {
auto& texture = tiles[x][y].Texture;
if (texture) {
const auto p = xna::Vector2(x, y);
if (texture) {
const auto s = xna::Vector2(x, y);
const auto position = p * s;
const auto position = s * Tile::Size();
spriteBatch.Draw(texture, position, xna::Colors::White);
}
}

View File

@ -12,8 +12,8 @@ namespace PlatformerStarterKit {
struct Tile {
xna::PTexture2D Texture = nullptr;
TileCollision Collision{};
constexpr static int Width = 64;
constexpr static int Height = 48;
constexpr static int Width = 40;
constexpr static int Height = 32;
constexpr static xna::Vector2 Size() {
return{ Width, Height };