- Added macros X_W and Y_H and deleted debug kos32sys1.h

- Moved debug functions to libc.a
- Removed console.h since libcon no longer exists
- Added tcc_http_demo to build_all.sh
(Applies to ktcc)

git-svn-id: svn://kolibrios.org@8464 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
superturbocat2001
2020-12-21 18:08:02 +00:00
parent e532373af8
commit 1dab73b754
7 changed files with 50 additions and 238 deletions

View File

@@ -1,8 +1,6 @@
/*
newlib-style window example
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -10,6 +8,8 @@
#include "kos32sys1.h"
struct kolibri_system_colors sys_color_table;
void __attribute__ ((noinline)) debug_board_printf(const char *format,...);
void __attribute__ ((noinline)) debug_board_write_str(const char* str);
char statusbar[255];
char proc_info[1024];
@@ -66,17 +66,17 @@ void draw_window()
end_draw();
}
int main()
{
int main()
{
int gui_event;
uint32_t pressed_button = 0, mouse_button;
pos_t mouse_pos;
strcpy(statusbar, "Program running...Double click on TEXT for details");
strcpy(statusbar, "Program running...Double click on TEXT for details");
get_system_colors(&sys_color_table);
set_event_mask(0xC0000027); // mouse events only when focused window and mouse inside
set_event_mask(0xC0000027); // mouse events only when focused window and mouse inside
do /* Start of main activity loop */
do /* Start of main activity loop */
{
// gui_event = wait_for_event(10); // 100 = 1 sec, case you have background work
gui_event = get_os_event();
@@ -92,22 +92,22 @@ int main()
// scroll
break;
case KOLIBRI_EVENT_BUTTON:
pressed_button = get_os_button();
switch (pressed_button)
{
pressed_button = get_os_button();
switch (pressed_button)
{
case BTN_POP:
strcpy(statusbar, "POP pressed....");
draw_window();
break;
case BTN_UNLOCK:
strcpy(statusbar, "UNLOCK pressed....");
draw_window();
break;
case BTN_QUIT:
return 0;
break;
}
break;
break;
case BTN_UNLOCK:
strcpy(statusbar, "UNLOCK pressed....");
draw_window();
break;
case BTN_QUIT:
return 0;
break;
}
break;
case KOLIBRI_EVENT_MOUSE:
mouse_pos = get_mouse_pos(POS_WINDOW); // window relative
mouse_button = get_mouse_eventstate();
@@ -117,23 +117,23 @@ int main()
int n = (mouse_pos.y - 60) / FONT_H;
if (n < 0 || n >= LINES) break;
debug_board_printf("click on str(%d), clip slot(%d)\n", n, LINES - n - 1);
tiny_sprintf(statusbar, "click on str(%d), clip slot(%d)\n", n, LINES - n - 1);
tiny_sprintf(statusbar, "click on str(%d), clip slot(%d)\n", n, LINES - n - 1);
draw_window();
}
// ignore
break;
break;
}
} while(1) ; /* End of main activity loop */
return 0;
}
} while(1) ; /* End of main activity loop */
return 0;
}
void __attribute__ ((noinline)) debug_board_write_str(const char* str){
while(*str)
debug_board_write_byte(*str++);
}
void __attribute__ ((noinline)) debug_board_write_str(const char* str){
while(*str)
debug_board_write_byte(*str++);
}
void __attribute__ ((noinline)) debug_board_printf(const char *format,...)
{