EnglishРусский  

   ..

   SRC

   defines.g

   Desktop.g

   Font.g

   Graphics.g

   Image.g

   Screen.g

   Sound.g

   Sprites.g

The project is closed! You can look at a new scripting language. It is available on GitHub.
Also, try our open source cross-platform automation software.

Ads

Installer and installation software
Commercial and Freeware installers.

source\dev\directx\lib\Graphics.g
  1 include {
  2   "GraphicsImports.g"
  3   "defines.g"
  4   "Font.g"
  5   "Screen.g"
  6   "Sprites.g"
  7   "Sprites3D.g"
  8   "Image.g"
  9 }
 10 
 11 define <export> {
 12   GRAPHICS_MODE_DEFAULT     = 0
 13   GRAPHICS_MODE_TRANSPARENT = 1
 14   GRAPHICS_MODE_XOR         = 2
 15   GRAPHICS_MODE_OUTLINED    = 4
 16 
 17   PIXELFORMAT_8BITS       = 1 //1 bytes per pixel, palletized
 18   PIXELFORMAT_15BITS      = 2 //2 bytes per pixel
 19   PIXELFORMAT_16BITS      = 3 //2 bytes per pixel
 20   PIXELFORMAT_24BITS_RGB  = 4 //3 bytes per pixel (RRGGBB)
 21   PIXELFORMAT_24BITS_BGR  = 5 //3 bytes per pixel (BBGGRR)
 22   PIXELFORMAT_32BITS_RGB  = 6 //4 bytes per pixel (RRGGBB)
 23   PIXELFORMAT_32BITS_BGR  = 7 //4 bytes per pixel (BBGGRR)
 24 }
 25 
 26 type TGraphics <inherit = GAPI_Object>:
 27 
 28 global {
 29   int GE_FrontColor GE_BackColor
 30   Font GE_Graphics_Font
 31   int GE_Graphics_Mode
 32   TGraphics Graphics
 33 }
 34 
 35 property int TGraphics.BackColor{
 36   return GE_BackColor
 37 }
 38 property TGraphics.BackColor(int RGB){
 39   GE_BackColor = RGB
 40   g2d_BackColor(RGB)
 41 }
 42 property int TGraphics.FrontColor{
 43   return GE_FrontColor
 44 }
 45 property TGraphics.FrontColor(int RGB){
 46   GE_FrontColor = RGB
 47   g2d_FrontColor(RGB)
 48 }
 49 method TGraphics.Box(int x y width height){
 50   g2d_Box(x,y,width,height,this.FrontColor)
 51 }
 52 method TGraphics.Box(int x y width height RGB){
 53   g2d_Box(x,y,width,height,RGB)
 54 }
 55 method TGraphics.Box(int x y width height R G B){
 56   g2d_Box(x,y,width,height,(R<<16) + (G<<8) + B)
 57 }
 58 method TGraphics.Circle(int x y R){
 59   g2d_Circle(x,y,R,this.FrontColor)
 60 }
 61 method TGraphics.Circle(int x y R RGB){
 62   g2d_Circle(x,y,R,RGB)
 63 }
 64 method TGraphics.Circle(int x y R cR cG cB){
 65   g2d_Circle(x,y,R,(cR<<16) + (cG<<8) + cB)
 66 }
 67 method int TGraphics.getBuffer(){
 68   return g2d_GetBuffer()
 69 }
 70 method int TGraphics.getBufferPitch(){
 71   return g2d_GetBufferPitch()
 72 }
 73 method int TGraphics.getBufferPixelFormat(){
 74   return g2d_GetBufferPixelFormat()
 75 }
 76 property Font TGraphics.DrawFont{
 77   return GE_Graphics_Font
 78 }
 79 property TGraphics.DrawFont(Font f){
 80   GE_Graphics_Font = f
 81   g2d_SetFont(f.Handle)
 82 }
 83 property int TGraphics.Mode{
 84   return GE_Graphics_Mode
 85 }
 86 property TGraphics.Mode(int Mode){
 87   GE_Graphics_Mode = Mode
 88   g2d_SetMode(Mode)
 89 }
 90 method TGraphics.Ellipse(int x y RadiusX RadiusY){
 91   g2d_Ellipse(x,y,RadiusX,RadiusY,this.FrontColor)
 92 }
 93 method TGraphics.Ellipse(int x y RadiusX RadiusY RGB){
 94   g2d_Ellipse(x,y,RadiusX,RadiusY,RGB)
 95 }
 96 method TGraphics.Ellipse(int x y RadiusX RadiusY R G B){
 97   g2d_Ellipse(x,y,RadiusX,RadiusY,(R<<16) + (G<<8) + B)
 98 }
 99 method TGraphics.FillArea(int x y OutlineColor){
100   g2d_FillArea(x,y,OutlineColor,this.FrontColor)
101 }
102 method TGraphics.FillArea(int x y OutlineColor RGB){
103   g2d_FillArea(x,y,OutlineColor,RGB)
104 }
105 method TGraphics.Line(int x y width height){
106   g2d_Line(x,y,width,height,this.FrontColor)
107 }
108 method TGraphics.Line(int x y width height RGB){
109   g2d_Line(x,y,width,height,RGB)
110 }
111 method TGraphics.Line(int x y width height R G B){
112   g2d_Line(x,y,width,height,(R<<16) + (G<<8) + B)
113 }
114 method TGraphics.LineXY(int x1 y1 x2 y2){
115   g2d_LineXY(x1,y1,x2,y2,this.FrontColor)
116 }
117 method TGraphics.LineXY(int x1 y1 x2 y2 RGB){
118   g2d_LineXY(x1,y1,x2,y2,RGB)
119 }
120 method TGraphics.LineXY(int x1 y1 x2 y2 R G B){
121   g2d_LineXY(x1,y1,x2,y2,(R<<16) + (G<<8) + B)
122 }
123 method TGraphics.Plot(int x y){
124   g2d_Plot(x,y,this.FrontColor)
125 }
126 method TGraphics.Plot(int x y RGB){
127   g2d_Plot(x,y,RGB)
128 }
129 method TGraphics.Plot(int x y R G B){
130   g2d_Plot(x,y,(R<<16) + (G<<8) + B)
131 }
132 method int TGraphics.getColor(int x y){
133   return g2d_GetColor(x,y)
134 }
135 method TGraphics.Text(int x y, str Text){
136   g2d_DrawText(x,y,Text.ptr(),this.FrontColor,this.BackColor)
137 }
138 method TGraphics.Text(int x y, str Text, int FrontColor){
139   g2d_DrawText(x,y,Text.ptr(),FrontColor,this.BackColor)
140 }
141 method TGraphics.Text(int x y, str Text, int FrontColor BackColor){
142   g2d_DrawText(x,y,Text.ptr(),FrontColor,BackColor)
143 }
144 method int TGraphics.TextWidth(str Text){
145   return g2d_GetTextWidth(Text.ptr())
146 }
147 method int TGraphics.TextHeight(str Text){
148   return g2d_GetTextHeight(Text.ptr())
149 }
150 method TGraphics.StopDraw(){
151   g2d_StopDrawing()
152 }
153 method int TGraphics.StartDraw(TScreen Output){
154   this.FrontColor = 0xFFFFFF
155   this.BackColor  = 0x000000
156   return g2d_StartDrawing(Output.Canvas)
157 }
158 method int TGraphics.StartDraw(Sprite2D Output){
159   this.FrontColor = 0xFFFFFF
160   this.BackColor  = 0x000000
161   return g2d_StartDrawing(Output.Canvas)
162 }
163 method int TGraphics.StartDraw(Image Output){
164   this.FrontColor = 0xFFFFFF
165   this.BackColor  = 0x000000
166   return g2d_StartDrawing(Output.Canvas)
167 }
168 
169 func GraphicsEntryPoint <entry> {
170   if (Sprite2D_Init() && Sprite3D_Init()){
171     Sprite3D_SetQuality($SPRITE3D_BILINEAR)
172   }
173   else {
174     GraphicsEntryPoint()
175   }
176 }
177 
178 
179