/contrib/media/fplay/skin/skin.asm |
---|
101,3 → 101,4 |
_res_prg_level: file 'prg_level.raw' |
_res_def_font: file 'IstokWeb.ttf' |
/contrib/media/fplay/winlib/link.h |
---|
0,0 → 1,60 |
typedef struct link |
{ |
struct link *prev; |
struct link *next; |
}link_t; |
#define LIST_INITIALIZE(name) \ |
link_t name = { .prev = &name, .next = &name } |
#define list_get_instance(link, type, member) \ |
((type *)(((u8_t *)(link)) - ((u8_t *)&(((type *)NULL)->member)))) |
static inline void link_initialize(link_t *link) |
{ |
link->prev = NULL; |
link->next = NULL; |
} |
static inline void list_initialize(link_t *head) |
{ |
head->prev = head; |
head->next = head; |
} |
static inline void list_append(link_t *link, link_t *head) |
{ |
link->prev = head->prev; |
link->next = head; |
head->prev->next = link; |
head->prev = link; |
} |
static inline void list_remove(link_t *link) |
{ |
link->next->prev = link->prev; |
link->prev->next = link->next; |
link_initialize(link); |
} |
static inline int list_empty(link_t *head) |
{ |
return head->next == head ? 1 : 0; |
} |
static inline void list_prepend(link_t *link, link_t *head) |
{ |
link->next = head->next; |
link->prev = head; |
head->next->prev = link; |
head->next = link; |
} |
static inline void list_insert(link_t *new, link_t *old) |
{ |
new->prev = old->prev; |
new->next = old; |
new->prev->next = new; |
old->prev = new; |
} |
/contrib/media/fplay/winlib/timer.h |
---|
0,0 → 1,46 |
static uint32_t update_timers(uint32_t realtime) |
{ |
ostimer_t *timer; |
uint32_t exp_time = -1; |
timer = (ostimer_t*)timers.next; |
while( &timer->link != &timers) |
{ |
ostimer_t *tmp; |
tmp = timer; |
timer = (ostimer_t*)timer->link.next; |
if( tmp->exp_time < realtime) |
{ |
list_remove(&tmp->link); |
send_message(tmp->ctrl, MSG_TIMER, tmp->tmr_arg, tmp); |
} |
}; |
timer = (ostimer_t*)timers.next; |
while( &timer->link != &timers) |
{ |
if( exp_time > timer->exp_time) |
exp_time = timer->exp_time; |
timer = (ostimer_t*)timer->link.next; |
} |
return exp_time; |
}; |
int set_timer(ctrl_t *ctrl, ostimer_t *timer, uint32_t delay) |
{ |
if( ctrl && timer &&delay) |
{ |
timer->ctrl = ctrl; |
timer->exp_time = realtime + delay; |
if( exp_time > timer->exp_time) |
exp_time = timer->exp_time; |
list_append(&timer->link, &timers); |
}; |
return 0; |
} |
/contrib/media/fplay/winlib/window.c |
---|
18,6 → 18,7 |
int win_font; |
static window_t Window; |
static pos_t old_pos; |
35,18 → 36,33 |
void adjust_frame(window_t *win); |
//#include "timer.h" |
ctrl_t *win_get_child(window_t *win, int x, int y) |
{ |
ctrl_t *child = NULL; |
#include "control.inc" |
//#include "io.inc" |
#include "timer.inc" |
if( win ) |
{ |
if(pt_in_rect(&win->client, x, y)) |
{ |
ctrl_t *tmp = (ctrl_t*)win->child.next; |
//#include "button.inc" |
//#include "scroller.inc" |
while( &tmp->link != &win->child ) |
{ |
if(pt_in_rect(&tmp->rc, x, y)) |
{ |
child = get_child(tmp, x, y); |
return child == NULL ? tmp : child; |
}; |
tmp = (ctrl_t*)tmp->link.next; |
}; |
} |
else child = (ctrl_t*)(&win->frame); |
}; |
return child; |
}; |
static window_t Window; |
void init_frame(window_t *win); |
window_t *create_window(char *caption, int style, int x, int y, |