My Project
ParaScriptingPainter.h
1 #pragma once
2 #include "ParaScriptingCommon.h"
3 #include "ParaScriptingGraphics.h"
4 
5 namespace ParaEngine
6 {
7  class CPainter;
8  class CGUIBase;
9 }
10 
11 namespace ParaScripting
12 {
13  using namespace ParaEngine;
14  using namespace luabind;
15  class ParaAttributeObject;
16  class ParaObject;
17 
26  {
27  public:
28  //
29  // state functions
30  //
31  static bool Begin(const object & paintDevice);
32  static void End();
33 
34  static void Flush();
35  static void Save();
36  static void Restore();
37 
38  static void SetCompositionMode(int mode);
39  static int GetCompositionMode();
40 
41  static const ParaAttributeObject& GetAttributeObject();
42  static void CallField(const char* sFieldname);
43  static void SetField(const char* sFieldname, const object& input);
44  static object GetField(const char* sFieldname, const object& output);
45 
50  static void SetFont(const object& font);
51 
57  static void SetPen(const object& pen);
58 
63  static void SetBrush(const object& brush);
64 
65  static void SetBrushOrigin(float x, float y);
66 
70  static void SetBackground(const object& brush);
71 
74  static void SetOpacity(float fOpacity);
75 
76  static void SetClipRegion(int x, int y, int w, int h);
77  static void SetClipping(bool enable);
78  static bool HasClipping();
79 
80 
81  //
82  // transforms
83  //
87  static void SetTransform(const object& trans, bool combine);
88  static luabind::object GetTransform(const luabind::object& out);
89  static void Scale(float sx, float sy);
90  static void Shear(float sh, float sv);
91  static void Rotate(float a);
92  static void Translate(float dx, float dy);
93 
94  //
95  // draw shapes
96  //
97  static void DrawPoint(float x, float y);
98  static void DrawLine(float x1, float y1, float x2, float y2);
99  static void DrawRect(float x1, float y1, float w, float h);
100 
106  static void DrawTriangleList(const object& triangleList, int nTriangleCount, int nIndexOffset);
112  static void DrawLineList(const object& lineList, int nLineCount, int nIndexOffset);
113 
114  static void DrawTexture(int x, int y, int w, int h, const object& pTexture);
115  static void DrawTexture2(int x, int y, int w, int h, const object& pTexture, int sx, int sy, int sw, int sh);
116  static void DrawText(float x, float y, const std::string &s);
117  static void DrawText2(float x, float y, float w, float h, const std::string &s, int textOption);
118 
123  static void DrawSceneObject(ParaObject& obj, int nOption);
124 
125  public:
126  // do not call from scripting interface
127  static CPainter* GetPainter() { return m_pPainter; }
128  static void SetPainter(CPainter* val) { m_pPainter = val; }
129  protected:
130  // unsafe weak reference.
131  static CPainter* m_pPainter;
132 
133  };
134 }
the current painter object.
Definition: ParaScriptingPainter.h:25
different physics engine has different winding order.
Definition: EventBinding.h:32
ParaObject class: it is used to control game scene objects from scripts.
Definition: ParaScriptingScene.h:56
Definition: object.hpp:749
base class for a surface to paint to.
Definition: Painter.h:38
Definition: PEtypes.h:507
it represents an attribute object associated with an object.
Definition: ParaScriptingGlobal.h:458
for luabind, The main drawback of this approach is that the compilation time will increase for the fi...
Definition: luaSQLite.cpp:1971