mirror of
https://github.com/cc65/cc65.git
synced 2024-12-22 12:30:41 +00:00
Added tutorial files from Maciek
git-svn-id: svn://svn.cc65.org/cc65/trunk@149 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
parent
f88d81a393
commit
e2de9f5873
8
samples/geos/.cvsignore
Normal file
8
samples/geos/.cvsignore
Normal file
@ -0,0 +1,8 @@
|
||||
filesel
|
||||
hello1
|
||||
hello2
|
||||
rmvprot
|
||||
yesno
|
||||
*.map
|
||||
*.s
|
||||
*.lbl
|
8
samples/geos/appfile.grc
Normal file
8
samples/geos/appfile.grc
Normal file
@ -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."
|
||||
}
|
8
samples/geos/apphello1.grc
Normal file
8
samples/geos/apphello1.grc
Normal file
@ -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."
|
||||
}
|
8
samples/geos/apphello2.grc
Normal file
8
samples/geos/apphello2.grc
Normal file
@ -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."
|
||||
}
|
9
samples/geos/apprmvprot.grc
Normal file
9
samples/geos/apprmvprot.grc
Normal file
@ -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."
|
||||
}
|
8
samples/geos/appyesno.grc
Normal file
8
samples/geos/appyesno.grc
Normal file
@ -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."
|
||||
}
|
28
samples/geos/filesel.c
Normal file
28
samples/geos/filesel.c
Normal file
@ -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();
|
||||
}
|
29
samples/geos/hello1.c
Normal file
29
samples/geos/hello1.c
Normal file
@ -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();
|
||||
}
|
50
samples/geos/hello2.c
Normal file
50
samples/geos/hello2.c
Normal file
@ -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();
|
||||
}
|
88
samples/geos/rmvprot.c
Normal file
88
samples/geos/rmvprot.c
Normal file
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
27
samples/geos/yesno.c
Normal file
27
samples/geos/yesno.c
Normal file
@ -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();
|
||||
}
|
Loading…
Reference in New Issue
Block a user