Lib
QOLを高める
Public Member Functions | Protected Member Functions | List of all members
yappy::framework::Application Class Referenceabstract

User application base, which manages a window and DirectX objects. More...

#include <framework.h>

Inheritance diagram for yappy::framework::Application:
yappy::util::noncopyable

Public Member Functions

 Application (const AppParam &appParam, const graphics::GraphicsParam &graphParam, size_t resSetCount)
 Constructor. More...
 
virtual ~Application ()
 Destructor. More...
 
int run ()
 Start main loop. More...
 
HWND getHWnd ()
 Get HWND of the window managed by this class. More...
 
void getGraphicsParam (graphics::GraphicsParam *param)
 Get graphics parameters. More...
 
graphics::DGraphicsgraph ()
 Get DirectGraphics manager. More...
 
sound::XAudio2sound ()
 Get XAudio2 manager. More...
 
input::DInputinput ()
 Get DirectInput manager. More...
 
void addTextureResource (size_t setId, const char *resId, const wchar_t *path)
 Register texture image resource. More...
 
void addFontResource (size_t setId, const char *resId, const wchar_t *fontName, uint32_t startChar, uint32_t endChar, uint32_t w, uint32_t h)
 Register font image resource. More...
 
void addSeResource (size_t setId, const char *resId, const wchar_t *path)
 Register sound effect resource. More...
 
void addBgmResource (size_t setId, const char *resId, const wchar_t *path)
 Register BGM resource. More...
 
void sealResource (bool seal)
 Set the lock state of resources. More...
 
void loadResourceSet (size_t setId, std::atomic_bool &cancel)
 Load resources by resource set ID. More...
 
void unloadResourceSet (size_t setId)
 Unload resources by resource set ID. More...
 
const graphics::DGraphics::TextureResourcePtr getTexture (size_t setId, const char *resId) const
 Get texture resource pointer. More...
 
const graphics::DGraphics::FontResourcePtr getFont (size_t setId, const char *resId) const
 Get font resource pointer. More...
 
const sound::XAudio2::SeResourcePtr getSoundEffect (size_t setId, const char *resId) const
 Get sound effect resource pointer. More...
 
const sound::XAudio2::BgmResourcePtr getBgm (size_t setId, const char *resId) const
 Get BGM resource pointer. More...
 

Protected Member Functions

virtual void init ()=0
 User initialization code. More...
 
virtual void update ()=0
 Process frame. More...
 
virtual void render ()=0
 Process rendering. More...
 

Detailed Description

User application base, which manages a window and DirectX objects.

Please inherit this class and override protected methods.

Definition at line 300 of file framework.h.

Constructor & Destructor Documentation

yappy::framework::Application::Application ( const AppParam appParam,
const graphics::GraphicsParam graphParam,
size_t  resSetCount 
)

Constructor.

This needs AppParam and graphics::GraphicsParam. Valid resource serId is: 0 .. resSetCount-1.

Parameters
[in]appParamApplication parameters.
[in]graphParamGraphics parameters.
[in]resSetCountCount of resource set.

Definition at line 377 of file framework.cpp.

yappy::framework::Application::~Application ( )
virtual

Destructor.

Definition at line 446 of file framework.cpp.

Member Function Documentation

void yappy::framework::Application::addBgmResource ( size_t  setId,
const char *  resId,
const wchar_t *  path 
)

Register BGM resource.

Parameters
[in]setIdResource set ID.
[in]resIdResource ID.
[in]pathFile path.

Definition at line 576 of file framework.cpp.

void yappy::framework::Application::addFontResource ( size_t  setId,
const char *  resId,
const wchar_t *  fontName,
uint32_t  startChar,
uint32_t  endChar,
uint32_t  w,
uint32_t  h 
)

Register font image resource.

Parameters
[in]setIdResource set ID.
[in]resIdResource ID.
[in]fontNameFont family name.
[in]startCharThe first character.
[in]endCharThe last character.
[in]wFont image width.
[in]hFont image height.

Definition at line 556 of file framework.cpp.

void yappy::framework::Application::addSeResource ( size_t  setId,
const char *  resId,
const wchar_t *  path 
)

Register sound effect resource.

Parameters
[in]setIdResource set ID.
[in]resIdResource ID.
[in]pathFile path.

Definition at line 567 of file framework.cpp.

void yappy::framework::Application::addTextureResource ( size_t  setId,
const char *  resId,
const wchar_t *  path 
)

Register texture image resource.

Parameters
[in]setIdResource set ID.
[in]resIdResource ID.
[in]pathFile path.

Definition at line 547 of file framework.cpp.

const sound::XAudio2::BgmResourcePtr yappy::framework::Application::getBgm ( size_t  setId,
const char *  resId 
) const

Get BGM resource pointer.

Parameters
[in]setIdResource set ID.
[in]resIdResource ID.

Definition at line 617 of file framework.cpp.

const graphics::DGraphics::FontResourcePtr yappy::framework::Application::getFont ( size_t  setId,
const char *  resId 
) const

Get font resource pointer.

Parameters
[in]setIdResource set ID.
[in]resIdResource ID.

Definition at line 605 of file framework.cpp.

void yappy::framework::Application::getGraphicsParam ( graphics::GraphicsParam param)
inline

Get graphics parameters.

Definition at line 325 of file framework.h.

HWND yappy::framework::Application::getHWnd ( )
inline

Get HWND of the window managed by this class.

Definition at line 322 of file framework.h.

const sound::XAudio2::SeResourcePtr yappy::framework::Application::getSoundEffect ( size_t  setId,
const char *  resId 
) const

Get sound effect resource pointer.

Parameters
[in]setIdResource set ID.
[in]resIdResource ID.

Definition at line 611 of file framework.cpp.

const graphics::DGraphics::TextureResourcePtr yappy::framework::Application::getTexture ( size_t  setId,
const char *  resId 
) const

Get texture resource pointer.

Parameters
[in]setIdResource set ID.
[in]resIdResource ID.

Definition at line 599 of file framework.cpp.

graphics::DGraphics& yappy::framework::Application::graph ( )
inline

Get DirectGraphics manager.

Definition at line 328 of file framework.h.

virtual void yappy::framework::Application::init ( )
protectedpure virtual

User initialization code.

Called at the beginning of run().

input::DInput& yappy::framework::Application::input ( )
inline

Get DirectInput manager.

Definition at line 334 of file framework.h.

void yappy::framework::Application::loadResourceSet ( size_t  setId,
std::atomic_bool &  cancel 
)

Load resources by resource set ID.

This function blocks until all resource is loaded. Processing can be cancelled by writing true to cancel from another thread.

Parameters
[in]setIdResource set ID.
[in]cancelasync cancel atomic

Definition at line 590 of file framework.cpp.

virtual void yappy::framework::Application::render ( )
protectedpure virtual

Process rendering.

Called after update(), unless frame skipping.

int yappy::framework::Application::run ( )

Start main loop.

Call init() .

Returns
msg.wParam, which should be returned from WinMain().

Definition at line 524 of file framework.cpp.

void yappy::framework::Application::sealResource ( bool  seal)

Set the lock state of resources.

If resource manager is sealed, addXXXResource() will be failed.

Parameters
[in]sealnew state.
See also
UnsealResource

Definition at line 585 of file framework.cpp.

sound::XAudio2& yappy::framework::Application::sound ( )
inline

Get XAudio2 manager.

Definition at line 331 of file framework.h.

void yappy::framework::Application::unloadResourceSet ( size_t  setId)

Unload resources by resource set ID.

Parameters
[in]setIdResource set ID.

Definition at line 594 of file framework.cpp.

virtual void yappy::framework::Application::update ( )
protectedpure virtual

Process frame.

Called at the beginning of every frame.


The documentation for this class was generated from the following files: