Delphi-PRAXiS
Seite 93 von 103   « Erste     4383919293 9495     Letzte »    

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Software-Projekte der Mitglieder (https://www.delphipraxis.net/26-software-projekte-der-mitglieder/)
-   -   Andorra 2D [Ver. 0.4.5.1, 31.12.08] (https://www.delphipraxis.net/81314-andorra-2d-%5Bver-0-4-5-1-31-12-08%5D.html)

3_of_8 27. Mär 2009 22:51

Re: Andorra 2D [Ver. 0.4.5.1, 31.12.08]
 
Und gleich noch eine:

Zitat:

Andorra 2D tutorials
Canvas

Introduction
This tutorial covers the Andorra 2D canvas which exists since version 0.2. It is an object that can be drawn on similarly to the Windows GDI. Currently the following objects can be drawn with the Andorra 2D canvas:
  • Text
  • Lines
  • Arrows
  • Rectangles
  • Tetragons
  • Circles/ellipses
This doesn't sound very spectacular, but it has to be considered that most objects can be drawn with colour gradients and textures.

Use
The TAdDraw object contains its own canvas object, (just like every Andorra 2D surface derived from TAdRenderingSurface, that includes TAdTextureSurface) which can be accessed easily. To use canvas-specific types, the unit "AdCanvas" should be included.
Delphi-Quellcode:
AdDraw1.BeginScene;
AdDraw1.ClearSurface(clBlack);

with AdDraw1.Canvas do
begin
  //This is where the canvas code will be put
  Release; //<-- If this line is left out, nothing is drawn.
end;

AdDraw1.EndScene;
AdDraw1.Flip;
Internally, the canvas manages so-called "display lists". In those, the canvas objects are stored. Upon calling "Release", the list is drawn and a new one is created.

The colour palette
The unit "AdConsts.pas" shall be briefly mentioned. It contains all the SVG colour constants defined by the W3C. (Seehttp://www.w3.org/TR/css3-color/#svg-color) These colours can be used easily.

Pens and brushes
Just like the TCanvas, the TAdCanvas has two essential objects: A pen and a brush. The pen defines how lines are supposed to look, the brush defines the appearance of the filling.
TAdBrush has the following properties:
Delphi-Quellcode:
Color:TAndorraColor //Default colour
GradientColor:TAndorraColor
GradientDirecton:TAdCanvasGradientDirection //Direction of the gradient (gdVertical, gdHorizontal)
Style:TAdBrushStyle //Style of the filling (abClear, abSolid, abGradient)
Texture:TAd2dTexture //Texture the object is filled with
TextureMode:TAdCanvasTextureMode //Specifies the way the object is filled with the texture (tmTile, tmStretch, tmStretchAlign)
TexturePosition:TAdCanvasTexturePosition //Where the texture is supposed to be (tpStatic, tpDynamic)
BlendMode:TAd2dBlendMode
The AdPen looks similar:
Delphi-Quellcode:
Color:TAndorraColor
Width:single
Texture:TAd2dTexture
TextureMode:TAdCanvasTextureMode //The way the line is filled with the texture (tmTile, tmStretch, tmStretchAlign)
TexturePosition:TAdCanvasTexturePosition //Specifies where the texture is supposed to be (tpStatic, tpDynamic)
PenPosition:TAdPenPosition //Specifies the line's position (ppOuter,ppMiddle,ppInner)
Style:TAdPenStyle //(apNone, apSolid)
BlendMode:TAd2dBlendMode
Drawing lines
There are two commands that are important for drawing lines:
Delphi-Quellcode:
MoveTo(X,Y) //Positioning the pen at the specified position
LineTo(X,Y) //Draw a line from the last position or the position where the pen has been set to via MoveTo
Example 1:
http://andorra.sourceforge.net/tutots/canvas1.png
Delphi-Quellcode:
//Draws a black line from (0;0) to (100;100)
Pen.Color := AdCol32_Black; // := Ad_ARGB(255, 0, 0, 0);
MoveTo(0,0);
LineTo(100,100);
Example 2:
http://andorra.sourceforge.net/tutots/canvas2.png
Delphi-Quellcode:
//Draws a thick line with a colour gradient from (0;0) to (100;100)
Pen.Width := 4;
Pen.Color := Ad_ARGB(255,0,0,255);
MoveTo(0,0);
Pen.Color := Ad_ARGB(255,255,0,0);
LineTo(100,100);
Drawing rectangles
This is done with the command "Rectangle":

Example 1:
http://andorra.sourceforge.net/tutots/canvas3.png
Delphi-Quellcode:
//Draws a blue rectangle with brown border from (1;1) to (100;100);
Pen.Color := AdCol32_Coral;
Brush.Color := AdCol32_CornflowerBlue;
Rectangle(1,1,100,100);
Example 2:
http://andorra.sourceforge.net/tutots/canvas4.png
Delphi-Quellcode:
//Draws a rectangle with horizontal colour gradient and blue border from (1;1) to (100;100)
Pen.Color := Ad_ARGB(255,0,0,255);;
Pen.Style := apSolid;
Brush.Color := Ad_ARGB(255,255,255,0);
Brush.GradientColor := Ad_ARGB(255,255,0,255);
Brush.GradientDirecton := gdHorizontal;
Rectangle(1,1,100,100);
Drawing Circles
This is done with the commands "Circle" and "Ellipse".

Example 1:
http://andorra.sourceforge.net/tutots/canvas5.png
Delphi-Quellcode:
//Draws a circle with a colour gradient around the point (50;50) with a radius of 50px
Pen.Style := apNone;
Brush.Color := AdCol32_Azure;
Brush.GradientColor := AdCol32_Orange;
Circle(50,50,50);
Drawing text
This is done with the ocmmand "TextOut"

Example 1:
http://andorra.sourceforge.net/tutots/canvas6.png
Delphi-Quellcode:
//Draws blue text
Pen.Color := Ad_ARGB(200, 0, 0, 255);
TextOut(0,0,'Test Text!');
Example 2:
http://andorra.sourceforge.net/tutots/canvas7.png
Delphi-Quellcode:
Pen.Color := AdCol32_Black;
Font := AdDraw.Fonts.GenerateFont('Comic Sans MS',12, [afItalic]);
TextOut(0,0,'Test Text!');
Copyright and Licence
(c) by Andreas Stöckel Mai 2007
Translation by 3_of_8 (Manuel Eberl)

Revision 2: December 2007
Revision 3: July 2008

The content of this tutorial is subject to the GNU Licence for Free Documentation.

igel457 27. Mär 2009 23:03

Re: Andorra 2D [Ver. 0.4.5.1, 31.12.08]
 
Hallo Manuel,

vielen Dank für die Übersetzungen! Sobald ich einen Moment Zeit finde, baue ich sie ein. :thumb:

Andreas

igel457 11. Apr 2009 17:02

Re: Andorra 2D [Ver. 0.4.5.1, 31.12.08]
 
So... Ich habe gerade dran gedacht und nach diesen Ewigkeiten die Tutorials endlich hochgeladen! Danke nochmal! Jetzt sind ja (fast) alle auf Englisch!

http://andorra.sf.net/index.php?bb=particles1eng
http://andorra.sf.net/index.php?bb=canvas1eng

3_of_8 11. Apr 2009 18:04

Re: Andorra 2D [Ver. 0.4.5.1, 31.12.08]
 
Ahja, im übrigen hast du difficulty bei der Tutorial-Übersicht falsch geschrieben.

igel457 11. Apr 2009 18:15

Re: Andorra 2D [Ver. 0.4.5.1, 31.12.08]
 
Ok, habe es korrigiert.

furuha 12. Apr 2009 12:39

Re: Andorra 2D [Ver. 0.4.5.1, 31.12.08]
 
Kann es sein das einige der Tutorials nicht vollends dem aktuellen Stand der Engione entsprechen?

Ansonsten muss ich hier ein großes Lob aussprechen! Geniale Arbeit!

igel457 12. Apr 2009 12:46

Re: Andorra 2D [Ver. 0.4.5.1, 31.12.08]
 
Erstmal danke für das Lob.

Zitat:

Zitat von furuha
Kann es sein das einige der Tutorials nicht vollends dem aktuellen Stand der Engione entsprechen?

Kann schon sein - auf jeden Fall nicht die Tutorials hier in der DP anschauen, sondern auf der Website (http://andorra.sf.net/index.php?section=tutorials). Wenn du irgendwo Fehler findest, teile sie mir am besten gleich mit.

furuha 28. Mai 2009 22:58

Re: Andorra 2D [Ver. 0.4.5.1, 31.12.08]
 
Fragen über Fragen(ok die letzte ist schon ne weile her...)

Und zwar, wir versuchen im Rahmen einer AG die Engine in der Schule einzusetzen. Allerdings bekommen wir da trotz installiertem DirectX übelste Fehlermeldungen.
Kann das daran liegen das Windows 2000 eingesetzt wird? Weil hier zuhause am PC und am Schleppie mit Xp funktionierts tadelos. :thumb:

Im Speziellen, die ganzen PNG libraries scheinen wohl ein Knackpunkt zu sein. Wenn du willst schreib ich morgen mal die Fehlermeldungen hier herein.
Und auch das demo Game stürtzt sehr gerne ab(Ich glaube Memory Fehler).... das Planeten teil und die Physik Demo jedoch nicht.....



MfG
Furuha

igel457 29. Mai 2009 15:57

Re: Andorra 2D [Ver. 0.4.5.1, 31.12.08]
 
Hallo,

das liegt an der Grafikkarte und nicht an Windows 2000 - ich war auf die (im nachhinein) doofe Idee gekommen, die Kollsionsabfrage (Pixelcheck) über die Grafikkarte laufen zu lassen. Deshalb laufen diese Demos "Wormhunter" und "PixelCheck" nur mit etwas moderneren/leistungsfähigeren Grafikkarten - die Grafikkarte muss den DirectX 9c Standard vollständig erfüllen.

Ein Workaround für dieses Problem ist das verwenden einer eigenen Kollisionsabfrage, die durch überschreiben von TSprite.CheckCollision bewerkstelligt werden kann. Ich habe aber auf jeden Fall vor das Spriteengine System komplett neu zu schreiben und diesen blöden Fehler von oben zu beheben.

MrTerry 9. Jun 2009 13:57

Re: Andorra 2D [Ver. 0.4.5.1, 31.12.08]
 
Hi an alle!

ich weiß, dass es eine recht simple und kaum fragenswürde Frage ist...aber ich verzweifel nunmal bald.

ich habe delphi 2007 und die neuste andorra version

mein problem : delphi kann andorra nicht wirklich benutzen
(erstellt kein form oder ist zumindest nicht sichtbar [keine 100% auslastung])

hab das reprequise package runtergeladen um die units neu zu kompilieren...
hier kommt mein problem ... ich hab wirklich keine ahnung wo hin ich was kopieren soll, damit der compiler
d3dx9 und direct3d9 findet.... hab dafür auch die d3dx9_31.dll runtergeladen, weil da irgendwas stand, dass man die braucht....hab aber nirgendswo (google und hier hilfe etc) ein tutorial oder ähnliche probleme gefunden....

falls das hier doch schonmal war, dann bitte ich das zu entschuldigen... aber 62 seiten sind dann doch zuviel um alles durchzulesen..die hilfe bietet mir ironischer weise auch kaum hilfe...

danke schonmal im voraus :wall:

lg Terry


Alle Zeitangaben in WEZ +1. Es ist jetzt 19:31 Uhr.
Seite 93 von 103   « Erste     4383919293 9495     Letzte »    

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz