forked from KolibriOS/kolibrios
- 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:
@@ -14,6 +14,7 @@
|
||||
../tcc dir_example.c -lck -o /tmp0/1/dir_example
|
||||
../tcc net/tcpsrv_demo.c -lck -o /tmp0/1/tcpsrv_demo
|
||||
../tcc net/nslookup.c -lck -lnetwork -o /tmp0/1/nslookup
|
||||
../tcc net/http_tcp_demo.c -lck -lnetwork -o /tmp0/1/http_tcp_demo
|
||||
../tcc getopt_ex.c -lck -o /tmp0/1/getopt_ex
|
||||
../tcc tinygl/fps.c tinygl/gears.c -o /tmp0/1/gears -ltinygl -lck
|
||||
exit
|
||||
|
@@ -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,...)
|
||||
{
|
||||
|
Reference in New Issue
Block a user