mirror of
https://github.com/OpenDiablo2/OpenDiablo2
synced 2025-02-07 09:07:00 -05:00
Fixed palette def issues. Added shell of sprite class.
This commit is contained in:
parent
2f66ad9532
commit
517a52770d
@ -10,6 +10,8 @@ set (HEADERS
|
||||
include/OpenDiablo2.Game/D2Engine.h
|
||||
include/OpenDiablo2.Game/D2EngineConfig.h
|
||||
include/OpenDiablo2.Game/Common/D2Palette.h
|
||||
include/OpenDiablo2.Game/Common/D2Point.h
|
||||
include/OpenDiablo2.Game/Common/D2Size.h
|
||||
include/OpenDiablo2.Game/Scenes/D2Scene.h
|
||||
include/OpenDiablo2.Game/Scenes/D2MainMenu.h
|
||||
)
|
||||
|
@ -1,5 +1,5 @@
|
||||
#ifndef OPENDIABLO2_GAME_COMMON_PALETTE_H
|
||||
#define OPENDIABLO2_GAME_COMMON_PALETTE_H
|
||||
#ifndef OPENDIABLO2_GAME_COMMON_D2PALETTE_H
|
||||
#define OPENDIABLO2_GAME_COMMON_D2PALETTE_H
|
||||
|
||||
#include <string>
|
||||
|
||||
@ -7,28 +7,49 @@ namespace OpenDiablo2::Game::Common {
|
||||
class D2Palette {
|
||||
public:
|
||||
typedef std::string Entry;
|
||||
const Entry Act1 = "ACT1";
|
||||
const Entry Act2 = "ACT2";
|
||||
const Entry Act3 = "ACT3";
|
||||
const Entry Act4 = "ACT4";
|
||||
const Entry Act5 = "ACT5";
|
||||
const Entry EndGame = "EndGame";
|
||||
const Entry EndGame2 = "EndGame2";
|
||||
const Entry Fechar = "fechar";
|
||||
const Entry Loading = "loading";
|
||||
const Entry Menu0 = "Menu0";
|
||||
const Entry Menu1 = "menu1";
|
||||
const Entry Menu2 = "menu2";
|
||||
const Entry Menu3 = "menu3";
|
||||
const Entry Menu4 = "menu4";
|
||||
const Entry Sky = "Sky";
|
||||
const Entry Static = "STATIC";
|
||||
const Entry Trademark = "Trademark";
|
||||
const Entry Units = "Units";
|
||||
static const Entry Act1;
|
||||
static const Entry Act2;
|
||||
static const Entry Act3;
|
||||
static const Entry Act4;
|
||||
static const Entry Act5;
|
||||
static const Entry EndGame;
|
||||
static const Entry EndGame2;
|
||||
static const Entry Fechar;
|
||||
static const Entry Loading;
|
||||
static const Entry Menu0;
|
||||
static const Entry Menu1;
|
||||
static const Entry Menu2;
|
||||
static const Entry Menu3;
|
||||
static const Entry Menu4;
|
||||
static const Entry Sky;
|
||||
static const Entry Static;
|
||||
static const Entry Trademark;
|
||||
static const Entry Units;
|
||||
private:
|
||||
Palette() {}
|
||||
D2Palette() {}
|
||||
};
|
||||
|
||||
|
||||
const D2Palette::Entry D2Palette::Act1 = "ACT1";
|
||||
const D2Palette::Entry D2Palette::Act2 = "ACT2";
|
||||
const D2Palette::Entry D2Palette::Act3 = "ACT3";
|
||||
const D2Palette::Entry D2Palette::Act4 = "ACT4";
|
||||
const D2Palette::Entry D2Palette::Act5 = "ACT5";
|
||||
const D2Palette::Entry D2Palette::EndGame = "EndGame";
|
||||
const D2Palette::Entry D2Palette::EndGame2 = "EndGame2";
|
||||
const D2Palette::Entry D2Palette::Fechar = "fechar";
|
||||
const D2Palette::Entry D2Palette::Loading = "loading";
|
||||
const D2Palette::Entry D2Palette::Menu0 = "Menu0";
|
||||
const D2Palette::Entry D2Palette::Menu1 = "menu1";
|
||||
const D2Palette::Entry D2Palette::Menu2 = "menu2";
|
||||
const D2Palette::Entry D2Palette::Menu3 = "menu3";
|
||||
const D2Palette::Entry D2Palette::Menu4 = "menu4";
|
||||
const D2Palette::Entry D2Palette::Sky = "Sky";
|
||||
const D2Palette::Entry D2Palette::Static = "STATIC";
|
||||
const D2Palette::Entry D2Palette::Trademark = "Trademark";
|
||||
const D2Palette::Entry D2Palette::Units = "Units";
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif // OPENDIABLO2_GAME_COMMON_PALETTE_H
|
||||
|
@ -0,0 +1,13 @@
|
||||
#ifndef OPENDIABLO2_GAME_COMMON_D2POINT_H
|
||||
#define OPENDIABLO2_GAME_COMMON_D2POINT_H
|
||||
|
||||
namespace OpenDiablo2::Game::Common {
|
||||
|
||||
struct D2Point {
|
||||
int X;
|
||||
int Y;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // OPENDIABLO2_GAME_COMMON_D2POINT_H
|
@ -0,0 +1,13 @@
|
||||
#ifndef OPENDIABLO2_GAME_COMMON_D2SIZE_H
|
||||
#define OPENDIABLO2_GAME_COMMON_D2SIZE_H
|
||||
|
||||
namespace OpenDiablo2::Game::Common {
|
||||
|
||||
struct D2Size {
|
||||
int Width;
|
||||
int Height;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // OPENDIABLO2_GAME_COMMON_D2SIZE_H
|
@ -3,6 +3,7 @@ project(OpenDiablo2.SDL2 VERSION 0.1 LANGUAGES CXX)
|
||||
set (SOURCES
|
||||
src/D2Graphics.cpp
|
||||
src/D2Input.cpp
|
||||
src/D2Sprite.cpp
|
||||
)
|
||||
|
||||
set (HEADERS
|
||||
|
30
src/OpenDiablo2.SDL2/include/OpenDiablo2.System/D2Sprite.h
Normal file
30
src/OpenDiablo2.SDL2/include/OpenDiablo2.System/D2Sprite.h
Normal file
@ -0,0 +1,30 @@
|
||||
#ifndef OPENDIABLO2_SYSTEM_D2SPRITE_H
|
||||
#define OPENDIABLO2_SYSTEM_D2SPRITE_H
|
||||
|
||||
#include <OpenDiablo2.Game/Common/D2Palette.h>
|
||||
#include <OpenDiablo2.Game/Common/D2Point.h>
|
||||
#include <OpenDiablo2.Game/Common/D2Size.h>
|
||||
|
||||
namespace OpenDiablo2::System {
|
||||
|
||||
class D2Sprite {
|
||||
public:
|
||||
int Frame;
|
||||
int TotalFrames;
|
||||
bool Blend;
|
||||
bool Darken;
|
||||
OpenDiablo2::Game::Common::D2Point Location;
|
||||
OpenDiablo2::Game::Common::D2Size FrameSize;
|
||||
OpenDiablo2::Game::Common::D2Size LocalFrameSize;
|
||||
OpenDiablo2::Game::Common::D2Palette::Entry CurrentPalette;
|
||||
|
||||
static D2Sprite * Load(std::string resourcePath, std::string palette, Game::Common::D2Point location, bool cacheFrames = false);
|
||||
static D2Sprite * Load(std::string resourcePath, std::string palette, bool cacheFrames = false);
|
||||
|
||||
private:
|
||||
D2Sprite();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // OPENDIABLO2_SYSTEM_D2SPRITE_H
|
34
src/OpenDiablo2.SDL2/src/D2Sprite.cpp
Normal file
34
src/OpenDiablo2.SDL2/src/D2Sprite.cpp
Normal file
@ -0,0 +1,34 @@
|
||||
#include <OpenDiablo2.System/D2Sprite.h>
|
||||
#include <OpenDiablo2.Game/Common/D2Palette.h>
|
||||
|
||||
OpenDiablo2::System::D2Sprite::D2Sprite()
|
||||
: Frame(-1)
|
||||
, TotalFrames(-1)
|
||||
, Blend(false)
|
||||
, Darken(false)
|
||||
, Location(OpenDiablo2::Game::Common::D2Point {0, 0})
|
||||
, FrameSize(OpenDiablo2::Game::Common::D2Size {0, 0})
|
||||
, LocalFrameSize(OpenDiablo2::Game::Common::D2Size {0, 0})
|
||||
, CurrentPalette(OpenDiablo2::Game::Common::D2Palette::Static)
|
||||
{ }
|
||||
|
||||
OpenDiablo2::System::D2Sprite *
|
||||
OpenDiablo2::System::D2Sprite::Load(
|
||||
std::string resourcePath,
|
||||
std::string palette,
|
||||
bool cacheFrames)
|
||||
{
|
||||
return Load(resourcePath, palette, OpenDiablo2::Game::Common::D2Point {0, 0}, cacheFrames);
|
||||
}
|
||||
|
||||
OpenDiablo2::System::D2Sprite *
|
||||
OpenDiablo2::System::D2Sprite::Load(
|
||||
std::string resourcePath,
|
||||
std::string palette,
|
||||
Game::Common::D2Point location,
|
||||
bool cacheFrames)
|
||||
{
|
||||
auto result = new D2Sprite();
|
||||
|
||||
return result;
|
||||
}
|
Loading…
Reference in New Issue
Block a user