浏览代码

Examples fix

Arthur Yefimov 3 年之前
父节点
当前提交
851025c1c3
共有 5 个文件被更改,包括 60 次插入41 次删除
  1. 13 7
      src/GTest.Mod
  2. 9 8
      src/TermSnow.Mod
  3. 14 8
      src/compile_GTest.sh
  4. 12 9
      src/compile_TTest.sh
  5. 12 9
      src/compile_TermSnow.sh

+ 13 - 7
src/GTest.Mod

@@ -151,10 +151,10 @@ BEGIN
   G.MakeCol(c2, 0, 255, 0);
   G.MakeCol(c2, 0, 255, 0);
   G.MakeCol(c3, 255, 255, 255);
   G.MakeCol(c3, 255, 255, 255);
   G.MakeCol(c4, 50, 30, 255);
   G.MakeCol(c4, 50, 30, 255);
-  B := G.LoadBitmap('Data/Images/Icon.png');
-  IF B = NIL THEN Out.String('COULD NOT LOAD Data/Images/img.png'); Out.Ln END;
-  font := G.LoadFont('Data/Fonts/Main');
-  IF font = NIL THEN Out.String('COULD NOT LOAD Data/Fonts/Main'); Out.Ln END;
+  B := G.LoadBitmap('../Data/Images/Icon.png');
+  IF B = NIL THEN Out.String('COULD NOT LOAD ../Data/Images/Icon.png'); Out.Ln END;
+  font := G.LoadFont('../Data/Fonts/Main');
+  IF font = NIL THEN Out.String('COULD NOT LOAD ../Data/Fonts/Main'); Out.Ln END;
 
 
   main := G.GetScreen();
   main := G.GetScreen();
   t := G.NewTimer(0.5);
   t := G.NewTimer(0.5);
@@ -201,9 +201,9 @@ BEGIN
 END RunSimple;
 END RunSimple;
 
 
 BEGIN
 BEGIN
-  RunSimple;
+  (*RunSimple;*)
   (*RunSingle;*)
   (*RunSingle;*)
-(*
+
   nofdialogs := 0;
   nofdialogs := 0;
   Z := 0;
   Z := 0;
 
 
@@ -211,10 +211,16 @@ BEGIN
   G.Init;
   G.Init;
   main := G.NewWindow(-1, -1, 800, 600, 'Oberon Allegro 5 Test',
   main := G.NewWindow(-1, -1, 800, 600, 'Oberon Allegro 5 Test',
     {G.resizable, G.maximized});
     {G.resizable, G.maximized});
+
+  B := G.LoadBitmap('../Data/Images/Icon.png');
+  IF B = NIL THEN Out.String('COULD NOT LOAD ../Data/Images/Icon.png'); Out.Ln END;
+  font := G.LoadFont('../Data/Fonts/Main');
+  IF font = NIL THEN Out.String('COULD NOT LOAD ../Data/Fonts/Main'); Out.Ln END;
+
   t := G.NewTimer(1.0);
   t := G.NewTimer(1.0);
   G.MakeCol(c1, 180, 80, 20);
   G.MakeCol(c1, 180, 80, 20);
   G.MakeCol(c2, 240, 180, 80);
   G.MakeCol(c2, 240, 180, 80);
 
 
   Run;
   Run;
-  G.Close*)
+  G.Close
 END GTest.
 END GTest.

+ 9 - 8
src/TermSnow.Mod

@@ -21,11 +21,11 @@ BEGIN
 END OnResize;
 END OnResize;
 
 
 PROCEDURE DrawStar(star: Star);
 PROCEDURE DrawStar(star: Star);
-VAR fg: INTEGER;
-  cell: T.Cell;
+VAR ch: CHAR;
+  fg, bg: INTEGER;
 BEGIN
 BEGIN
-  T.GetCell(star.x, star.y, cell);
-  IF cell.bg = 0 THEN (* Do not draw on non-black background *)
+  T.GetCell(star.x, star.y, ch, fg, bg);
+  IF bg = 0 THEN (* Do not draw on non-black background *)
     IF star.n # 0 THEN
     IF star.n # 0 THEN
       IF star.n = 1 THEN fg := 3 ELSE fg := 15 END;
       IF star.n = 1 THEN fg := 3 ELSE fg := 15 END;
       T.SetCell(star.x, star.y, starChars[star.n], fg, 0)
       T.SetCell(star.x, star.y, starChars[star.n], fg, 0)
@@ -74,12 +74,13 @@ VAR x1, y1, x2, y2, x, y: INTEGER;
   END Swap;
   END Swap;
 
 
   PROCEDURE Put(x, y, color: INTEGER);
   PROCEDURE Put(x, y, color: INTEGER);
-  VAR cell: T.Cell;
+  VAR ch: CHAR;
+    fg, bg: INTEGER;
   BEGIN
   BEGIN
-    T.GetCell(x, y, cell);
+    T.GetCell(x, y, ch, fg, bg);
     IF color # 4 THEN
     IF color # 4 THEN
-      IF cell.bg = 4 THEN color := 2
-      ELSIF cell.bg = 2 THEN color := 4
+      IF bg = 4 THEN color := 2
+      ELSIF bg = 2 THEN color := 4
       END
       END
     END;
     END;
     T.SetCell(x, y, ' ', 7, color)
     T.SetCell(x, y, ' ', 7, color)

+ 14 - 8
src/compile_GTest.sh

@@ -1,12 +1,18 @@
-ofront+ -887ws Allegro5.Mod && \
-ofront+ -887ws Graph2.Mod && \
-ofront+ -887wm GTest.Mod && \
-gcc -o GTest -g3 -O0 -fno-exceptions \
-  -I ../Data/bin/OfrontPlus/Target/Linux_amd64/../../Mod/Lib \
-  -I ../Data/bin/OfrontPlus/Target/Linux_amd64/Lib/Obj \
-  Graph2.c GTest.c \
+PROG=GTest
+OFRDIR="../Data/bin/OfrontPlus/Target/Linux_amd64"
+PATH="$OFRDIR:$PATH"
+export OBERON=.:$OFRDIR/Lib/Sym
+OFR="ofront+ -s88"
+
+$OFR -7w Allegro5.Mod && \
+$OFR -7w Graph2.Mod && \
+$OFR -7wm $PROG.Mod && \
+gcc -o $PROG -g3 -O0 -fno-exceptions \
+  -I $OFRDIR/../../Mod/Lib \
+  -I $OFRDIR/Lib/Obj \
+  Graph2.c $PROG.c \
   ../Data/bin/libFreeOberon.a \
   ../Data/bin/libFreeOberon.a \
-  ../Data/bin/OfrontPlus/Target/Linux_amd64/Lib/libOfront.a \
+  $OFRDIR/Lib/libOfront.a \
   $(pkg-config \
   $(pkg-config \
     allegro_primitives-5 allegro_image-5 allegro_audio-5 \
     allegro_primitives-5 allegro_image-5 allegro_audio-5 \
     allegro_acodec-5 allegro_font-5 allegro_dialog-5 \
     allegro_acodec-5 allegro_font-5 allegro_dialog-5 \

+ 12 - 9
src/compile_TTest.sh

@@ -1,17 +1,20 @@
+PROG=TTest
 OFRDIR="../Data/bin/OfrontPlus/Target/Linux_amd64"
 OFRDIR="../Data/bin/OfrontPlus/Target/Linux_amd64"
 PATH="$OFRDIR:$PATH"
 PATH="$OFRDIR:$PATH"
 export OBERON=.:$OFRDIR/Lib/Sym
 export OBERON=.:$OFRDIR/Lib/Sym
+OFR="ofront+ -s88"
 
 
-ofront+ -887ws Allegro5.Mod && \
-ofront+ -887ws Graph2.Mod && \
-ofront+ -887ws TermBox.Mod && \
-ofront+ -887wm TTest.Mod && \
-gcc -o TTest -g3 -O0 -fno-exceptions \
-  -I ../Data/bin/OfrontPlus/Target/Linux_amd64/../../Mod/Lib \
-  -I ../Data/bin/OfrontPlus/Target/Linux_amd64/Lib/Obj \
-  Graph2.c TermBox.c TTest.c \
+$OFR -7w Allegro5.Mod && \
+$OFR -7w Graph2.Mod && \
+$OFR -7w TermBox.Mod && \
+$OFR -7w TermSnow.Mod && \
+$OFR -7wm $PROG.Mod && \
+gcc -o $PROG -g3 -O0 -fno-exceptions \
+  -I $OFRDIR/../../Mod/Lib \
+  -I $OFRDIR/Lib/Obj \
+  Graph2.c TermBox.c $PROG.c \
   ../Data/bin/libFreeOberon.a \
   ../Data/bin/libFreeOberon.a \
-  ../Data/bin/OfrontPlus/Target/Linux_amd64/Lib/libOfront.a \
+  $OFRDIR/Lib/libOfront.a \
   $(pkg-config \
   $(pkg-config \
     allegro_primitives-5 allegro_image-5 allegro_audio-5 \
     allegro_primitives-5 allegro_image-5 allegro_audio-5 \
     allegro_acodec-5 allegro_font-5 allegro_dialog-5 \
     allegro_acodec-5 allegro_font-5 allegro_dialog-5 \

+ 12 - 9
src/compile_TermSnow.sh

@@ -1,17 +1,20 @@
+PROG=TermSnow
 OFRDIR="../Data/bin/OfrontPlus/Target/Linux_amd64"
 OFRDIR="../Data/bin/OfrontPlus/Target/Linux_amd64"
 PATH="$OFRDIR:$PATH"
 PATH="$OFRDIR:$PATH"
 export OBERON=.:$OFRDIR/Lib/Sym
 export OBERON=.:$OFRDIR/Lib/Sym
+OFR="ofront+ -s88"
 
 
-ofront+ -887ws Allegro5.Mod && \
-ofront+ -887ws Graph2.Mod && \
-ofront+ -887ws TermBox.Mod && \
-ofront+ -887wm TermSnow.Mod && \
-gcc -o TermSnow -g3 -O0 -fno-exceptions \
-  -I ../Data/bin/OfrontPlus/Target/Linux_amd64/../../Mod/Lib \
-  -I ../Data/bin/OfrontPlus/Target/Linux_amd64/Lib/Obj \
-  Graph2.c TermBox.c TermSnow.c \
+$OFR -7w Allegro5.Mod && \
+$OFR -7w Graph2.Mod && \
+$OFR -7w TermBox.Mod && \
+$OFR -7w TermSnow.Mod && \
+$OFR -7wm $PROG.Mod && \
+gcc -o $PROG -g3 -O0 -fno-exceptions \
+  -I $OFRDIR/../../Mod/Lib \
+  -I $OFRDIR/Lib/Obj \
+  Graph2.c TermBox.c $PROG.c \
   ../Data/bin/libFreeOberon.a \
   ../Data/bin/libFreeOberon.a \
-  ../Data/bin/OfrontPlus/Target/Linux_amd64/Lib/libOfront.a \
+  $OFRDIR/Lib/libOfront.a \
   $(pkg-config \
   $(pkg-config \
     allegro_primitives-5 allegro_image-5 allegro_audio-5 \
     allegro_primitives-5 allegro_image-5 allegro_audio-5 \
     allegro_acodec-5 allegro_font-5 allegro_dialog-5 \
     allegro_acodec-5 allegro_font-5 allegro_dialog-5 \