From f75ba1987db835733e124aec791f0d2029065381 Mon Sep 17 00:00:00 2001 From: maxcodehack Date: Sat, 21 Nov 2020 13:31:00 +0000 Subject: [PATCH] Add example to TCC melibc #2 git-svn-id: svn://kolibrios.org@8231 a494cfbc-eb01-0410-851d-a64ba20cac60 --- .../samples/other/melibc_example/Makefile | 3 ++ .../samples/other/melibc_example/hello.c | 32 +++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100755 programs/develop/ktcc/trunk/samples/other/melibc_example/Makefile create mode 100755 programs/develop/ktcc/trunk/samples/other/melibc_example/hello.c diff --git a/programs/develop/ktcc/trunk/samples/other/melibc_example/Makefile b/programs/develop/ktcc/trunk/samples/other/melibc_example/Makefile new file mode 100755 index 0000000000..6f0a09bbc9 --- /dev/null +++ b/programs/develop/ktcc/trunk/samples/other/melibc_example/Makefile @@ -0,0 +1,3 @@ +MENUETDEV = $(abspath ../../../../../libraries/menuetlibc) +all: + wine kos32-tcc.exe -o hello.kex hello.c -lmelibc -I $(MENUETDEV)/include diff --git a/programs/develop/ktcc/trunk/samples/other/melibc_example/hello.c b/programs/develop/ktcc/trunk/samples/other/melibc_example/hello.c new file mode 100755 index 0000000000..e2c473807e --- /dev/null +++ b/programs/develop/ktcc/trunk/samples/other/melibc_example/hello.c @@ -0,0 +1,32 @@ +#include + +char title[] = "Menuetlibc in TinyC"; +char string[] = "Text"; + +void draw_window(void) +{ + // start redraw + __menuet__window_redraw(1); + // define&draw window + __menuet__define_window(10,40,300,150,0x33FFFFFF,0,(__u32)title); + // display string + __menuet__write_text(30,10,0x80000000,string,0); + // end redraw + __menuet__window_redraw(2); +} + +int main() +{ + draw_window(); + for (;;) + { + switch (__menuet__wait_for_event()) + { + case 1: + draw_window(); + break; + case 3: + return; + } + } +}