Lib
QOLを高める
Public Types | Public Member Functions | Static Public Attributes | List of all members
yappy::graphics::DGraphics Class Reference

DirectGraphics manager. More...

#include <graphics.h>

Inheritance diagram for yappy::graphics::DGraphics:
yappy::util::noncopyable

Public Types

using TextureResource = const Texture
 
using TextureResourcePtr = std::shared_ptr< TextureResource >
 
using FontResource = const FontTexture
 
using FontResourcePtr = std::shared_ptr< FontResource >
 

Public Member Functions

 DGraphics (const GraphicsParam &param)
 
 ~DGraphics ()
 
void render ()
 
LRESULT onSize (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
 
TextureResourcePtr loadTexture (const wchar_t *path)
 Load a texture. More...
 
void drawTexture (const TextureResourcePtr &texture, int dx, int dy, bool lrInv=false, bool udInv=false, int sx=0, int sy=0, int sw=SrcSizeDefault, int sh=SrcSizeDefault, int cx=0, int cy=0, float angle=0.0f, float scaleX=1.0f, float scaleY=1.0f, float alpha=1.0f)
 Draw texture. More...
 
FontResourcePtr loadFont (const wchar_t *fontName, uint32_t startChar, uint32_t endChar, uint32_t w, uint32_t h)
 
void drawChar (const FontResourcePtr &font, wchar_t c, int dx, int dy, uint32_t color=0x000000, float scaleX=1.0f, float scaleY=1.0f, float alpha=1.0f, int *nextx=nullptr, int *nexty=nullptr)
 
void drawString (const FontResourcePtr &font, const wchar_t *str, int dx, int dy, uint32_t color=0x000000, int ajustX=0, float scaleX=1.0f, float scaleY=1.0f, float alpha=1.0f, int *nextx=nullptr, int *nexty=nullptr)
 Draw string. More...
 

Static Public Attributes

static const int SrcSizeDefault = -1
 Use texture size. More...
 

Detailed Description

DirectGraphics manager.

Definition at line 80 of file graphics.h.

Member Typedef Documentation

Definition at line 84 of file graphics.h.

Definition at line 85 of file graphics.h.

Definition at line 82 of file graphics.h.

Definition at line 83 of file graphics.h.

Constructor & Destructor Documentation

yappy::graphics::DGraphics::DGraphics ( const GraphicsParam param)
explicit

Definition at line 84 of file graphics.cpp.

yappy::graphics::DGraphics::~DGraphics ( )

Definition at line 416 of file graphics.cpp.

Member Function Documentation

void yappy::graphics::DGraphics::drawChar ( const FontResourcePtr font,
wchar_t  c,
int  dx,
int  dy,
uint32_t  color = 0x000000,
float  scaleX = 1.0f,
float  scaleY = 1.0f,
float  alpha = 1.0f,
int *  nextx = nullptr,
int *  nexty = nullptr 
)

Definition at line 622 of file graphics.cpp.

void yappy::graphics::DGraphics::drawString ( const FontResourcePtr font,
const wchar_t *  str,
int  dx,
int  dy,
uint32_t  color = 0x000000,
int  ajustX = 0,
float  scaleX = 1.0f,
float  scaleY = 1.0f,
float  alpha = 1.0f,
int *  nextx = nullptr,
int *  nexty = nullptr 
)

Draw string.

Parameters
[in]fontfont resource
[in]strtext to be drawn
[in]dxdestination X (center pos)
[in]dydestination Y (center pos)
[in]colortext color (0xRRGGBB)
[in]ajustXajust char-to-char space
[in]scaleXscaling factor X
[in]scaleYscaling factor Y
[in]alphaalpha value
[in]nextxX of next column
[in]nextyY of next row

Definition at line 644 of file graphics.cpp.

void yappy::graphics::DGraphics::drawTexture ( const TextureResourcePtr texture,
int  dx,
int  dy,
bool  lrInv = false,
bool  udInv = false,
int  sx = 0,
int  sy = 0,
int  sw = SrcSizeDefault,
int  sh = SrcSizeDefault,
int  cx = 0,
int  cy = 0,
float  angle = 0.0f,
float  scaleX = 1.0f,
float  scaleY = 1.0f,
float  alpha = 1.0f 
)

Draw texture.

Parameters
[in]texturetexture resource
[in]dxdestination X (center pos)
[in]dydestination Y (center pos)
[in]lrInvleft-right invert
[in]udInvup-down invert
[in]sxsource X
[in]sysource Y
[in]swsource width (texture size if SRC_SIZE_DEFAULT)
[in]shsource height (texture size if SRC_SIZE_DEFAULT)
[in]cxcenter X from (sx, sy)
[in]cycenter Y from (sx, sy)
[in]anglerotation angle [rad] (using center pos)
[in]scaleXsize scaling factor X
[in]scaleYsize scaling factor Y
[in]alphaalpha value

Definition at line 504 of file graphics.cpp.

DGraphics::FontResourcePtr yappy::graphics::DGraphics::loadFont ( const wchar_t *  fontName,
uint32_t  startChar,
uint32_t  endChar,
uint32_t  w,
uint32_t  h 
)

Definition at line 517 of file graphics.cpp.

DGraphics::TextureResourcePtr yappy::graphics::DGraphics::loadTexture ( const wchar_t *  path)

Load a texture.

Parameters
[in]pathfile path

Definition at line 481 of file graphics.cpp.

LRESULT yappy::graphics::DGraphics::onSize ( HWND  hWnd,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 427 of file graphics.cpp.

void yappy::graphics::DGraphics::render ( )

Definition at line 446 of file graphics.cpp.

Member Data Documentation

const int yappy::graphics::DGraphics::SrcSizeDefault = -1
static

Use texture size.

You can use cw, ch in drawTexture().

Definition at line 90 of file graphics.h.


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