From c6efe10624c35693dfeb720b1e8174f4e7953853 Mon Sep 17 00:00:00 2001 From: Serhii Sakhno Date: Thu, 18 Aug 2016 23:39:38 +0000 Subject: [PATCH] add example for RasterWorks library git-svn-id: svn://kolibrios.org@6492 a494cfbc-eb01-0410-851d-a64ba20cac60 --- contrib/C_Layer/EXAMPLE/rasterworks/Makefile | 32 ++++++++ .../EXAMPLE/rasterworks/rasterworks_example | Bin 0 -> 16548 bytes .../EXAMPLE/rasterworks/rasterworks_example.c | 77 ++++++++++++++++++ 3 files changed, 109 insertions(+) create mode 100644 contrib/C_Layer/EXAMPLE/rasterworks/Makefile create mode 100755 contrib/C_Layer/EXAMPLE/rasterworks/rasterworks_example create mode 100644 contrib/C_Layer/EXAMPLE/rasterworks/rasterworks_example.c diff --git a/contrib/C_Layer/EXAMPLE/rasterworks/Makefile b/contrib/C_Layer/EXAMPLE/rasterworks/Makefile new file mode 100644 index 0000000000..0449b6e853 --- /dev/null +++ b/contrib/C_Layer/EXAMPLE/rasterworks/Makefile @@ -0,0 +1,32 @@ +NAME=rasterworks_example +CC = kos32-gcc +LD = kos32-ld + +SDK_DIR:= $(abspath ../../../sdk) +CLAYER:= $(abspath ../../) + +LDFLAGS = -static -S -nostdlib -T $(SDK_DIR)/sources/newlib/app.lds \ + --image-base 0 -lgcc -ldll -lc.dll -lapp + +CFLAGS = -g -U_Win32 -U_WIN32 -U__MINGW32__ + +INCLUDES= -I. -I$(SDK_DIR)/sources/newlib/libc/include -I$(CLAYER)/INCLUDE +LIBPATH:= -L $(SDK_DIR)/lib -L /home/autobuild/tools/win32/mingw32/lib + +OBJPATH = $(CLAYER)/OBJ + +SOURCES = rasterworks_example.c + +OBJECTS = $(patsubst %.c, %.o, $(SOURCES)) + +all:$(NAME) + +$(NAME): $(OBJECTS) Makefile + $(LD) $(LIBPATH) --subsystem native -o $@ $(OBJECTS) $(OBJPATH)/loadboxlib.obj $(OBJPATH)/loadrasterworks.obj $(OBJPATH)/loadbuf2d.obj $(LDFLAGS) + kos32-objcopy $@ -O binary + +%.o : %.c Makefile + $(CC) -c $(INCLUDES) $(CFLAGS) -o $@ $< + +clean: + -rm -f *.o diff --git a/contrib/C_Layer/EXAMPLE/rasterworks/rasterworks_example b/contrib/C_Layer/EXAMPLE/rasterworks/rasterworks_example new file mode 100755 index 0000000000000000000000000000000000000000..62832f911ca2055495ebb0578f92bc4b16fe516e GIT binary patch literal 16548 zcmeHOe{@q-o_}dy;Q^tEnrd9DJ~fPSt=MASL1Z*aqoA!u+5%cIgeIZUlyuSrih~aI zQRJOx&&i&3=P+|{hOTWg+oOU$fU81bz-~KufJANdjlfUV!0d~(7__J#^ z8V`G>r4u(V_Njk~7N5d(&W%P^`IjYyTpO@`p`a}llJpfX%Ce!fKN$U zyS_+V_j*@4akVd(6x2Hb2e%UWfsyR#4DUjfTXtxlK6#ne`CjRWMMrW>3 z2i$H^&})46Q1 zbTH?ClKO9NU*CQ^rf@qAez6NO)jy`x37S5vfFAZd-lR)Y|JY)s&I*~dUI*)ag1Xsc zOoTH{gc^7TYiaomlT;JG&*i$($titk;|BV2xCZ3gK1SDyo-_EHE3+5DS_*3#AP`+v zv~iShrBbV69ezw`c5KyC+;X(GAax*ZLE47218FbPAks;sVI-lL@BCkZ;Z$ne z+WRNIz}ou}8vk@_?>&sR$6A85_X$e7dtv@R=e1XhnHF4oL3AubqH9$$JSWIjRVsA? zZ9_=skoYMa=Rk5HRU>(jd`Lm0jYuh^?MS^y`;m?#sYo1RvxDL@QVmiAQVUWC(u+vj zkai&LMS2&BE+&J&IUdqnE~VF_p+H>k(;QZ74~C*4=9)S#9!uoW!9yd@kn8IG(a0Lq zG+HYA+gs78)#IUNto-$UjY4Y+N21YC(4XI>rD0L z*qXKeIo19|%s#sww8dQw`6>6$iFJ| zOe7RHj}eM%0m|PRNW>!)+%(>#OD%F~bp)9SXe<`=lV-*+ z1ZazNgrd3}tIw;4qmee^VDM!1wWfL`ng}5lMG`F#d~5^i#%3aNo&7l*$8~`W} zLu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X4+wgU0$Qn8?h#>FQA^lij#g=B!Q7%}?>6t#6SK4vrfgU?Ig zGa>r}TXi{pOHpXd$Ixi9)2qO426iGg9R&7$U@xUln)e8>^wkIb(qUX&GtC<>=q@^M z`u$Q9_@oN)c@d4KxwHYB1(w3`xG`xU6PA7hb)#cq{&^7C8ep$SJRZmQ8Z?^t((fXg z5wJHGlELJkq$5#4><6}>O`$)-H)!q`@(tqC0zR9szR^WxD7VDAC;TZMG8E?*}C_P1R)^h_kyRs(y*)tBC@Xx=Mvm zkp5`ie-A!!yj5#0#3zDAlYNf?`@saU9QNE=Z0y*Q#@hw@Gx%1cSOM%ZV3!xd@@T|4 zpdOidFZG}v1Red(`pY7WK{$Lp&%*~fdr47}<7uVYijy0r@TUNvKA47khqbeFCES`_ zmS+~zDb;d~eom!!Iy3D(nafoW;?YujQz_4hD3ZL#(7p&ccVDR>6)h+gTc?)__YIWt z_s!rCM!99w_hBwaJm{h}y3A)`(hJ;zOJUE4bZk7b$9B|jLazI=RK&zB6$|mG1&(+O zg64%h8aM_w9Rg7V=4S9D5UY}sX0S$9C4J0b0|1M)ges+#BF8O4-`IL0V5#+mVy(r# znb!&q9JtArrEdNESo=V!o#h8gtt`)!3M_vI0+CU0{9%4^40-PjTDbw`Q%Gsl zgUA^{sqjJ(leW~lxmYXMaXM#1I(dp})AgYS^q~&uLuD`&b}BX$GTb;)FxIcF9-OO? z3SDlrS0j0lYLS*91(Dj2=(<$@VGchA?ZEvcuJ^cR_WM36zhr40Eq~vF-vQ$1i`4$9 m1$UjzEpaM;MP=NyQTdLdwe4-Vi%W!|6Ucs{G +#include +#include +#include +#include + +int main() +{ + /* Load all libraries, initialize global tables like system color table and + operations table. kolibri_gui_init() will EXIT with mcall -1 if it fails + to do it's job. This is all you need to call and all libraries and GUI + elements can be used after a successful call to this function + */ + kolibri_gui_init(); + kolibri_rasterworks_init(); + /* Set gui_event to REDRAW so that window is drawn in first iteration */ + unsigned int gui_event = KOLIBRI_EVENT_REDRAW; + oskey_t key; + + kolibri_window *main_window = kolibri_new_window(50, 50, 800, 300, "rasterworks example"); + + extern volatile unsigned press_key; + + int ln_str = countUTF8Z("Пример работы", -1); + void *buffi = malloc(768*256*3 * sizeof(char)); + + *((int*)buffi) = 768; + *((int*)buffi+1) = 256; + + memset((char*)buffi+8, (char)-1, 768*256*3); + + debug_board_printf("String len: %d \n", ln_str); + + drawText(buffi, 0, 0, "Пример работы", ln_str, 0xFF000000, 0x30C18); + drawText(buffi, 0, 32, "Пример работы", ln_str, 0xFF000000, 0x1030C18); + drawText(buffi, 0, 64, "Пример работы", ln_str, 0xFF000000, 0x2030C18); + drawText(buffi, 0, 96, "Пример работы", ln_str, 0xFF000000, 0x4030C18); + drawText(buffi, 0, 128, "Пример работы", ln_str, 0xFF000000, 0x8030C18); + drawText(buffi, 0, 160, "Пример работы", ln_str, 0xFF000000, 0x0F031428); + + do /* Start of main activity loop */ + { + if(gui_event == KOLIBRI_EVENT_REDRAW) + { + kolibri_handle_event_redraw(main_window); + DrawBitmap(buffi, 5, 5, 768, 256); + } + else if(gui_event == KOLIBRI_EVENT_KEY) + { + key = get_key(); + switch (key.code) + { + } + press_key = key.val; + + kolibri_handle_event_key(main_window); + } + else if(gui_event == KOLIBRI_EVENT_BUTTON) + { + unsigned int pressed_button = kolibri_button_get_identifier(); + switch (pressed_button) + { + case BUTTON_CLOSE: + kolibri_exit(); + } + } + else if(gui_event == KOLIBRI_EVENT_MOUSE) + { + kolibri_handle_event_mouse(main_window); + } + + } while((gui_event = get_os_event())); /* End of main activity loop */ + + /* kolibri_quit(); */ + + return 0; +}