From 9c0ca4f34656d015ae45aa89021b35f116192601 Mon Sep 17 00:00:00 2001 From: maxcodehack Date: Fri, 6 Nov 2020 19:42:52 +0000 Subject: [PATCH] Add button to example and includes (BCC) git-svn-id: svn://kolibrios.org@8153 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/bcc32/examples/window/Makefile | 2 +- .../examples/window/{hello.cpp => window.cpp} | 5 +++-- .../window/{hello_cpp.bat => window_cpp.bat} | 10 +++++----- programs/bcc32/include/kolibri.h | 1 + programs/bcc32/include/kos_func.inc | 14 ++++++++++++++ 5 files changed, 24 insertions(+), 8 deletions(-) rename programs/bcc32/examples/window/{hello.cpp => window.cpp} (82%) rename programs/bcc32/examples/window/{hello_cpp.bat => window_cpp.bat} (65%) diff --git a/programs/bcc32/examples/window/Makefile b/programs/bcc32/examples/window/Makefile index d9776f3be2..54fd6b04b9 100755 --- a/programs/bcc32/examples/window/Makefile +++ b/programs/bcc32/examples/window/Makefile @@ -14,6 +14,6 @@ INCLUDE:=$(SVN_BCC32)/include KOS32_BCC:=/home/autobuild/borlandcpp/bin # Filename without .cpp -FILENAME:=hello +FILENAME:=window include $(SVN_BCC32)/Makefile_app diff --git a/programs/bcc32/examples/window/hello.cpp b/programs/bcc32/examples/window/window.cpp similarity index 82% rename from programs/bcc32/examples/window/hello.cpp rename to programs/bcc32/examples/window/window.cpp index 9995749129..e4d563491f 100755 --- a/programs/bcc32/examples/window/hello.cpp +++ b/programs/bcc32/examples/window/window.cpp @@ -5,7 +5,7 @@ using namespace Kolibri; const char header[] = "Title"; -const char string[] = "Text"; +const char string[] = "Exit"; bool KolibriOnStart(TStartData &kos_start, TThreadData th) { @@ -20,7 +20,8 @@ bool KolibriOnStart(TStartData &kos_start, TThreadData th) void KolibriOnPaint(void) { - DrawText(10, 10, 0, string); + DrawButton(2,0xB0B0B0, 10,10,50,20); + DrawText(15, 15, 0, string); } bool KolibriOnClose(TThreadData th) { diff --git a/programs/bcc32/examples/window/hello_cpp.bat b/programs/bcc32/examples/window/window_cpp.bat similarity index 65% rename from programs/bcc32/examples/window/hello_cpp.bat rename to programs/bcc32/examples/window/window_cpp.bat index 6b957ec9ea..f14e76f06f 100755 --- a/programs/bcc32/examples/window/hello_cpp.bat +++ b/programs/bcc32/examples/window/window_cpp.bat @@ -1,10 +1,10 @@ -kos32-bcc -S -v- -R- -6 -a4 -O2 -Og -Oi -Ov -OS -k- -D__KOLIBRI__ -I..\..\..\bcc32\include hello.cpp +kos32-bcc -S -v- -R- -6 -a4 -O2 -Og -Oi -Ov -OS -k- -D__KOLIBRI__ -I..\..\..\bcc32\include window.cpp echo STACKSIZE equ 102400 \n HEAPSIZE equ 102400 \n include "..\..\..\proc32.inc" \ninclude "..\..\..\bcc32\include\kos_start.inc" \n include "..\..\..\bcc32\include\kos_func.inc" \n include "..\..\..\bcc32\include\kos_heap.inc" > kos_make.inc -echo include "kos_make.inc" > f_hello.asm -t2fasm < hello.asm >> f_hello.asm -fasm f_hello.asm hello.kex -kpack hello.kex +echo include "kos_make.inc" > f_window.asm +t2fasm < window.asm >> f_window.asm +fasm f_window.asm window.kex +kpack window.kex del kos_make.inc pause diff --git a/programs/bcc32/include/kolibri.h b/programs/bcc32/include/kolibri.h index d5ca3ae389..62017dced7 100644 --- a/programs/bcc32/include/kolibri.h +++ b/programs/bcc32/include/kolibri.h @@ -37,6 +37,7 @@ namespace Kolibri // All kolibri functions, types and data are nested in the ( // Note: pass only thread data of current thread as (thread_data) parameter to these functions. void Main(); // Main function is called at program startup. + void DrawButton(long id, long color, long x, long y, long c_x, long c_y); // Draw Standard button void* ThreadMain(void *user = 0, void *stack_begin = 0); // Called at thread startup, (user) is placed in thread data as a user dword, //_ (stack_begin) is placed in thread data as a stack beginning. diff --git a/programs/bcc32/include/kos_func.inc b/programs/bcc32/include/kos_func.inc index 1a6cdab0a6..90e9c86ff2 100644 --- a/programs/bcc32/include/kos_func.inc +++ b/programs/bcc32/include/kos_func.inc @@ -485,6 +485,20 @@ proc @Kolibri@GetPackedTime$qv ret endp +proc @Kolibri@DrawButton$qllllll uses ebx esi + mov eax,8 + mov ebx,[esp+12+8] + shl ebx,16 + mov bx,[esp+20+8] + mov ecx,[esp+16+8] + shl ecx,16 + mov cx,[esp+24+8] + mov edx,[esp+4+8] + mov esi,[esp+8+8] + int 0x40 + ret +endp + proc @Kolibri@GetTime$qpi mov eax,3 int 0x40