My Project
D:/source/c++/Programme/sally/sally/sallyAPI/Picture.h
Go to the documentation of this file.
00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 #pragma once
00029 #include "Define.h"
00030 
00031 #include <d3dx9.h>
00032 #include <dshow.h>
00033 #include <GdiPlus.h>
00034 #include "Game.h"
00035 
00036 #define PANEL_D3DFVF_CUSTOMVERTEX (D3DFVF_XYZ|D3DFVF_DIFFUSE|D3DFVF_TEX1)
00037 
00038 namespace SallyAPI
00039 {
00040         namespace GUI
00041         {
00050 
00051                 class DLL_API_SALLY CPicture
00052                 {
00053                 private:
00054                         //Define a custom vertex for our panel
00055                         struct PANEL_CUSTOMVERTEX
00056                         {
00057                                 FLOAT x, y, z;          //Position of vertex
00058                                 DWORD colour;           //Colour of vertex
00059                                 FLOAT u, v;                     //Texture coordinates
00060                         };
00061 
00062                         SallyAPI::Core::CTexture*       m_pTexture;
00063                         LPDIRECT3DVERTEXBUFFER9         m_pVertexBuffer;
00064 
00065                         int             m_iWidth;
00066                         int             m_iHeight;
00067                         int             m_iAlphaBlending;
00068                         
00069                         float   m_fAngleY;
00070                         float   m_fAngleX;
00071                         float   m_fAngleZ;
00072 
00073                         void    CleanUp();
00074                         void    UpdateVertices();
00075                         void    CreateVertexBuffer();
00076                         
00077                         void    MoveTo(int x, int y);
00078                         void    Rotate(int x, int y);
00079                 public:
00080                         CPicture();
00081                         ~CPicture();
00082 
00083                         SallyAPI::Core::CTexture*       GetTexture();
00084 
00085                         void    SetTexture(SallyAPI::Core::CTexture* texture);
00086 
00087                         bool    CreateEmptyPixelFormat(int iWidth, int iHeight, Gdiplus::PixelFormat pixelFormat);
00088                         bool    CreateEmptyD3DFormat(int iWidth, int iHeight, D3DFORMAT d3dFormat);
00089                         bool    CreateEmptyAsRenderTargetD3DFormat(int iWidth, int iHeight, D3DFORMAT d3dFormat);
00090 
00091                         bool    LoadTexture(const std::string& fileName, bool createMipMaps = false);
00092                         bool    LoadTextureOverGDI(const std::string& fileName, int width = -1, int height = -1);
00093                         
00094                         void    Draw(int x, int y);
00095                         void    Draw(int x, int y, int width, int height);
00096 
00097                         int             GetWidth();
00098                         int             GetHeight();
00099 
00100                         void    SetWidth(int width);
00101                         void    SetHeight(int height);
00102 
00103                         void    UpdateDimensions();
00104 
00105                         void    SetAlphaBlending(int alphaBlending);
00106 
00107                         void    SetRotationAngleY(float angle);
00108                         void    SetRotationAngleX(float angle);
00109                         void    SetRotationAngleZ(float angle);
00110                 };
00111         }
00112 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines