Lib
QOLを高める
|
User application base, which manages a window and DirectX objects. More...
#include <framework.h>
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::DGraphics & | graph () |
Get DirectGraphics manager. More... | |
sound::XAudio2 & | sound () |
Get XAudio2 manager. More... | |
input::DInput & | input () |
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... | |
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.
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.
[in] | appParam | Application parameters. |
[in] | graphParam | Graphics parameters. |
[in] | resSetCount | Count of resource set. |
Definition at line 377 of file framework.cpp.
|
virtual |
Destructor.
Definition at line 446 of file framework.cpp.
void yappy::framework::Application::addBgmResource | ( | size_t | setId, |
const char * | resId, | ||
const wchar_t * | path | ||
) |
Register BGM resource.
[in] | setId | Resource set ID. |
[in] | resId | Resource ID. |
[in] | path | File 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.
[in] | setId | Resource set ID. |
[in] | resId | Resource ID. |
[in] | fontName | Font family name. |
[in] | startChar | The first character. |
[in] | endChar | The last character. |
[in] | w | Font image width. |
[in] | h | Font 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.
[in] | setId | Resource set ID. |
[in] | resId | Resource ID. |
[in] | path | File 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.
[in] | setId | Resource set ID. |
[in] | resId | Resource ID. |
[in] | path | File 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.
[in] | setId | Resource set ID. |
[in] | resId | Resource 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.
[in] | setId | Resource set ID. |
[in] | resId | Resource ID. |
Definition at line 605 of file framework.cpp.
|
inline |
Get graphics parameters.
Definition at line 325 of file framework.h.
|
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.
[in] | setId | Resource set ID. |
[in] | resId | Resource 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.
[in] | setId | Resource set ID. |
[in] | resId | Resource ID. |
Definition at line 599 of file framework.cpp.
|
inline |
Get DirectGraphics manager.
Definition at line 328 of file framework.h.
|
protectedpure virtual |
User initialization code.
Called at the beginning of run().
|
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.
[in] | setId | Resource set ID. |
[in] | cancel | async cancel atomic |
Definition at line 590 of file framework.cpp.
|
protectedpure virtual |
Process rendering.
Called after update(), unless frame skipping.
int yappy::framework::Application::run | ( | ) |
Start main loop.
Call init() .
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.
[in] | seal | new state. |
Definition at line 585 of file framework.cpp.
|
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.
[in] | setId | Resource set ID. |
Definition at line 594 of file framework.cpp.
|
protectedpure virtual |
Process frame.
Called at the beginning of every frame.