]> git.sur5r.net Git - cc65/commitdiff
Added tutorial files from Maciek
authorcuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Sat, 15 Jul 2000 09:12:11 +0000 (09:12 +0000)
committercuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Sat, 15 Jul 2000 09:12:11 +0000 (09:12 +0000)
git-svn-id: svn://svn.cc65.org/cc65/trunk@149 b7a2c559-68d2-44c3-8de9-860c34a00d81

samples/geos/.cvsignore [new file with mode: 0644]
samples/geos/appfile.grc [new file with mode: 0644]
samples/geos/apphello1.grc [new file with mode: 0644]
samples/geos/apphello2.grc [new file with mode: 0644]
samples/geos/apprmvprot.grc [new file with mode: 0644]
samples/geos/appyesno.grc [new file with mode: 0644]
samples/geos/filesel.c [new file with mode: 0644]
samples/geos/hello1.c [new file with mode: 0644]
samples/geos/hello2.c [new file with mode: 0644]
samples/geos/rmvprot.c [new file with mode: 0644]
samples/geos/yesno.c [new file with mode: 0644]

diff --git a/samples/geos/.cvsignore b/samples/geos/.cvsignore
new file mode 100644 (file)
index 0000000..21ec677
--- /dev/null
@@ -0,0 +1,8 @@
+filesel
+hello1
+hello2
+rmvprot
+yesno
+*.map
+*.s
+*.lbl
diff --git a/samples/geos/appfile.grc b/samples/geos/appfile.grc
new file mode 100644 (file)
index 0000000..bc1e113
--- /dev/null
@@ -0,0 +1,8 @@
+
+; this is resource file for filesel.c, a GEOS application example
+
+HEADER APPLICATION "filesel" "FileSel" "V1.0" {
+dostype USR
+author "Maciej Witkowiak"
+info "This is C prog compiled with cc65 and GEOSLib."
+}
diff --git a/samples/geos/apphello1.grc b/samples/geos/apphello1.grc
new file mode 100644 (file)
index 0000000..7c2137d
--- /dev/null
@@ -0,0 +1,8 @@
+
+; this is resource file for hello1.c, a GEOS application example
+
+HEADER APPLICATION "hello1" "Hello 1" "V1.0" {
+dostype USR
+author "Maciej Witkowiak"
+info "This is C prog compiled with cc65 and GEOSLib."
+}
diff --git a/samples/geos/apphello2.grc b/samples/geos/apphello2.grc
new file mode 100644 (file)
index 0000000..fb1e3bb
--- /dev/null
@@ -0,0 +1,8 @@
+
+; this is resource file for hello2.c, a GEOS application example
+
+HEADER APPLICATION "hello2" "Hello 2" "V1.0" {
+dostype USR
+author "Maciej Witkowiak"
+info "This is C prog compiled with cc65 and GEOSLib."
+}
diff --git a/samples/geos/apprmvprot.grc b/samples/geos/apprmvprot.grc
new file mode 100644 (file)
index 0000000..c63abbc
--- /dev/null
@@ -0,0 +1,9 @@
+
+; this is resource file for rmvprot.c, a GEOS application example
+
+HEADER APPLICATION "rmvprot" "RmvProt" "V1.0" {
+dostype USR
+author "Maciej Witkowiak"
+;info "This is C prog compiled with cc65 and GEOSLib."
+info "This will remove write protection from your bootdisk."
+}
diff --git a/samples/geos/appyesno.grc b/samples/geos/appyesno.grc
new file mode 100644 (file)
index 0000000..23171a6
--- /dev/null
@@ -0,0 +1,8 @@
+
+; this is resource file for yesno.c, a GEOS application example
+
+HEADER APPLICATION "yesno" "YesNo" "V1.0" {
+dostype USR
+author "Maciej Witkowiak"
+info "This is C prog compiled with cc65 and GEOSLib."
+}
diff --git a/samples/geos/filesel.c b/samples/geos/filesel.c
new file mode 100644 (file)
index 0000000..a25aa3e
--- /dev/null
@@ -0,0 +1,28 @@
+
+/*
+
+    GEOSLib example
+    
+    using DlgBoxFileSelect
+    
+    Maciej 'YTM/Alliance' Witkowiak
+    <ytm@friko.onet.pl>
+    
+    26.12.1999
+*/
+
+#include <geos.h>
+
+char fName[17]="";
+
+void main (void)
+{
+
+    r0=(int)fName;
+
+    DlgBoxOk(CBOLDON "You now will be presented","with apps list" CPLAINTEXT);
+    DlgBoxFileSelect("",APPLICATION,fName);
+    DlgBoxOk("You've chosen:" CBOLDON, fName);
+
+    EnterDeskTop();
+}
diff --git a/samples/geos/hello1.c b/samples/geos/hello1.c
new file mode 100644 (file)
index 0000000..f4b5e62
--- /dev/null
@@ -0,0 +1,29 @@
+
+/*
+
+    GEOSLib example
+    
+    Hello, world example - with DBox
+    
+    Maciej 'YTM/Alliance' Witkowiak
+    <ytm@friko.onet.pl>
+    
+    26.12.1999
+*/
+
+#include <geos.h>
+
+void main (void)
+{
+
+/* Let's show what we've got... */
+
+    DlgBoxOk(CBOLDON "Hello, world" CPLAINTEXT,
+            "This is written in C!");
+            
+/* Normal apps exit from main into system's mainloop, and app finish
+   when user selects it from icons or menu, but here we want to exit
+   immediately.
+*/
+    EnterDeskTop();
+}
diff --git a/samples/geos/hello2.c b/samples/geos/hello2.c
new file mode 100644 (file)
index 0000000..8bc28ab
--- /dev/null
@@ -0,0 +1,50 @@
+
+/*
+
+    GEOSLib example
+    
+    Hello, world example - using graphic functions
+    
+    Maciej 'YTM/Alliance' Witkowiak
+    <ytm@friko.onet.pl>
+    
+    26.12.1999
+*/
+
+#include <geos.h>
+
+/* Let's define the window we're operating */
+struct window wholeScreen = {0, 199, 0, 319};
+
+
+void main (void)
+{
+
+/* Let's show what we've got... */
+
+/* Let's clear the screen - with different pattern, because apps have cleared screen upon
+   start */
+   
+    SetPattern(0);
+    InitDrawWindow(&wholeScreen);
+    Rectangle();
+   
+/* Now some texts              */
+
+    PutString(COUTLINEON "This is compiled using cc65!" CPLAINTEXT, 20, 10);
+    PutString(CBOLDON "This is bold", 30, 10);
+    PutString(CULINEON "and this is bold and underline!", 40, 10);
+    PutString(CPLAINTEXT "This is plain text", 50, 10);
+    
+/* Wait for 5 secs...          */
+/* Note that this is multitasking sleep, and if there are any icons/menus onscreen,
+   they would be usable, in this case you have only pointer usable     */
+
+    Sleep(5*50);
+            
+/* Normal apps exit from main into system's mainloop, and app finish
+   when user selects it from icons or menu, but here we want to exit
+   immediately.
+*/
+    EnterDeskTop();
+}
diff --git a/samples/geos/rmvprot.c b/samples/geos/rmvprot.c
new file mode 100644 (file)
index 0000000..a249290
--- /dev/null
@@ -0,0 +1,88 @@
+
+/*
+
+    GEOSLib example
+    
+    This small application removes GEOS disk write protection tag.
+    e.g. boot disk is always protected after boot-up
+    
+    Maciej 'YTM/Alliance' Witkowiak
+    <ytm@friko.onet.pl>
+    
+    21.03.2000
+*/
+
+#include <geos.h>
+
+char diskName[17] = "";
+
+static const graphicStr clearScreen = {
+       MOVEPENTO(0, 0),
+       NEWPATTERN(2),
+       RECTANGLETO(319, 199),
+       GSTR_END
+};
+
+static const dlgBoxStr mainDialog = {
+       DB_DEFPOS(1),
+       DB_TXTSTR(TXT_LN_X, TXT_LN_2_Y,
+                 CBOLDON "Remove protection on:" CPLAINTEXT),
+       DB_TXTSTR(TXT_LN_X, TXT_LN_3_Y, diskName),
+       DB_ICON(OK, DBI_X_0, DBI_Y_2),
+       DB_ICON(DISK, DBI_X_1, DBI_Y_2),
+       DB_ICON(CANCEL, DBI_X_2, DBI_Y_2),
+       DB_END
+};
+
+static const dlgBoxStr changeDiskDlg = {
+       DB_DEFPOS(1),
+       DB_TXTSTR(TXT_LN_X, TXT_LN_2_Y, CBOLDON "Insert new disk"),
+       DB_TXTSTR(TXT_LN_X, TXT_LN_3_Y, "into drive." CPLAINTEXT),
+       DB_ICON(OK, DBI_X_0, DBI_Y_2),
+       DB_ICON(CANCEL, DBI_X_2, DBI_Y_2),
+       DB_END
+};
+
+static const dlgBoxStr errorDialog = {
+       DB_DEFPOS(1),
+       DB_TXTSTR(TXT_LN_X, TXT_LN_2_Y, CBOLDON "Error happened..."),
+       DB_TXTSTR(TXT_LN_X, TXT_LN_3_Y, "exiting..." CPLAINTEXT),
+       DB_ICON(OK, DBI_X_0, DBI_Y_2),
+       DB_END
+};
+
+void Error(void)
+{
+       DoDlgBox(&errorDialog);
+       EnterDeskTop();
+}
+
+void main(void)
+{
+
+       /* Here we clear the screen. Not really needed anyway... */
+       GraphicsString(&clearScreen);
+       
+       /* Get the name of current disk to show it in dialog box */
+       GetPtrCurDkNm(diskName);
+
+       while (1) {
+               switch (DoDlgBox(&mainDialog)) {
+               /* What's the result of dialog box? which icon was pressed? */
+               case OK:
+                       if (GetDirHead())
+                               Error();
+                       curDirHead[OFF_GS_DTYPE] = 0;
+                       if (PutDirHead())
+                               Error();
+                       break;
+               case DISK:
+                       DoDlgBox(&changeDiskDlg);
+                       GetPtrCurDkNm(diskName);
+                       break;
+               default:        /* CANCEL is the third option */
+                       EnterDeskTop();
+                       break;
+               }
+       }
+}
diff --git a/samples/geos/yesno.c b/samples/geos/yesno.c
new file mode 100644 (file)
index 0000000..b085db9
--- /dev/null
@@ -0,0 +1,27 @@
+
+/*
+
+   GEOSLib example
+
+   example of using DlgBoxYesNo, DlgBoxOkCancel and DlgBoxOk functions
+
+   Maciej 'YTM/Alliance' Witkowiak
+   <ytm@friko.onet.pl>
+
+   26.12.1999
+ */
+
+#include <geos.h>
+
+void main(void)
+{
+       do {
+               if (DlgBoxYesNo("Are you female?", "(don't lie ;-)") == YES) {
+                       DlgBoxOk("You claim to be woman!", "You wanna dance?");
+               } else {
+                       DlgBoxOk("Ergh, another man...", "Let's go for a beer.");
+               };
+       } while (DlgBoxOkCancel("Do you want to try again?", "") == OK);
+
+    EnterDeskTop();
+}