/programs/bcc32/examples/file_open/file_open_cpp.bat |
---|
2,8 → 2,8 |
Set BCC_DIR=..\..\..\bcc32 |
kos32-bcc -S -v- -R- -6 -a4 -O2 -Og -Oi -Ov -OS -k- -D__KOLIBRI__ -I..\..\..\bcc32\include %NAME%.cpp |
echo STACKSIZE equ 102400> kos_make.inc |
echo HEAPSIZE equ 102400>> kos_make.inc |
echo STACKSIZE equ 8192> kos_make.inc |
echo HEAPSIZE equ 0>> kos_make.inc |
echo include "%BCC_DIR%\include\kos_start.inc">> kos_make.inc |
echo include "%BCC_DIR%\include\kos_func.inc">> kos_make.inc |
echo include "%BCC_DIR%\include\kos_heap.inc">> kos_make.inc |
/programs/bcc32/examples/libimg_1/1.png |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/programs/bcc32/examples/libimg_1/Makefile |
---|
0,0 → 1,19 |
# Path to /programs |
SVN_PROGR:=../../.. |
# Path to /programs/bcc32 |
SVN_BCC32:=$(SVN_PROGR)/bcc32 |
# Path to t2fasm |
T2FASM:=$(SVN_BCC32)/t2fasm |
# Path to include |
INCLUDE:=$(SVN_BCC32)/include |
# Path to Bin folder |
KOS32_BCC:=/home/autobuild/borlandcpp/bin |
# Filename without .cpp |
FILENAME:=libimg_1 |
include $(SVN_BCC32)/Makefile_app |
/programs/bcc32/examples/libimg_1/libimg_1.cpp |
---|
0,0 → 1,81 |
#include <kolibri.h> |
#include <kos_heap.h> |
#include <kos_file.h> |
#include <load_lib.h> |
#include <l_libimg.h> |
using namespace Kolibri; |
const char header[] = "Image"; |
unsigned char* img_d = 0; |
long img_w, img_h; |
char library_path[2048]; |
namespace Kolibri{ |
char CurrentDirectoryPath[2048]; |
} |
bool KolibriOnStart(TStartData &kos_start, TThreadData /*th*/) |
{ |
kos_start.Left = 10; |
kos_start.Top = 40; |
kos_start.Width = 280; |
kos_start.Height = 200; |
kos_start.WinData.WindowColor = 0xFFFFFF; |
kos_start.WinData.WindowType = 0x33; // 0x34 - fixed, 0x33 - not fixed |
kos_start.WinData.Title = header; |
LoadLibrary("libimg.obj", library_path, "/sys/lib/libimg.obj", &import_libimg); |
return true; |
} |
void KolibriOnPaint(void) |
{ |
// If button have ID 1, this is close button |
DrawButton(2,0xf0f0f0, 10,10,50,20); |
DrawText(20,16,0,"Open"); |
if(img_d) PutImage(img_d,10,40,img_w,img_h); |
} |
void KolibriOnButton(long id, TThreadData /*th*/) |
{ |
FileInfoBlock* file; |
long int k; |
switch(id){ |
case 2: |
file = FileOpen("1.png"); |
if (!file){ |
SetWindowCaption("Error open file '1.png'"); |
break; |
} |
k = FileGetLength(file); |
if (k > 0){ |
if(img_d) Free(img_d); |
img_d = (unsigned char*)Alloc(k); |
if (img_d){ |
if (FileRead(file, img_d, k) != k){ |
Free(img_d); img_d = 0; |
} |
else{ |
Image* img; |
img = img_decode(img_d,k,0); |
img_w = img->Width; |
img_h = img->Height; |
img_d = (unsigned char*)ReAlloc(img_d, 3*img_w*img_h); |
//if (!img_d){ ... } |
img_to_rgb2(img,img_d); |
img_destroy(img); |
SetWindowCaption("1.png"); |
Redraw(1); |
} |
} |
} |
FileClose(file); |
//break; |
}; |
} |
bool KolibriOnClose(TThreadData /*th*/) { |
if(img_d) {Free(img_d); img_d = 0;} |
return true; |
} |
/programs/bcc32/examples/libimg_1/libimg_1_cpp.bat |
---|
0,0 → 1,16 |
Set NAME=libimg_1 |
Set BCC_DIR=..\..\..\bcc32 |
kos32-bcc -S -v- -R- -6 -a4 -O2 -Og -Oi -Ov -OS -k- -D__KOLIBRI__ -I..\..\..\bcc32\include %NAME%.cpp |
echo STACKSIZE equ 8192> kos_make.inc |
echo HEAPSIZE equ 0>> kos_make.inc |
echo include "%BCC_DIR%\include\kos_start.inc">> kos_make.inc |
echo include "%BCC_DIR%\include\kos_func.inc">> kos_make.inc |
echo include "%BCC_DIR%\include\kos_heap.inc">> kos_make.inc |
echo include "kos_make.inc" > f_%NAME%.asm |
t2fasm < %NAME%.asm >> f_%NAME%.asm |
fasm f_%NAME%.asm %NAME%.kex |
if exist %NAME%.kex kpack %NAME%.kex |
if exist %NAME%.kex del kos_make.inc |
pause |
/programs/bcc32/examples/template/template_cpp.bat |
---|
2,8 → 2,8 |
Set BCC_DIR=..\..\..\bcc32 |
kos32-bcc -S -v- -R- -6 -a4 -O2 -Og -Oi -Ov -OS -k- -D__KOLIBRI__ -I..\..\..\bcc32\include %NAME%.cpp |
echo STACKSIZE equ 102400> kos_make.inc |
echo HEAPSIZE equ 102400>> kos_make.inc |
echo STACKSIZE equ 8192> kos_make.inc |
echo HEAPSIZE equ 0>> kos_make.inc |
echo include "%BCC_DIR%\include\kos_start.inc">> kos_make.inc |
echo include "%BCC_DIR%\include\kos_func.inc">> kos_make.inc |
echo include "%BCC_DIR%\include\kos_heap.inc">> kos_make.inc |
/programs/bcc32/examples/window/window_cpp.bat |
---|
2,8 → 2,8 |
Set BCC_DIR=..\..\..\bcc32 |
kos32-bcc -S -v- -R- -6 -a4 -O2 -Og -Oi -Ov -OS -k- -D__KOLIBRI__ -I..\..\..\bcc32\include %NAME%.cpp |
echo STACKSIZE equ 102400> kos_make.inc |
echo HEAPSIZE equ 102400>> kos_make.inc |
echo STACKSIZE equ 8192> kos_make.inc |
echo HEAPSIZE equ 0>> kos_make.inc |
echo include "%BCC_DIR%\include\kos_start.inc">> kos_make.inc |
echo include "%BCC_DIR%\include\kos_func.inc">> kos_make.inc |
echo include "%BCC_DIR%\include\kos_heap.inc">> kos_make.inc |