hedgewars/uStore.pas
changeset 4378 91655618a510
parent 4377 43945842da0c
child 4380 b78638b36b89
equal deleted inserted replaced
4377:43945842da0c 4378:91655618a510
    25 procedure initModule;
    25 procedure initModule;
    26 procedure freeModule;
    26 procedure freeModule;
    27 
    27 
    28 procedure StoreLoad;
    28 procedure StoreLoad;
    29 procedure StoreRelease;
    29 procedure StoreRelease;
    30 procedure DrawSpriteFromRect(Sprite: TSprite; r: TSDL_Rect; X, Y, Height, Position: LongInt);
    30 procedure DrawRoundRect(rect: PSDL_Rect; BorderColor, FillColor: Longword; Surface: PSDL_Surface; Clear: boolean);
    31 procedure DrawSprite (Sprite: TSprite; X, Y, Frame: LongInt);
       
    32 procedure DrawSprite2(Sprite: TSprite; X, Y, FrameX, FrameY: LongInt);
       
    33 procedure DrawSpriteClipped(Sprite: TSprite; X, Y, TopY, RightX, BottomY, LeftX: LongInt);
       
    34 procedure DrawTexture(X, Y: LongInt; Texture: PTexture; Scale: GLfloat = 1.0);
       
    35 procedure DrawTextureF(Texture: PTexture; Scale: GLfloat; X, Y, Frame, Dir, w, h: LongInt);
       
    36 procedure DrawRotatedTextureF(Texture: PTexture; Scale, OffsetX, OffsetY: GLfloat; X, Y, Frame, Dir, w, h: LongInt; Angle: real);
       
    37 procedure DrawRotated(Sprite: TSprite; X, Y, Dir: LongInt; Angle: real);
       
    38 procedure DrawRotatedF(Sprite: TSprite; X, Y, Frame, Dir: LongInt; Angle: real);
       
    39 procedure DrawRotatedTex(Tex: PTexture; hw, hh, X, Y, Dir: LongInt; Angle: real);
       
    40 procedure DrawCentered(X, Top: LongInt; Source: PTexture);
       
    41 procedure DrawFromRect(X, Y, W, H: LongInt; r: PSDL_Rect; SourceTexture: PTexture);
       
    42 procedure DrawFromRect(X, Y: LongInt; r: PSDL_Rect; SourceTexture: PTexture);
       
    43 procedure DrawHedgehog(X, Y: LongInt; Dir: LongInt; Pos, Step: LongWord; Angle: real);
    31 procedure DrawHedgehog(X, Y: LongInt; Dir: LongInt; Pos, Step: LongWord; Angle: real);
    44 procedure DrawLine(X0, Y0, X1, Y1, Width: Single; r, g, b, a: Byte); 
       
    45 procedure DrawFillRect(r: TSDL_Rect);
       
    46 procedure DrawCircle(X, Y, Radius: LongInt; Width: Single; r, g, b, a: Byte); 
       
    47 procedure DrawRoundRect(rect: PSDL_Rect; BorderColor, FillColor: Longword; Surface: PSDL_Surface; Clear: boolean);
       
    48 function  CheckCJKFont(s: ansistring; font: THWFont): THWFont;
    32 function  CheckCJKFont(s: ansistring; font: THWFont): THWFont;
    49 function  RenderStringTex(s: ansistring; Color: Longword; font: THWFont): PTexture;
    33 function  RenderStringTex(s: ansistring; Color: Longword; font: THWFont): PTexture;
    50 function  RenderSpeechBubbleTex(s: ansistring; SpeechType: Longword; font: THWFont): PTexture;
    34 function  RenderSpeechBubbleTex(s: ansistring; SpeechType: Longword; font: THWFont): PTexture;
    51 procedure flipSurface(Surface: PSDL_Surface; Vertical: Boolean);
    35 procedure flipSurface(Surface: PSDL_Surface; Vertical: Boolean);
    52 //procedure rotateSurface(Surface: PSDL_Surface);
    36 //procedure rotateSurface(Surface: PSDL_Surface);
    60 procedure SetScale(f: GLfloat);
    44 procedure SetScale(f: GLfloat);
    61 function  RenderHelpWindow(caption, subcaption, description, extra: ansistring; extracolor: LongInt; iconsurf: PSDL_Surface; iconrect: PSDL_Rect): PTexture;
    45 function  RenderHelpWindow(caption, subcaption, description, extra: ansistring; extracolor: LongInt; iconsurf: PSDL_Surface; iconrect: PSDL_Rect): PTexture;
    62 procedure RenderWeaponTooltip(atype: TAmmoType);
    46 procedure RenderWeaponTooltip(atype: TAmmoType);
    63 procedure ShowWeaponTooltip(x, y: LongInt);
    47 procedure ShowWeaponTooltip(x, y: LongInt);
    64 procedure FreeWeaponTooltip;
    48 procedure FreeWeaponTooltip;
    65 procedure Tint(r, g, b, a: Byte); inline;
       
    66 procedure Tint(c: Longword); inline;
       
    67 
    49 
    68 implementation
    50 implementation
    69 uses uMisc, uConsole, uLocale, uMobile, uVariables, uUtils, uTextures, uIO;
    51 uses uMisc, uConsole, uLocale, uMobile, uVariables, uUtils, uTextures, uIO, uRender;
    70 
    52 
    71 type TGPUVendor = (gvUnknown, gvNVIDIA, gvATI, gvIntel, gvApple);
    53 type TGPUVendor = (gvUnknown, gvNVIDIA, gvATI, gvIntel, gvApple);
    72 
    54 
    73 var HHTexture: PTexture;
    55 var HHTexture: PTexture;
    74     MaxTextureSize: LongInt;
    56     MaxTextureSize: LongInt;
    75     cGPUVendor: TGPUVendor;
    57     cGPUVendor: TGPUVendor;
    76     lastTint: Longword;
       
    77 
       
    78 procedure Tint(r, g, b, a: Byte); inline;
       
    79 var nc: Longword;
       
    80 begin
       
    81 nc:= (a shl 24) or (b shl 16) or (g shl 8) or r;
       
    82 if nc = lastTint then
       
    83     exit;
       
    84 glColor4ub(r, g, b, a);
       
    85 lastTint:= nc;
       
    86 end;
       
    87 
       
    88 procedure Tint(c: Longword); inline;
       
    89 begin
       
    90 Tint(((c shr 16) and $FF), ((c shr 8) and $FF), (c and $FF), $FF);
       
    91 end;
       
    92 
    58 
    93 procedure DrawRoundRect(rect: PSDL_Rect; BorderColor, FillColor: Longword; Surface: PSDL_Surface; Clear: boolean);
    59 procedure DrawRoundRect(rect: PSDL_Rect; BorderColor, FillColor: Longword; Surface: PSDL_Surface; Clear: boolean);
    94 var r: TSDL_Rect;
    60 var r: TSDL_Rect;
    95 begin
    61 begin
    96 r:= rect^;
    62 r:= rect^;
   461 {$IFDEF SDL_IMAGE_NEWER}
   427 {$IFDEF SDL_IMAGE_NEWER}
   462 IMG_Quit();
   428 IMG_Quit();
   463 {$ENDIF}
   429 {$ENDIF}
   464 end;
   430 end;
   465 
   431 
   466 procedure DrawFromRect(X, Y: LongInt; r: PSDL_Rect; SourceTexture: PTexture);
       
   467 begin
       
   468 DrawFromRect(X, Y, r^.w, r^.h, r, SourceTexture)
       
   469 end;
       
   470 
       
   471 procedure DrawFromRect(X, Y, W, H: LongInt; r: PSDL_Rect; SourceTexture: PTexture);
       
   472 var rr: TSDL_Rect;
       
   473     _l, _r, _t, _b: real;
       
   474     VertexBuffer, TextureBuffer: array [0..3] of TVertex2f;
       
   475 begin
       
   476 if (SourceTexture^.h = 0) or (SourceTexture^.w = 0) then exit;
       
   477 
       
   478 // don't draw anything outside the visible screen space (first check fixes some sprite drawing, e.g. hedgehogs)
       
   479 if (abs(X) > W) and ((abs(X + W / 2) - W / 2) > cScreenWidth / cScaleFactor) then
       
   480     exit;
       
   481 if (abs(Y) > H) and ((abs(Y + H / 2 - (0.5 * cScreenHeight)) - H / 2) > cScreenHeight / cScaleFactor) then
       
   482     exit;
       
   483 
       
   484 rr.x:= X;
       
   485 rr.y:= Y;
       
   486 rr.w:= W;
       
   487 rr.h:= H;
       
   488 
       
   489 _l:= r^.x / SourceTexture^.w * SourceTexture^.rx;
       
   490 _r:= (r^.x + r^.w) / SourceTexture^.w * SourceTexture^.rx;
       
   491 _t:= r^.y / SourceTexture^.h * SourceTexture^.ry;
       
   492 _b:= (r^.y + r^.h) / SourceTexture^.h * SourceTexture^.ry;
       
   493 
       
   494 glBindTexture(GL_TEXTURE_2D, SourceTexture^.id);
       
   495 
       
   496 VertexBuffer[0].X:= X;
       
   497 VertexBuffer[0].Y:= Y;
       
   498 VertexBuffer[1].X:= rr.w + X;
       
   499 VertexBuffer[1].Y:= Y;
       
   500 VertexBuffer[2].X:= rr.w + X;
       
   501 VertexBuffer[2].Y:= rr.h + Y;
       
   502 VertexBuffer[3].X:= X;
       
   503 VertexBuffer[3].Y:= rr.h + Y;
       
   504 
       
   505 TextureBuffer[0].X:= _l;
       
   506 TextureBuffer[0].Y:= _t;
       
   507 TextureBuffer[1].X:= _r;
       
   508 TextureBuffer[1].Y:= _t;
       
   509 TextureBuffer[2].X:= _r;
       
   510 TextureBuffer[2].Y:= _b;
       
   511 TextureBuffer[3].X:= _l;
       
   512 TextureBuffer[3].Y:= _b;
       
   513 
       
   514 
       
   515 glVertexPointer(2, GL_FLOAT, 0, @VertexBuffer[0]);
       
   516 glTexCoordPointer(2, GL_FLOAT, 0, @TextureBuffer[0]);
       
   517 glDrawArrays(GL_TRIANGLE_FAN, 0, Length(VertexBuffer));
       
   518 end;
       
   519 
       
   520 procedure DrawTexture(X, Y: LongInt; Texture: PTexture; Scale: GLfloat);
       
   521 begin
       
   522 
       
   523 glPushMatrix;
       
   524 glTranslatef(X, Y, 0);
       
   525 glScalef(Scale, Scale, 1);
       
   526 
       
   527 glBindTexture(GL_TEXTURE_2D, Texture^.id);
       
   528 
       
   529 glVertexPointer(2, GL_FLOAT, 0, @Texture^.vb);
       
   530 glTexCoordPointer(2, GL_FLOAT, 0, @Texture^.tb);
       
   531 glDrawArrays(GL_TRIANGLE_FAN, 0, Length(Texture^.vb));
       
   532 
       
   533 glPopMatrix
       
   534 end;
       
   535 
       
   536 procedure DrawTextureF(Texture: PTexture; Scale: GLfloat; X, Y, Frame, Dir, w, h: LongInt);
       
   537 begin
       
   538     DrawRotatedTextureF(Texture, Scale, 0, 0, X, Y, Frame, Dir, w, h, 0)
       
   539 end;
       
   540 
       
   541 procedure DrawRotatedTextureF(Texture: PTexture; Scale, OffsetX, OffsetY: GLfloat; X, Y, Frame, Dir, w, h: LongInt; Angle: real);
       
   542 var ft, fb, fl, fr: GLfloat;
       
   543     hw, nx, ny: LongInt;
       
   544     VertexBuffer, TextureBuffer: array [0..3] of TVertex2f;
       
   545 begin
       
   546 // don't draw anything outside the visible screen space (first check fixes some sprite drawing, e.g. hedgehogs)
       
   547 if (abs(X) > W) and ((abs(X + dir * OffsetX) - W / 2) * cScaleFactor > cScreenWidth) then
       
   548     exit;
       
   549 if (abs(Y) > H) and ((abs(Y + OffsetY - (0.5 * cScreenHeight)) - W / 2) * cScaleFactor > cScreenHeight) then
       
   550     exit;
       
   551 
       
   552 glPushMatrix;
       
   553 glTranslatef(X, Y, 0);
       
   554 
       
   555 if Dir < 0 then
       
   556    glRotatef(Angle, 0, 0, -1)
       
   557 else
       
   558    glRotatef(Angle, 0, 0,  1);
       
   559 
       
   560 glTranslatef(Dir*OffsetX, OffsetY, 0);
       
   561 glScalef(Scale, Scale, 1);
       
   562 
       
   563 // Any reason for this call? And why only in t direction, not s?
       
   564 //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
       
   565 
       
   566 if Dir < 0 then
       
   567     hw:= w div -2
       
   568 else
       
   569     hw:= w div 2;
       
   570 
       
   571 nx:= round(Texture^.w / w); // number of horizontal frames
       
   572 ny:= round(Texture^.h / h); // number of vertical frames
       
   573 
       
   574 ft:= (Frame mod ny) * Texture^.ry / ny;
       
   575 fb:= ((Frame mod ny) + 1) * Texture^.ry / ny;
       
   576 fl:= (Frame div ny) * Texture^.rx / nx;
       
   577 fr:= ((Frame div ny) + 1) * Texture^.rx / nx;
       
   578 
       
   579 glBindTexture(GL_TEXTURE_2D, Texture^.id);
       
   580 
       
   581 VertexBuffer[0].X:= -hw;
       
   582 VertexBuffer[0].Y:= w / -2;
       
   583 VertexBuffer[1].X:= hw;
       
   584 VertexBuffer[1].Y:= w / -2;
       
   585 VertexBuffer[2].X:= hw;
       
   586 VertexBuffer[2].Y:= w / 2;
       
   587 VertexBuffer[3].X:= -hw;
       
   588 VertexBuffer[3].Y:= w / 2;
       
   589 
       
   590 TextureBuffer[0].X:= fl;
       
   591 TextureBuffer[0].Y:= ft;
       
   592 TextureBuffer[1].X:= fr;
       
   593 TextureBuffer[1].Y:= ft;
       
   594 TextureBuffer[2].X:= fr;
       
   595 TextureBuffer[2].Y:= fb;
       
   596 TextureBuffer[3].X:= fl;
       
   597 TextureBuffer[3].Y:= fb;
       
   598 
       
   599 glVertexPointer(2, GL_FLOAT, 0, @VertexBuffer[0]);
       
   600 glTexCoordPointer(2, GL_FLOAT, 0, @TextureBuffer[0]);
       
   601 glDrawArrays(GL_TRIANGLE_FAN, 0, Length(VertexBuffer));
       
   602 
       
   603 glPopMatrix
       
   604 end;
       
   605 
       
   606 procedure DrawRotated(Sprite: TSprite; X, Y, Dir: LongInt; Angle: real);
       
   607 begin
       
   608     DrawRotatedTex(SpritesData[Sprite].Texture,
       
   609         SpritesData[Sprite].Width,
       
   610         SpritesData[Sprite].Height,
       
   611         X, Y, Dir, Angle)
       
   612 end;
       
   613 
       
   614 procedure DrawRotatedF(Sprite: TSprite; X, Y, Frame, Dir: LongInt; Angle: real);
       
   615 begin
       
   616 glPushMatrix;
       
   617 glTranslatef(X, Y, 0);
       
   618 
       
   619 if Dir < 0 then
       
   620    glRotatef(Angle, 0, 0, -1)
       
   621 else
       
   622    glRotatef(Angle, 0, 0,  1);
       
   623 if Dir < 0 then glScalef(-1.0, 1.0, 1.0);
       
   624 
       
   625 DrawSprite(Sprite, -SpritesData[Sprite].Width div 2, -SpritesData[Sprite].Height div 2, Frame);
       
   626 
       
   627 glPopMatrix
       
   628 end;
       
   629 
       
   630 procedure DrawRotatedTex(Tex: PTexture; hw, hh, X, Y, Dir: LongInt; Angle: real);
       
   631 var VertexBuffer: array [0..3] of TVertex2f;
       
   632 begin
       
   633 // don't draw anything outside the visible screen space (first check fixes some sprite drawing, e.g. hedgehogs)
       
   634 if (abs(X) > 2 * hw) and ((abs(X) - hw) > cScreenWidth / cScaleFactor) then
       
   635     exit;
       
   636 if (abs(Y) > 2 * hh) and ((abs(Y - 0.5 * cScreenHeight) - hh) > cScreenHeight / cScaleFactor) then
       
   637     exit;
       
   638 
       
   639 glPushMatrix;
       
   640 glTranslatef(X, Y, 0);
       
   641 
       
   642 if Dir < 0 then
       
   643    begin
       
   644    hw:= - hw;
       
   645    glRotatef(Angle, 0, 0, -1);
       
   646    end else
       
   647    glRotatef(Angle, 0, 0,  1);
       
   648 
       
   649 
       
   650 glBindTexture(GL_TEXTURE_2D, Tex^.id);
       
   651 
       
   652 VertexBuffer[0].X:= -hw;
       
   653 VertexBuffer[0].Y:= -hh;
       
   654 VertexBuffer[1].X:= hw;
       
   655 VertexBuffer[1].Y:= -hh;
       
   656 VertexBuffer[2].X:= hw;
       
   657 VertexBuffer[2].Y:= hh;
       
   658 VertexBuffer[3].X:= -hw;
       
   659 VertexBuffer[3].Y:= hh;
       
   660 
       
   661 glVertexPointer(2, GL_FLOAT, 0, @VertexBuffer[0]);
       
   662 glTexCoordPointer(2, GL_FLOAT, 0, @Tex^.tb);
       
   663 glDrawArrays(GL_TRIANGLE_FAN, 0, Length(VertexBuffer));
       
   664 
       
   665 glPopMatrix
       
   666 end;
       
   667 
       
   668 procedure DrawSpriteFromRect(Sprite: TSprite; r: TSDL_Rect; X, Y, Height, Position: LongInt);
       
   669 begin
       
   670 r.y:= r.y + Height * Position;
       
   671 r.h:= Height;
       
   672 DrawFromRect(X, Y, @r, SpritesData[Sprite].Texture)
       
   673 end;
       
   674 
       
   675 procedure DrawSprite (Sprite: TSprite; X, Y, Frame: LongInt);
       
   676 var row, col, numFramesFirstCol: LongInt;
       
   677 begin
       
   678 numFramesFirstCol:= SpritesData[Sprite].imageHeight div SpritesData[Sprite].Height;
       
   679 row:= Frame mod numFramesFirstCol;
       
   680 col:= Frame div numFramesFirstCol;
       
   681 DrawSprite2 (Sprite, X, Y, col, row);
       
   682 end;
       
   683 
       
   684 procedure DrawSpriteClipped(Sprite: TSprite; X, Y, TopY, RightX, BottomY, LeftX: LongInt);
       
   685 var r: TSDL_Rect;
       
   686 begin
       
   687 r.x:= 0;
       
   688 r.y:= 0;
       
   689 r.w:= SpritesData[Sprite].Width;
       
   690 r.h:= SpritesData[Sprite].Height;
       
   691 
       
   692 if (X < LeftX) then
       
   693     r.x:= LeftX - X;
       
   694 if (Y < TopY) then
       
   695     r.y:= TopY - Y;
       
   696 
       
   697 if (Y + SpritesData[Sprite].Height > BottomY) then
       
   698     r.h:= BottomY - Y + 1;
       
   699 if (X + SpritesData[Sprite].Width > RightX) then
       
   700     r.w:= RightX - X + 1;
       
   701 
       
   702 dec(r.h, r.y);
       
   703 dec(r.w, r.x);
       
   704 
       
   705 DrawFromRect(X + r.x, Y + r.y, @r, SpritesData[Sprite].Texture)
       
   706 end;
       
   707 
       
   708 procedure DrawSprite2(Sprite: TSprite; X, Y, FrameX, FrameY: LongInt);
       
   709 var r: TSDL_Rect;
       
   710 begin
       
   711     r.x:= FrameX * SpritesData[Sprite].Width;
       
   712     r.w:= SpritesData[Sprite].Width;
       
   713     r.y:= FrameY * SpritesData[Sprite].Height;
       
   714     r.h:= SpritesData[Sprite].Height;
       
   715     DrawFromRect(X, Y, @r, SpritesData[Sprite].Texture)
       
   716 end;
       
   717 
       
   718 procedure DrawCentered(X, Top: LongInt; Source: PTexture);
       
   719 var scale: GLfloat;
       
   720 begin
       
   721     if (Source^.w + 20) > cScreenWidth then
       
   722         scale:= cScreenWidth / (Source^.w + 20)
       
   723     else
       
   724         scale:= 1.0;
       
   725     DrawTexture(X - round(Source^.w * scale) div 2, Top, Source, scale)
       
   726 end;
       
   727 
       
   728 procedure DrawHedgehog(X, Y: LongInt; Dir: LongInt; Pos, Step: LongWord; Angle: real);
   432 procedure DrawHedgehog(X, Y: LongInt; Dir: LongInt; Pos, Step: LongWord; Angle: real);
   729 const VertexBuffer: array [0..3] of TVertex2f = (
   433 const VertexBuffer: array [0..3] of TVertex2f = (
   730         (x: -16; y: -16),
   434         (x: -16; y: -16),
   731         (x:  16; y: -16),
   435         (x:  16; y: -16),
   732         (x:  16; y:  16),
   436         (x:  16; y:  16),
   772 glVertexPointer(2, GL_FLOAT, 0, @VertexBuffer[0]);
   476 glVertexPointer(2, GL_FLOAT, 0, @VertexBuffer[0]);
   773 glTexCoordPointer(2, GL_FLOAT, 0, @TextureBuffer[0]);
   477 glTexCoordPointer(2, GL_FLOAT, 0, @TextureBuffer[0]);
   774 glDrawArrays(GL_TRIANGLE_FAN, 0, Length(VertexBuffer));
   478 glDrawArrays(GL_TRIANGLE_FAN, 0, Length(VertexBuffer));
   775 
   479 
   776 glPopMatrix
   480 glPopMatrix
   777 end;
       
   778 
       
   779 procedure DrawLine(X0, Y0, X1, Y1, Width: Single; r, g, b, a: Byte);
       
   780 var VertexBuffer: array [0..3] of TVertex2f;
       
   781 begin
       
   782     glDisable(GL_TEXTURE_2D);
       
   783     glEnable(GL_LINE_SMOOTH);
       
   784 
       
   785     glPushMatrix;
       
   786     glTranslatef(WorldDx, WorldDy, 0);
       
   787     glLineWidth(Width);
       
   788 
       
   789     Tint(r, g, b, a);
       
   790     VertexBuffer[0].X:= X0;
       
   791     VertexBuffer[0].Y:= Y0;
       
   792     VertexBuffer[1].X:= X1;
       
   793     VertexBuffer[1].Y:= Y1;
       
   794 
       
   795     glVertexPointer(2, GL_FLOAT, 0, @VertexBuffer[0]);
       
   796     glDrawArrays(GL_LINES, 0, Length(VertexBuffer));
       
   797     Tint($FF, $FF, $FF, $FF);
       
   798     
       
   799     glPopMatrix;
       
   800     
       
   801     glEnable(GL_TEXTURE_2D);
       
   802     glDisable(GL_LINE_SMOOTH);
       
   803 end;
       
   804 
       
   805 procedure DrawFillRect(r: TSDL_Rect);
       
   806 var VertexBuffer: array [0..3] of TVertex2f;
       
   807 begin
       
   808 // don't draw anything outside the visible screen space (first check fixes some sprite drawing, e.g. hedgehogs)
       
   809 if (abs(r.x) > r.w) and ((abs(r.x + r.w / 2) - r.w / 2) * cScaleFactor > cScreenWidth) then
       
   810     exit;
       
   811 if (abs(r.y) > r.h) and ((abs(r.y + r.h / 2 - (0.5 * cScreenHeight)) - r.h / 2) * cScaleFactor > cScreenHeight) then
       
   812     exit;
       
   813 
       
   814 glDisable(GL_TEXTURE_2D);
       
   815 
       
   816 Tint($00, $00, $00, $80);
       
   817 
       
   818 VertexBuffer[0].X:= r.x;
       
   819 VertexBuffer[0].Y:= r.y;
       
   820 VertexBuffer[1].X:= r.x + r.w;
       
   821 VertexBuffer[1].Y:= r.y;
       
   822 VertexBuffer[2].X:= r.x + r.w;
       
   823 VertexBuffer[2].Y:= r.y + r.h;
       
   824 VertexBuffer[3].X:= r.x;
       
   825 VertexBuffer[3].Y:= r.y + r.h;
       
   826 
       
   827 glVertexPointer(2, GL_FLOAT, 0, @VertexBuffer[0]);
       
   828 glDrawArrays(GL_TRIANGLE_FAN, 0, Length(VertexBuffer));
       
   829 
       
   830 Tint($FF, $FF, $FF, $FF);
       
   831 glEnable(GL_TEXTURE_2D)
       
   832 end;
       
   833 
       
   834 procedure DrawCircle(X, Y, Radius: LongInt; Width: Single; r, g, b, a: Byte); 
       
   835 var
       
   836     i: LongInt;
       
   837     CircleVertex: array [0..359] of TVertex2f;
       
   838 begin
       
   839     for i := 0 to 359 do begin
       
   840         CircleVertex[i].X := X + Radius*cos(i*pi/180);
       
   841         CircleVertex[i].Y := Y + Radius*sin(i*pi/180);
       
   842     end;
       
   843     glDisable(GL_TEXTURE_2D);
       
   844     glEnable(GL_LINE_SMOOTH);
       
   845     glPushMatrix;
       
   846     glLineWidth(Width);
       
   847     Tint(r, g, b, a);
       
   848     glVertexPointer(2, GL_FLOAT, 0, @CircleVertex[0]);
       
   849     glDrawArrays(GL_LINE_LOOP, 0, 360);
       
   850     Tint($FF, $FF, $FF, $FF);
       
   851     glPopMatrix;
       
   852     glEnable(GL_TEXTURE_2D);
       
   853     glDisable(GL_LINE_SMOOTH);
       
   854 end;
   481 end;
   855 
   482 
   856 procedure StoreRelease;
   483 procedure StoreRelease;
   857 var ii: TSprite;
   484 var ii: TSprite;
   858 begin
   485 begin