MyGUI
3.2.0
|
#include <MyGUI_Canvas.h>
Data Structures | |
struct | Event |
Public Types | |
enum | TextureResizeMode { TRM_PT_CONST_SIZE, TRM_PT_VIEW_REQUESTED, TRM_PT_VIEW_ALL } |
typedef RTTIBase | Base |
typedef Canvas | RTTIBase |
typedef delegates::CMultiDelegate1 < Canvas * > | EventHandle_CanvasPtr |
typedef delegates::CDelegate2 < Canvas *, Event > | EventHandle_CanvasPtrEvent |
Public Member Functions | |
virtual const std::string & | getTypeName () const |
virtual bool | isType (const std::type_info &_type) const |
template<typename Type > | |
bool | isType () const |
Canvas () | |
void | createTexture (TextureResizeMode _resizeMode, TextureUsage _usage=getDefaultTextureUsage(), PixelFormat _format=getDefaultTextureFormat()) |
Creates texture. | |
void | createTexture (int _width, int _height, TextureResizeMode _resizeMode, TextureUsage _usage=getDefaultTextureUsage(), PixelFormat _format=getDefaultTextureFormat()) |
Creates texture. | |
void | createTexture (const IntSize &_size, TextureResizeMode _resizeMode, TextureUsage _usage=getDefaultTextureUsage(), PixelFormat _format=getDefaultTextureFormat()) |
Creates texture. | |
void | destroyTexture () |
Destroys texture. | |
void | updateTexture () |
Call user delegate update and removes old texture if it isn't original. | |
void * | lock (TextureUsage _usage=TextureUsage::Write) |
Locks hardware pixel buffer. | |
void | unlock () |
Unlocks hardware pixel buffer. | |
bool | isLocked () const |
Checks lockness of hardware _pixel buffer. | |
int | getTextureRealWidth () const |
Returns real width of texture. | |
int | getTextureRealHeight () const |
Returns real height of texture. | |
IntSize | getTextureRealSize () const |
Returns real _size of texture. | |
int | getTextureSrcWidth () const |
Returns needed width while creating texture. | |
int | getTextureSrcHeight () const |
Returns needed height while creating texture. | |
IntSize | getTextureSrcSize () const |
Returns needed sizes while creating texture. | |
PixelFormat | getTextureFormat () const |
Returns needed sizes while creating texture. | |
const std::string & | getTextureName () const |
Returns name of the current texture. | |
virtual void | setSize (const IntSize &_value) |
virtual void | setCoord (const IntCoord &_value) |
void | setSize (int _width, int _height) |
void | setCoord (int _left, int _top, int _width, int _height) |
TextureResizeMode | getResizeMode () const |
Returns resize mode. | |
void | setResizeMode (TextureResizeMode _value) |
Sets resize mode of texture. | |
bool | isTextureSrcSize () const |
Checks if the texture has the source (required by user) size, otherwise real texture size are bigger. | |
bool | isTextureCreated () const |
Returns true if the texture was created (and exists), otherwise false. | |
bool | isTextureManaged () const |
Returns true if we own the texture, otherwise false. | |
ITexture * | getTexture () const |
Reurns interface texture. | |
void | setTextureManaged (bool _value) |
Sets the texture managed. | |
Static Public Member Functions | |
static const std::string & | getClassTypeName () |
static TextureUsage | getDefaultTextureUsage () |
Returns default GUI texture usage. | |
static PixelFormat | getDefaultTextureFormat () |
Returns default GUI texture format. | |
Data Fields | |
EventHandle_CanvasPtr | eventPreTextureChanges |
EventHandle_CanvasPtrEvent | requestUpdateCanvas |
Protected Member Functions | |
virtual void | shutdownOverride () |
virtual void | initialiseOverride () |
void | _destroyTexture (bool _sendEvent) |
Destroys texture. | |
void | validate (int &_width, int &_height, TextureUsage &_usage, PixelFormat &_format) const |
Update entered parameters according to current texture resize mode(size) and restore (if can) parameters of usage and format from texture. | |
void | createExactTexture (int _width, int _height, TextureUsage _usage, PixelFormat _format) |
Creates the texture itself. | |
bool | checkCreate (int _width, int _height) const |
Checks if we need to create a texture with such sizes. | |
void | resize (const IntSize &_size) |
Calls when resize widget. | |
void | correctUV () |
Correct texture uv-coordinates. | |
void | frameAdvise (bool _advise) |
For updating once per frame. | |
void | frameEntered (float _time) |
For updating once per frame. | |
virtual void | textureInvalidate (ITexture *_texture) |
void | _setUVSet (const FloatRect &_rect) |
Protected Attributes | |
ITexture * | mTexture |
Current texture. | |
IntSize | mReqTexSize |
Requested bu user sizes. | |
std::string | mGenTexName |
Generated texture name. | |
TextureResizeMode | mTexResizeMode |
Texture resize mode. | |
uint8 * | mTexData |
Saved pointer from last calling lock. | |
bool | mTexManaged |
true if we own the texture (can delete it or replace by another instance), otherwise false | |
bool | mFrameAdvise |
For updating once per frame. True state means updating before next frame starts. | |
bool | mInvalidateData |
Widget wrapper over Texture - shows the texture. Implemented: resizing of texture (see TextureResizeMode); recovery after loosing device;
Definition at line 36 of file MyGUI_Canvas.h.
typedef RTTIBase MyGUI::Canvas::Base |
Reimplemented from MyGUI::Widget.
Definition at line 40 of file MyGUI_Canvas.h.
Definition at line 61 of file MyGUI_Canvas.h.
Definition at line 62 of file MyGUI_Canvas.h.
typedef Canvas MyGUI::Canvas::RTTIBase |
Reimplemented from MyGUI::Widget.
Definition at line 40 of file MyGUI_Canvas.h.
Available resize and view modes of texture
Definition at line 69 of file MyGUI_Canvas.h.
Definition at line 32 of file MyGUI_Canvas.cpp.
void MyGUI::Canvas::_destroyTexture | ( | bool | _sendEvent | ) | [protected] |
Destroys texture.
Definition at line 171 of file MyGUI_Canvas.cpp.
void MyGUI::Canvas::_setUVSet | ( | const FloatRect & | _rect | ) | [protected] |
Definition at line 279 of file MyGUI_Canvas.cpp.
bool MyGUI::Canvas::checkCreate | ( | int | _width, |
int | _height | ||
) | const [protected] |
Checks if we need to create a texture with such sizes.
Definition at line 126 of file MyGUI_Canvas.cpp.
void MyGUI::Canvas::correctUV | ( | ) | [protected] |
Correct texture uv-coordinates.
Definition at line 186 of file MyGUI_Canvas.cpp.
void MyGUI::Canvas::createExactTexture | ( | int | _width, |
int | _height, | ||
TextureUsage | _usage, | ||
PixelFormat | _format | ||
) | [protected] |
Creates the texture itself.
Definition at line 59 of file MyGUI_Canvas.cpp.
void MyGUI::Canvas::createTexture | ( | TextureResizeMode | _resizeMode, |
TextureUsage | _usage = getDefaultTextureUsage() , |
||
PixelFormat | _format = getDefaultTextureFormat() |
||
) |
Creates texture.
Definition at line 43 of file MyGUI_Canvas.cpp.
void MyGUI::Canvas::createTexture | ( | int | _width, |
int | _height, | ||
TextureResizeMode | _resizeMode, | ||
TextureUsage | _usage = getDefaultTextureUsage() , |
||
PixelFormat | _format = getDefaultTextureFormat() |
||
) |
Creates texture.
Definition at line 87 of file MyGUI_Canvas.cpp.
void MyGUI::Canvas::createTexture | ( | const IntSize & | _size, |
TextureResizeMode | _resizeMode, | ||
TextureUsage | _usage = getDefaultTextureUsage() , |
||
PixelFormat | _format = getDefaultTextureFormat() |
||
) |
Creates texture.
Definition at line 51 of file MyGUI_Canvas.cpp.
void MyGUI::Canvas::destroyTexture | ( | ) |
Destroys texture.
Definition at line 156 of file MyGUI_Canvas.cpp.
void MyGUI::Canvas::frameAdvise | ( | bool | _advise | ) | [protected] |
For updating once per frame.
Definition at line 225 of file MyGUI_Canvas.cpp.
void MyGUI::Canvas::frameEntered | ( | float | _time | ) | [protected] |
For updating once per frame.
Reimplemented from MyGUI::Widget.
Definition at line 245 of file MyGUI_Canvas.cpp.
static const std::string& MyGUI::Canvas::getClassTypeName | ( | ) | [inline, static] |
Reimplemented from MyGUI::Widget.
Definition at line 40 of file MyGUI_Canvas.h.
PixelFormat MyGUI::Canvas::getDefaultTextureFormat | ( | ) | [static] |
Returns default GUI texture format.
Definition at line 375 of file MyGUI_Canvas.cpp.
TextureUsage MyGUI::Canvas::getDefaultTextureUsage | ( | ) | [static] |
Returns default GUI texture usage.
Definition at line 370 of file MyGUI_Canvas.cpp.
Returns resize mode.
Definition at line 340 of file MyGUI_Canvas.cpp.
ITexture * MyGUI::Canvas::getTexture | ( | ) | const |
Reurns interface texture.
Definition at line 360 of file MyGUI_Canvas.cpp.
PixelFormat MyGUI::Canvas::getTextureFormat | ( | ) | const |
Returns needed sizes while creating texture.
Definition at line 320 of file MyGUI_Canvas.cpp.
const std::string & MyGUI::Canvas::getTextureName | ( | ) | const |
Returns name of the current texture.
Definition at line 325 of file MyGUI_Canvas.cpp.
int MyGUI::Canvas::getTextureRealHeight | ( | ) | const |
Returns real height of texture.
Definition at line 295 of file MyGUI_Canvas.cpp.
IntSize MyGUI::Canvas::getTextureRealSize | ( | ) | const |
Returns real _size of texture.
Definition at line 300 of file MyGUI_Canvas.cpp.
int MyGUI::Canvas::getTextureRealWidth | ( | ) | const |
Returns real width of texture.
Definition at line 290 of file MyGUI_Canvas.cpp.
int MyGUI::Canvas::getTextureSrcHeight | ( | ) | const |
Returns needed height while creating texture.
Definition at line 310 of file MyGUI_Canvas.cpp.
IntSize MyGUI::Canvas::getTextureSrcSize | ( | ) | const |
Returns needed sizes while creating texture.
Definition at line 315 of file MyGUI_Canvas.cpp.
int MyGUI::Canvas::getTextureSrcWidth | ( | ) | const |
Returns needed width while creating texture.
Definition at line 305 of file MyGUI_Canvas.cpp.
virtual const std::string& MyGUI::Canvas::getTypeName | ( | ) | const [inline, virtual] |
Get type name as string
Reimplemented from MyGUI::Widget.
Definition at line 40 of file MyGUI_Canvas.h.
void MyGUI::Canvas::initialiseOverride | ( | ) | [protected, virtual] |
Reimplemented from MyGUI::Widget.
Definition at line 167 of file MyGUI_Canvas.cpp.
bool MyGUI::Canvas::isLocked | ( | ) | const |
Checks lockness of hardware _pixel buffer.
Definition at line 285 of file MyGUI_Canvas.cpp.
bool MyGUI::Canvas::isTextureCreated | ( | ) | const |
Returns true if the texture was created (and exists), otherwise false.
Definition at line 350 of file MyGUI_Canvas.cpp.
bool MyGUI::Canvas::isTextureManaged | ( | ) | const |
Returns true if we own the texture, otherwise false.
Definition at line 355 of file MyGUI_Canvas.cpp.
bool MyGUI::Canvas::isTextureSrcSize | ( | ) | const |
Checks if the texture has the source (required by user) size, otherwise real texture size are bigger.
Definition at line 220 of file MyGUI_Canvas.cpp.
virtual bool MyGUI::Canvas::isType | ( | const std::type_info & | _type | ) | const [inline, virtual] |
Compare with selected type
Reimplemented from MyGUI::Widget.
Definition at line 40 of file MyGUI_Canvas.h.
bool MyGUI::Canvas::isType | ( | ) | const [inline] |
Compare with selected type
Reimplemented from MyGUI::Widget.
Definition at line 40 of file MyGUI_Canvas.h.
void * MyGUI::Canvas::lock | ( | TextureUsage | _usage = TextureUsage::Write | ) |
Locks hardware pixel buffer.
Definition at line 206 of file MyGUI_Canvas.cpp.
void MyGUI::Canvas::resize | ( | const IntSize & | _size | ) | [protected] |
Calls when resize widget.
Definition at line 77 of file MyGUI_Canvas.cpp.
void MyGUI::Canvas::setCoord | ( | const IntCoord & | _value | ) | [virtual] |
Set widget position and size
Reimplemented from MyGUI::Widget.
Definition at line 113 of file MyGUI_Canvas.cpp.
void MyGUI::Canvas::setCoord | ( | int | _left, |
int | _top, | ||
int | _width, | ||
int | _height | ||
) |
See Widget::setCoord(const IntCoord& _coord)
Reimplemented from MyGUI::Widget.
Definition at line 335 of file MyGUI_Canvas.cpp.
void MyGUI::Canvas::setResizeMode | ( | TextureResizeMode | _value | ) |
Sets resize mode of texture.
Definition at line 345 of file MyGUI_Canvas.cpp.
void MyGUI::Canvas::setSize | ( | const IntSize & | _value | ) | [virtual] |
void MyGUI::Canvas::setSize | ( | int | _width, |
int | _height | ||
) |
See Widget::setSize(const IntSize& _size)
Reimplemented from MyGUI::Widget.
Definition at line 330 of file MyGUI_Canvas.cpp.
void MyGUI::Canvas::setTextureManaged | ( | bool | _value | ) |
Sets the texture managed.
Definition at line 365 of file MyGUI_Canvas.cpp.
void MyGUI::Canvas::shutdownOverride | ( | ) | [protected, virtual] |
Reimplemented from MyGUI::Widget.
Definition at line 161 of file MyGUI_Canvas.cpp.
void MyGUI::Canvas::textureInvalidate | ( | ITexture * | _texture | ) | [protected, virtual] |
Implements MyGUI::ITextureInvalidateListener.
Definition at line 274 of file MyGUI_Canvas.cpp.
void MyGUI::Canvas::unlock | ( | ) |
Unlocks hardware pixel buffer.
Definition at line 215 of file MyGUI_Canvas.cpp.
void MyGUI::Canvas::updateTexture | ( | ) |
Call user delegate update and removes old texture if it isn't original.
Definition at line 120 of file MyGUI_Canvas.cpp.
void MyGUI::Canvas::validate | ( | int & | _width, |
int & | _height, | ||
TextureUsage & | _usage, | ||
PixelFormat & | _format | ||
) | const [protected] |
Update entered parameters according to current texture resize mode(size) and restore (if can) parameters of usage and format from texture.
Definition at line 137 of file MyGUI_Canvas.cpp.
Event : Notify user texture instance will be changed
_canvas,which | will be updated |
Definition at line 168 of file MyGUI_Canvas.h.
bool MyGUI::Canvas::mFrameAdvise [protected] |
For updating once per frame. True state means updating before next frame starts.
Definition at line 229 of file MyGUI_Canvas.h.
std::string MyGUI::Canvas::mGenTexName [protected] |
Generated texture name.
Definition at line 217 of file MyGUI_Canvas.h.
bool MyGUI::Canvas::mInvalidateData [protected] |
Definition at line 231 of file MyGUI_Canvas.h.
IntSize MyGUI::Canvas::mReqTexSize [protected] |
Requested bu user sizes.
Definition at line 214 of file MyGUI_Canvas.h.
uint8* MyGUI::Canvas::mTexData [protected] |
bool MyGUI::Canvas::mTexManaged [protected] |
true if we own the texture (can delete it or replace by another instance), otherwise false
Definition at line 226 of file MyGUI_Canvas.h.
TextureResizeMode MyGUI::Canvas::mTexResizeMode [protected] |
ITexture* MyGUI::Canvas::mTexture [protected] |
Event : Texture instance was changed (May be caused by resizing texture or lossing device). User have to update all references to new instance of texture.
signature : void method(MyGUI::Canvas* _canvas, MyGUI::Canvas::Event _event)
_canvas,which | needs to update |
_event |
Definition at line 175 of file MyGUI_Canvas.h.