- kos32sys1.h: Tcc dont support aliasing but support defines
- boxlib sample: Update sample for upper fix
- Rasterworks example: Fix 'bright' letters

git-svn-id: svn://kolibrios.org@8171 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
maxcodehack 2020-11-10 18:53:57 +00:00
parent 97d7b5c34a
commit 1930e23f58
3 changed files with 45 additions and 6 deletions

View File

@ -757,7 +757,7 @@ void __attribute__ ((noinline)) debug_board_printf(const char *format,...)
// TinyC don't support aliasing of static inline funcs // TinyC don't support aliasing of static inline funcs, but support #define :)
#ifndef __TINYC__ #ifndef __TINYC__
static inline void BeginDraw(void) __attribute__ ((alias ("begin_draw"))); static inline void BeginDraw(void) __attribute__ ((alias ("begin_draw")));
static inline void EndDraw(void) __attribute__ ((alias ("end_draw"))); static inline void EndDraw(void) __attribute__ ((alias ("end_draw")));
@ -785,6 +785,28 @@ static inline void* UserRealloc(void *mem, size_t size) __attribute__ ((alias ("
static inline int *UserUnmap(void *base, size_t offset, size_t size) __attribute__ ((alias ("user_unmap"))); static inline int *UserUnmap(void *base, size_t offset, size_t size) __attribute__ ((alias ("user_unmap")));
static inline ufile_t LoadFile(const char *path) __attribute__ ((alias ("load_file"))); static inline ufile_t LoadFile(const char *path) __attribute__ ((alias ("load_file")));
static inline void GetProcInfo(char *info) __attribute__ ((alias ("get_proc_info"))); static inline void GetProcInfo(char *info) __attribute__ ((alias ("get_proc_info")));
#else
#define BeginDraw begin_draw
#define EndDraw end_draw
#define DrawWindow sys_create_window
#define DefineButton define_button
#define DrawLine draw_line
#define DrawBar draw_bar
#define DrawBitmap draw_bitmap
#define GetSkinHeight get_skin_height
#define GetMousePos get_mouse_pos
#define GetMouseButtons get_mouse_buttons
#define GetMouseWheels get_mouse_wheels
#define LoadCursor load_cursor
#define SetCursor set_cursor
#define DestroyCursor destroy_cursor
#define GetOsEvent get_os_event
#define UserAlloc user_alloc
#define UserFree user_free
#define UserRealloc user_realloc
#define UserUnmap user_unmap
#define LoadFile load_file
#define GetProcInfo get_proc_info
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -17,17 +17,18 @@
#define WIN_W 640 #define WIN_W 640
#define WIN_H 563 #define WIN_H 563
uint32_t wheels;
char* title = "Boxlib example"; char* title = "Boxlib example";
int win_bg_color = 0x858585; int win_bg_color = 0x858585;
scrollbar scroll = {15, WIN_W - 26, WIN_H - 29, 0, 0, 2, 215, 15, 0,0x707070,0xD2CED0,0x555555,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1}; scrollbar scroll = {15, WIN_W - 26, WIN_H - 29, 0, 0, 2, 215, 15, 0,0x707070,0xD2CED0,0x555555,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1};
progressbar pg = {0, 10, 10, 270, 35, 1, 0, 200, 0xB4B4B4, 0x2728FF, 0xA9A9A9}; progressbar pg = {0, 10, 10, 270, 35, 1, 0, 200, 0xB4B4B4, 0x2728FF, 0xA9A9A9};
void draw_window(){ void draw_window(){
begin_draw(); BeginDraw();
sys_create_window(215,100,WIN_W,WIN_H,title,win_bg_color,0x34); DrawWindow(215,100,WIN_W,WIN_H,title,win_bg_color,0x34);
scrollbar_v_draw(&scroll); scrollbar_v_draw(&scroll);
progressbar_draw(&pg); progressbar_draw(&pg);
end_draw(); EndDraw();
} }
//// EVENTMASK //// EVENTMASK
@ -53,7 +54,7 @@ int main()
set_event_mask(EVM_REDRAW + EVM_KEY + EVM_BUTTON + EVM_MOUSE + EVM_MOUSE_FILTER); set_event_mask(EVM_REDRAW + EVM_KEY + EVM_BUTTON + EVM_MOUSE + EVM_MOUSE_FILTER);
while(1) while(1)
{ {
switch(get_os_event()) switch(GetOsEvent())
{ {
case evButton: case evButton:
if (get_os_button() == 1) exit(0); if (get_os_button() == 1) exit(0);
@ -68,6 +69,22 @@ int main()
break; break;
case evMouse: case evMouse:
scrollbar_v_mouse(&scroll); scrollbar_v_mouse(&scroll);
// Wheel scrolling
// Quite unstable
/*
int scroll_strong = 40;
wheels = GetMouseWheels();
if(wheels & 0xFFFF)
{
if((short)wheels > 0 && scroll.position < scroll.max_area - scroll_strong)
scroll.position += scroll_strong;
else if((short)wheels < 0 && scroll.position > 0)
scroll.position -= scroll_strong;
scrollbar_v_draw(&scroll);
}
*/
pg.value = scroll.position; pg.value = scroll.position;
progressbar_draw(&pg); progressbar_draw(&pg);
break; break;

View File

@ -25,7 +25,7 @@ int main()
case 1: case 1:
begin_draw(); begin_draw();
sys_create_window(50, 50, 800, 300, "rasterworks example" ,0x34f0f0f0, 0x14); sys_create_window(50, 50, 800, 300, "rasterworks example" ,0x34f0f0f0, 0x14);
draw_bitmap(buffi, 5, 25, 768, 256); draw_bitmap(buffi+8, 5, 25, 768, 256);
end_draw(); end_draw();
break; break;