return D_SUCCESS;
}
+int display_hor_line(t_display *display,int Y,char sym) {
+
+ display_line(display,0,Y,display->max_x,Y,sym);
+
+ return D_SUCCESS;
+}
+
int display_string(t_display *display,int x,int y,char *string,int len) {
if(len>display->max_x-x) return D_INV_STRING_LEN;
int display_clear_screen(t_display *display);
int display_shutdown(t_display *display);
int display_line(t_display *display,int X,int Y,int X_,int Y_,char sym);
+int display_hor_line(t_display *display,int Y,char sym);
int display_string(t_display *display,int x,int y,char *string,int len);
int display_string_vert(t_display *display,int x,int y,char *string,int len);
return E_SUCCESS;
}
+int event_set_immediately(t_event *event,unsigned char value) {
+
+ if(value==IMM_TRUE)
+ event->immediately=value;
+
+ return E_SUCCESS;
+}
+
int event_math(int fd,t_event *event,char rw,char ar) {
if(ar==ADD) {
event->wfds=event->wfds_o;
tv=event->timeout;
- if((tv.tv_sec==0)&&(tv.tv_usec==0)) tv_ptr=NULL;
+ if((tv.tv_sec==0)&&(tv.tv_usec==0)&&(!(event->immediately))) tv_ptr=NULL;
else tv_ptr=&tv;
if((s_ret=select(event->maxfd+1,&(event->rfds),&(event->wfds),NULL,
#define ADD 'a'
#define REMOVE 'r'
+/* immediatley values */
+#define IMM_FALSE 0
+#define IMM_TRUE 1
+
/* event specific variables */
typedef struct s_event {
int outfd;
fd_set rfds,rfds_o;
fd_set wfds,wfds_o;
struct timeval timeout;
+ unsigned char immediately;
unsigned char status;
} t_event;
/* function prototypes */
int event_init(t_event *event,int outfd);
int event_set_timeout(t_event *event,int sec,int usec);
+int event_set_immediately(t_event *event,unsigned char value);
int event_math(int fd,t_event *event,char rw,char ar);
int event_start(t_event *event,void *ptr,
int (*callback0)(t_event *event,void *ptr),