Browse Source

Merge pull request #9 from flusher998/main

Added triangle draw and added higlition of FLT
Артур Ефимов 2 years ago
parent
commit
914005ece0
3 changed files with 35 additions and 1 deletions
  1. 1 0
      src/Allegro5.Mod
  2. 1 1
      src/Editor.Mod
  3. 33 0
      src/Graph.Mod

+ 1 - 0
src/Allegro5.Mod

@@ -554,6 +554,7 @@ PROCEDURE destroy_audio_stream* ["al_destroy_audio_stream"] (stream: ADRINT);
 
 
 PROCEDURE draw_line* ["al_draw_line"] (x1, y1, x2, y2: REAL; color: Color; thickness: REAL);
 PROCEDURE draw_line* ["al_draw_line"] (x1, y1, x2, y2: REAL; color: Color; thickness: REAL);
 PROCEDURE draw_triangle* ["al_draw_triangle"] (x1, y1, x2, y2, x3, y3: REAL; color: Color; thickness: REAL);
 PROCEDURE draw_triangle* ["al_draw_triangle"] (x1, y1, x2, y2, x3, y3: REAL; color: Color; thickness: REAL);
+PROCEDURE draw_filled_triangle* ["al_draw_filled_triangle"] (x1, y1, x2, y2, x3, y3: REAL; color: Color);
 PROCEDURE draw_rectangle* ["al_draw_rectangle"] (x1, y1, x2, y2: REAL; color: Color; thickness: REAL);
 PROCEDURE draw_rectangle* ["al_draw_rectangle"] (x1, y1, x2, y2: REAL; color: Color; thickness: REAL);
 PROCEDURE draw_filled_rectangle* ["al_draw_filled_rectangle"] (x1, y1, x2, y2: REAL; color: Color);
 PROCEDURE draw_filled_rectangle* ["al_draw_filled_rectangle"] (x1, y1, x2, y2: REAL; color: Color);
 PROCEDURE draw_rounded_rectangle* ["al_draw_rounded_rectangle"] (x1, y1, x2, y2, rx, ry: REAL; color: Color; thickness: REAL);
 PROCEDURE draw_rounded_rectangle* ["al_draw_rounded_rectangle"] (x1, y1, x2, y2, rx, ry: REAL; color: Color; thickness: REAL);

+ 1 - 1
src/Editor.Mod

@@ -459,7 +459,7 @@ BEGIN
       KW('ELSE') OR KW('OF') OR KW('WITH') OR KW('LONGSET') OR
       KW('ELSE') OR KW('OF') OR KW('WITH') OR KW('LONGSET') OR
       KW('UNTIL') OR KW('CONST') OR KW('MOD') OR KW('FLOOR') OR KW('LSL') OR
       KW('UNTIL') OR KW('CONST') OR KW('MOD') OR KW('FLOOR') OR KW('LSL') OR
       KW('ASR') OR KW('ROR') OR KW('ASSERT') OR KW('BYTE') OR
       KW('ASR') OR KW('ROR') OR KW('ASSERT') OR KW('BYTE') OR
-      KW('SHORTCHAR') OR KW('SYSTEM')
+      KW('SHORTCHAR') OR KW('SYSTEM') OR KW('FLT')
       OR KW('МОДУЛЬ') OR KW('ИМПОРТ') OR KW('ПЕРЕМЕННЫЕ') OR KW('МАССИВ') OR
       OR KW('МОДУЛЬ') OR KW('ИМПОРТ') OR KW('ПЕРЕМЕННЫЕ') OR KW('МАССИВ') OR
       KW('ИЗ') OR KW('ЛИТЕРА') OR KW('ЦЕЛОЕ') OR KW('НАЧАЛО') OR KW('НОВЫЙ') OR
       KW('ИЗ') OR KW('ЛИТЕРА') OR KW('ЦЕЛОЕ') OR KW('НАЧАЛО') OR KW('НОВЫЙ') OR
       KW('ЕСЛИ') OR KW('ТОГДА') OR KW('ИНАЧЕ') OR KW('АЕСЛИ') OR KW('КОНЕЦ')
       KW('ЕСЛИ') OR KW('ТОГДА') OR KW('ИНАЧЕ') OR KW('АЕСЛИ') OR KW('КОНЕЦ')

+ 33 - 0
src/Graph.Mod

@@ -680,6 +680,39 @@ PROCEDURE VLine*(x, y1, y2: INTEGER; color: Color);
 BEGIN LineF(FLT(x), FLT(y1), FLT(x), FLT(y2), color)
 BEGIN LineF(FLT(x), FLT(y1), FLT(x), FLT(y2), color)
 END VLine;
 END VLine;
 
 
+PROCEDURE FillTriangleF*(x1, y1, x2, y2, x3, y3: REAL; color: Color);
+BEGIN Al.draw_filled_triangle(x1, y1, x2, y2, x3, y3, SYSTEM.VAL(Al.Color, color))
+END FillTriangleF;
+
+PROCEDURE FillTriangle*(x1, y1, x2, y2, x3, y3: INTEGER; color: Color);
+BEGIN
+  Al.draw_filled_triangle(FLT(x1) + 0.5, FLT(y1) + 0.5,
+    FLT(x2) + 0.5, FLT(y2) + 0.5, FLT(x3) + 0.5, FLT(y3) + 0.5, SYSTEM.VAL(Al.Color, color))
+END FillTriangle;
+
+PROCEDURE ThickTriangleF*(x1, y1, x2, y2, x3, y3: REAL; color: Color; thickness: REAL);
+BEGIN Al.draw_triangle(x1, y1, x2, y2, x3, y3, SYSTEM.VAL(Al.Color, color), thickness)
+END ThickTriangleF;
+
+PROCEDURE ThickTriangle*(x1, y1, x2, y2, x3, y3: INTEGER; color: Color;
+    thickness: INTEGER);
+BEGIN
+  Al.draw_triangle(FLT(x1) + 0.5, FLT(y1) + 0.5,
+    FLT(x2) + 0.5, FLT(y2) + 0.5, FLT(x3) + 0.5, FLT(y3) + 0.5,
+    SYSTEM.VAL(Al.Color, color), FLT(thickness))
+END ThickTriangle;
+
+PROCEDURE TriangleF*(x1, y1, x2, y2, x3, y3: REAL; color: Color);
+BEGIN Al.draw_triangle(x1, y1, x2, y2, x3, y3, SYSTEM.VAL(Al.Color, color), 1.0)
+END TriangleF;
+
+PROCEDURE Triangle*(x1, y1, x2, y2, x3, y3: INTEGER; color: Color);
+BEGIN
+  Al.draw_triangle(FLT(x1) + 0.5, FLT(y1) + 0.5,
+    FLT(x2) + 0.5, FLT(y2) + 0.5, FLT(x3) + 0.5, FLT(y3) + 0.5,
+    SYSTEM.VAL(Al.Color, color), 1.0)
+END Triangle;
+
 PROCEDURE FillRectF*(x1, y1, x2, y2: REAL; color: Color);
 PROCEDURE FillRectF*(x1, y1, x2, y2: REAL; color: Color);
 BEGIN Al.draw_filled_rectangle(x1, y1, x2, y2, SYSTEM.VAL(Al.Color, color))
 BEGIN Al.draw_filled_rectangle(x1, y1, x2, y2, SYSTEM.VAL(Al.Color, color))
 END FillRectF;
 END FillRectF;