/********* BitMap::Clear() *************************************/ VOID MNAME_BM(Clear)(OOP_Class *cl, OOP_Object *o, struct pHidd_BitMap_Clear *msg) { IPTR width, height; struct bitmap_data *data = OOP_INST_DATA(cl, o); struct Box box = {0, 0, 0, 0}; /* Get width & height from bitmap superclass */ OOP_GetAttr(o, aHidd_BitMap_Width, &width); OOP_GetAttr(o, aHidd_BitMap_Height, &height); box.x2 = width - 1; box.y2 = height - 1; memset(data->VideoData, GC_BG(msg->gc), width*height); #ifdef OnBitmap ObtainSemaphore(&XSD(cl)->HW_acc); vgaRefreshArea(data, 1, &box); draw_mouse(XSD(cl)); ReleaseSemaphore(&XSD(cl)->HW_acc); #endif /* OnBitmap */ return; }
void draw_again(int id) { draw_background(id); unsigned short color = FONT_COLOR; if(id >= 3) color = 0x0000; draw_icon(ICON_FINDER, ICON_X1, ICON_Y); draw_string(ICON_X1 + 12, ICON_STRING_Y, "FINDER", color); draw_icon(ICON_PHOTO, ICON_X2, ICON_Y); draw_string(ICON_X2 + 12, ICON_STRING_Y, "PHOTO", color); draw_icon(ICON_TEXT, ICON_X3, ICON_Y); draw_string(ICON_X3 + 20, ICON_STRING_Y, "TEXT", color); draw_icon(ICON_GAME, ICON_X4, ICON_Y); draw_string(ICON_X4 + 17, ICON_STRING_Y, "GAME", color); draw_icon(ICON_DRAW, ICON_X5, ICON_Y); draw_string(ICON_X5 + 17, ICON_STRING_Y, "DRAW", color); draw_icon(ICON_SETTING, ICON_X6, ICON_Y); draw_string(ICON_X6 + 8, ICON_STRING_Y, "SETTING", color); draw_mouse(ori_x_mouse, ori_y_mouse); struct Window* win = Get_LastWindow(); while(win != 0) { draw_window(win); win = win->pre; } display_to_screen(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); }
void GrMouseDisplayCursor(void) { if (MOUINFO->msstatus != 2) return; if (MOUINFO->cursor == NULL) return; if (MOUINFO->displayed != FALSE) return; move_mouse(); draw_mouse(); MOUINFO->displayed = TRUE; MOUINFO->docheck = TRUE; MOUINFO->blockflag = 0; }
static void unblock(int flags) { if (!MOUINFO->displayed) return; if (flags & MOUINFO->blockflag & ERASED) { draw_mouse(); MOUINFO->blockflag &= ~ERASED; MOUINFO->docheck = TRUE; } if (flags & MOUINFO->blockflag & BLOCKED) { MOUINFO->blockflag &= ~BLOCKED; } }
/* mouse_move: * Timer interrupt handler for redrawing the mouse pointer. */ static void mouse_move(void) { if (mouse_semaphore) return; mouse_semaphore = TRUE; /* periodic poll */ if (mouse_driver->timer_poll) { mouse_driver->timer_poll(); if (!mouse_polled) update_mouse(); } /* redraw pointer */ if ((!freeze_mouse_flag) && (_mouse_screen) && ((mx != _mouse_x) || (my != _mouse_y) || (mon != _mouse_on))) { acquire_bitmap(_mouse_screen); if (gfx_capabilities & GFX_HW_CURSOR) { if (_mouse_on) { gfx_driver->move_mouse(mx=_mouse_x, my=_mouse_y); mon = TRUE; } else { gfx_driver->move_mouse(mx=MOUSE_OFFSCREEN, my=MOUSE_OFFSCREEN); mon = FALSE; } } else { #ifdef ALLEGRO_DOS /* bodge to avoid using non legacy 386 asm code inside a timer handler */ int old_capabilities = cpu_capabilities; cpu_capabilities = 0; #endif draw_mouse(TRUE, TRUE); #ifdef ALLEGRO_DOS cpu_capabilities = old_capabilities; #endif } release_bitmap(_mouse_screen); } mouse_semaphore = FALSE; }
VOID MNAME_BM(PutImageLUT)(OOP_Class *cl, OOP_Object *o, struct pHidd_BitMap_PutImageLUT *msg) { struct bitmap_data *data = OOP_INST_DATA(cl, o); struct Box box = {0, 0, 0, 0}; EnterFunc(bug("VGAGfx.BitMap::PutImageLUT(pa=%p, x=%d, y=%d, w=%d, h=%d)\n", msg->pixels, msg->x, msg->y, msg->width, msg->height)); HIDD_BM_CopyMemBox8(o, msg->pixels, 0, 0, data->VideoData, msg->x, msg->y, msg->width, msg->height, msg->modulo, data->width); if (data->disp) { box.x1 = msg->x; box.y1 = msg->y; box.x2 = box.x1 + msg->width - 1; box.y2 = box.y1 + msg->height - 1; ObtainSemaphore(&XSD(cl)->HW_acc); vgaRefreshArea(data, 1, &box); if ( ( (XSD(cl)->mouseX + XSD(cl)->mouseW - 1 >= box.x1) && (XSD(cl)->mouseX <= box.x2) ) || ( (XSD(cl)->mouseY + XSD(cl)->mouseH - 1 >= box.y1) && (XSD(cl)->mouseY <= box.y2) ) ) draw_mouse(XSD(cl)); ReleaseSemaphore(&XSD(cl)->HW_acc); } ReturnVoid("VGAGfx.BitMap::PutImageLUT"); }
void draw_bottom(int id) { /*int i, j; for(i = 0; i < SCREEN_WIDTH; ++i) { for(j = 0; j < SCREEN_HEIGHT; ++j) { unsigned int offset = j * SCREEN_WIDTH + i; *(VESA_ADDR + offset) = RECORD_COLOR[i][j]; } }*/ draw_background(id); unsigned short color = FONT_COLOR; if(id >= 3) color = 0x0000; draw_icon(ICON_FINDER, ICON_X1, ICON_Y); draw_string(ICON_X1 + 12, ICON_STRING_Y, "FINDER", color); draw_icon(ICON_PHOTO, ICON_X2, ICON_Y); draw_string(ICON_X2 + 12, ICON_STRING_Y, "PHOTO", color); draw_icon(ICON_TEXT, ICON_X3, ICON_Y); draw_string(ICON_X3 + 20, ICON_STRING_Y, "TEXT", color); draw_icon(ICON_GAME, ICON_X4, ICON_Y); draw_string(ICON_X4 + 17, ICON_STRING_Y, "GAME", color); draw_icon(ICON_DRAW, ICON_X5, ICON_Y); draw_string(ICON_X5 + 17, ICON_STRING_Y, "DRAW", color); draw_icon(ICON_SETTING, ICON_X6, ICON_Y); draw_string(ICON_X6 + 8, ICON_STRING_Y, "SETTING", color); draw_mouse(ori_x_mouse, ori_y_mouse); struct Window* win = Get_LastWindow(); while(win != 0) { if(win->pre != 0) draw_window(win); win = win->pre; } //display_to_screen(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); }
VOID MNAME_BM(PutPixel)(OOP_Class *cl, OOP_Object *o, struct pHidd_BitMap_PutPixel *msg) { struct bitmap_data *data = OOP_INST_DATA(cl, o); HIDDT_Pixel fg; unsigned char *ptr; #ifdef OnBitmap int pix; int i; unsigned char *ptr2; #endif /* OnBitmap */ fg = msg->pixel; ptr = (char *)(data->VideoData + msg->x + (msg->y * data->width)); *ptr = (char) fg; #ifdef OnBitmap ptr2 = (char *)(0xa0000 + (msg->x + (msg->y * data->width)) / 8); pix = 0x8000 >> (msg->x % 8); ObtainSemaphore(&XSD(cl)->HW_acc); outw(0x3c4,0x0f02); outw(0x3ce,pix | 8); outw(0x3ce,0x0005); outw(0x3ce,0x0003); outw(0x3ce,(fg << 8)); outw(0x3ce,0x0f01); *ptr2 |= 1; // This or'ed value isn't important if (((msg->x >= XSD(cl)->mouseX) && (msg->x < (XSD(cl)->mouseX + XSD(cl)->mouseW))) || ((msg->y >= XSD(cl)->mouseY) && (msg->y < (XSD(cl)->mouseY + XSD(cl)->mouseH)))) draw_mouse(XSD(cl)); ReleaseSemaphore(&XSD(cl)->HW_acc); #endif /* OnBitmap */ return; }
void draw_loading() { draw_background(0); draw_icon(ICON_FINDER, ICON_X1, ICON_Y); draw_string(ICON_X1 + 12, ICON_STRING_Y, "FINDER", FONT_COLOR); draw_icon(ICON_PHOTO, ICON_X2, ICON_Y); draw_string(ICON_X2 + 12, ICON_STRING_Y, "PHOTO", FONT_COLOR); draw_icon(ICON_TEXT, ICON_X3, ICON_Y); draw_string(ICON_X3 + 20, ICON_STRING_Y, "TEXT", FONT_COLOR); draw_icon(ICON_GAME, ICON_X4, ICON_Y); draw_string(ICON_X4 + 17, ICON_STRING_Y, "GAME", FONT_COLOR); draw_icon(ICON_DRAW, ICON_X5, ICON_Y); draw_string(ICON_X5 + 17, ICON_STRING_Y, "DRAW", FONT_COLOR); draw_icon(ICON_SETTING, ICON_X6, ICON_Y); draw_string(ICON_X6 + 8, ICON_STRING_Y, "SETTING", FONT_COLOR); display_to_screen(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); draw_mouse(ori_x_mouse, ori_y_mouse); InitNode(); InitWindow(); }
void mouseintr(uint tick) { uint ch; ch = inb(0x64); if((ch & 0x01) == 0) { //cprintf("no data\n"); state = 1; return; } acquire(&mouse_lock); ch = inb(0x60); if(state == 1) { if((ch & 0x08) == 0 || (ch & 0x04) != 0) { release(&mouse_lock); return; } left_down = (ch & 0x01) ? 1 : 0; right_down = (ch & 0x02) ? 1 : 0; x_sign = (ch & 0x10) ? 1 : 0; y_sign = (ch & 0x20) ? 1 : 0; x_overflow = (ch & 0x40) ? 1 : 0; y_overflow = (ch & 0x80) ? 1 : 0; state = 2; release(&mouse_lock); //cprintf("state1\n"); //cprintf("overflow: %d\n", y_overflow); return; } else if(state == 2) { int dis; if(x_sign == 0) dis = ch; else dis = ch - 256; if(dis > 50 || dis < -50) { //cprintf("error"); state = 1; release(&mouse_lock); return; } //cprintf("xdis: %d, sign: %d\n", dis, x_sign); x_position += dis; if(x_position < 0) x_position = 0; if(x_position > SCREEN_WIDTH - SIZE_X_MOUSE) x_position = SCREEN_WIDTH - SIZE_X_MOUSE; state = 3; release(&mouse_lock); //cprintf("state2\n"); return; } else if(state == 3) { int dis; if(y_sign == 0) dis = ch; else dis = ch - 256; if(dis > 50 || dis < -50) { //cprintf("error"); state = 1; release(&mouse_lock); return; } //cprintf("ydis: %d, sign: %d, overflow: %d\n", dis, y_sign, y_overflow); y_position -= dis; if(y_position < 0) y_position = 0; if(y_position > SCREEN_HEIGHT - SIZE_Y_MOUSE) y_position = SCREEN_HEIGHT - SIZE_Y_MOUSE; state = 1; release(&mouse_lock); //cprintf("state3\n"); } else { state = 1; release(&mouse_lock); return; } event = 0; if(left_already_down == 0 && right_already_down == 0) { if(left_down == 1) { left_already_down = 1; x_drag_start = x_position; y_drag_start = y_position; } else if(right_down == 1) { right_already_down = 1; } } else if(left_already_down == 1) { if(left_down == 0) { //cprintf("dragging: %d\n", is_dragging); if(is_dragging == 1) { event = DRAG_RELEASE; is_dragging = 0; } else { int dtick = tick - left_click_tick; //cprintf("tick: %d\n", dtick); if(dtick > 15) { event = LEFT_CLICK; left_click_tick = tick; } else { event = DOUBLE_CLICK; left_click_tick = -20; } } left_already_down = 0; } else { event = DRAGGING; is_dragging = 1; } } else if(right_already_down == 1) { if(right_down == 0) { event = RIGHT_CLICK; right_already_down = 0; } } if(event == 0) { draw_mouse(x_position, y_position); return; } struct Window* win; int click_icon = -1; if(y_position > ICON_Y && y_position < ICON_Y + 75 + 18) { if(event != LEFT_CLICK) { draw_mouse(x_position, y_position); return; } if(x_position > ICON_X1 && x_position < ICON_X1 + 75) { click_icon = ICON_FINDER; } else if(x_position > ICON_X2 && x_position < ICON_X2 + 75) { click_icon = ICON_PHOTO; } else if(x_position > ICON_X3 && x_position < ICON_X3 + 75) { click_icon = ICON_TEXT; } else if(x_position > ICON_X4 && x_position < ICON_X4 + 75) { click_icon = ICON_GAME; } else if(x_position > ICON_X5 && x_position < ICON_X5 + 75) { click_icon = ICON_DRAW; } else if(x_position > ICON_X6 && x_position < ICON_X6 + 75) { click_icon = ICON_SETTING; } else { draw_mouse(x_position, y_position); return; } win = get_window_by_icon(click_icon); if(click_icon == ICON_FINDER || win == 0) { win = Add_Window(click_icon); if(win != 0) draw_window(win); } else if(win != 0 && WindowLine->next != win) { draw_window(win); Focus(win); } display_to_screen(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); draw_mouse(x_position, y_position); return; } win = Click_Get_Window(x_position, y_position); if(win != 0 && WindowLine->next != win) { //cprintf("window: %d\n", win->Cur_icon); if(event == LEFT_CLICK) { draw_window(win); display_to_screen(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); Focus(win); } } else if(win != 0) { int Pos_x, Pos_y; Pos_x = x_position - win->Pos_x; Pos_y = y_position - win->Pos_y; if(Pos_x > 2 && Pos_x < 18 && Pos_y > 2 && Pos_y < 18) { Close_Window(); draw_again(get_current_bg()); } else if(Pos_y < 20) { if(event == DRAGGING) { if(dragging_top_window == 0) { dragging_top_window = 1; x_drag_window = win->Pos_x; y_drag_window = win->Pos_y; dragging_count = 0; } dragging_count = (dragging_count + 1) % 5; if(dragging_count != 0) return; if(x_drag_window + (x_position - x_drag_start) < 0 || x_drag_window + (x_position - x_drag_start) + WindowWidth > SCREEN_WIDTH || y_drag_window + (y_position - y_drag_start) < 0 || y_drag_window + (y_position - y_drag_start) + WindowHeight > SCREEN_HEIGHT) return; draw_bottom(get_current_bg()); win->Pos_x = x_drag_window + (x_position - x_drag_start); win->Pos_y = y_drag_window + (y_position - y_drag_start); draw_window(win); display_to_screen(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); } else if(event == DRAG_RELEASE) { if(dragging_top_window == 1) dragging_top_window = 0; } } else if(Pos_y > 20 && Pos_y < WindowHeight - 20) { switch(win->Cur_icon) { case ICON_DRAW: draw(win, Pos_x, Pos_y, event); break; case ICON_SETTING: setting(Pos_x, Pos_y, event); break; case ICON_FINDER: Folder(win, Pos_x, Pos_y, event); break; case ICON_GAME: pointInGameWindow(Pos_x, Pos_y, event); break; case 8://LIST_FINDER Folder(win, Pos_x, Pos_y, event); break; case 9://LAYOUT_FINDER Folder(win, Pos_x, Pos_y, event); break; } } } draw_mouse(x_position, y_position); }
/*** BitMap::BlitColorExpansion() **********************************************/ VOID MNAME_BM(BlitColorExpansion)(OOP_Class *cl, OOP_Object *o, struct pHidd_BitMap_BlitColorExpansion *msg) { ULONG cemd; struct bitmap_data *data = OOP_INST_DATA(cl, o); struct Box box; HIDDT_Pixel fg, bg; LONG x, y; EnterFunc(bug("VGAGfx.BitMap::BlitColorExpansion(%p, %d, %d, %d, %d, %d, %d)\n" , msg->srcBitMap, msg->srcX, msg->srcY, msg->destX, msg->destY, msg->width, msg->height)); fg = GC_FG(msg->gc); bg = GC_BG(msg->gc); cemd = GC_COLEXP(msg->gc); if (cemd & vHidd_GC_ColExp_Opaque) { for (y = 0; y < msg->height; y ++) { for (x = 0; x < msg->width; x ++) { ULONG is_set; is_set = HIDD_BM_GetPixel(msg->srcBitMap, x + msg->srcX, y + msg->srcY); *(data->VideoData + x + msg->destX + ((y + msg->destY) * data->width)) = is_set ? fg : bg; } /* for (each x) */ } /* for (each y) */ } else { for (y = 0; y < msg->height; y ++) { for (x = 0; x < msg->width; x ++) { ULONG is_set; is_set = HIDD_BM_GetPixel(msg->srcBitMap, x + msg->srcX, y + msg->srcY); if (is_set) *(data->VideoData + x + msg->destX + ((y + msg->destY) * data->width)) = fg; } /* for (each x) */ } /* for (each y) */ } if (data->disp) { box.x1 = msg->destX; box.y1 = msg->destY; box.x2 = box.x1 + msg->width - 1; box.y2 = box.y1 + msg->height - 1; ObtainSemaphore(&XSD(cl)->HW_acc); vgaRefreshArea(data, 1, &box); if ( ( (XSD(cl)->mouseX + XSD(cl)->mouseW - 1 >= box.x1) && (XSD(cl)->mouseX <= box.x2) ) || ( (XSD(cl)->mouseY + XSD(cl)->mouseH - 1 >= box.y1) && (XSD(cl)->mouseY <= box.y2) ) ) draw_mouse(XSD(cl)); ReleaseSemaphore(&XSD(cl)->HW_acc); } ReturnVoid("VGAGfx.BitMap::BlitColorExpansion"); }
VOID MNAME_BM(FillRect)(OOP_Class *cl, OOP_Object *o, struct pHidd_BitMap_DrawRect *msg) { struct bitmap_data *data =OOP_INST_DATA(cl, o); struct Box box = {0, 0, 0, 0}; HIDDT_Pixel fg = GC_FG(msg->gc); HIDDT_DrawMode mode = GC_DRMD(msg->gc); EnterFunc(bug("VGAGfx.BitMap::FillRect(%d,%d,%d,%d)\n", msg->minX, msg->minY, msg->maxX, msg->maxY)); switch(mode) { case vHidd_GC_DrawMode_Copy: HIDD_BM_FillMemRect8(o, data->VideoData, msg->minX, msg->minY, msg->maxX, msg->maxY, data->width, fg); break; case vHidd_GC_DrawMode_Invert: HIDD_BM_InvertMemRect(o, data->VideoData, msg->minX, msg->minY, msg->maxX, msg->maxY, data->width); break; default: OOP_DoSuperMethod(cl, o, (OOP_Msg)msg); break; } /* switch(mode) */ if (data->disp) { box.x1 = msg->minX; box.y1 = msg->minY; box.x2 = msg->maxX; box.y2 = msg->maxY; ObtainSemaphore(&XSD(cl)->HW_acc); vgaRefreshArea(data, 1, &box); if ( ( (XSD(cl)->mouseX + XSD(cl)->mouseW - 1 >= box.x1) && (XSD(cl)->mouseX <= box.x2) ) || ( (XSD(cl)->mouseY + XSD(cl)->mouseH - 1 >= box.y1) && (XSD(cl)->mouseY <= box.y2) ) ) draw_mouse(XSD(cl)); ReleaseSemaphore(&XSD(cl)->HW_acc); } ReturnVoid("VGAGfx.BitMap::FillRect"); }
VOID MNAME_BM(PutImage)(OOP_Class *cl, OOP_Object *o, struct pHidd_BitMap_PutImage *msg) { struct bitmap_data *data = OOP_INST_DATA(cl, o); struct Box box = {0, 0, 0, 0}; BOOL done_by_superclass = FALSE; int i; EnterFunc(bug("VGAGfx.BitMap::PutImage(pa=%p, x=%d, y=%d, w=%d, h=%d)\n", msg->pixels, msg->x, msg->y, msg->width, msg->height)); switch(msg->pixFmt) { case vHidd_StdPixFmt_Native: HIDD_BM_CopyMemBox8(o, msg->pixels, 0, 0, data->VideoData, msg->x, msg->y, msg->width, msg->height, msg->modulo, data->width); break; case vHidd_StdPixFmt_Native32: HIDD_BM_PutMem32Image8(o, msg->pixels, data->VideoData, msg->x, msg->y, msg->width, msg->height, msg->modulo, data->width); break; default: OOP_DoSuperMethod(cl, o, (OOP_Msg)msg); done_by_superclass = TRUE; break; } if (data->disp && !done_by_superclass) { box.x1 = msg->x; box.y1 = msg->y; box.x2 = box.x1 + msg->width - 1; box.y2 = box.y1 + msg->height - 1; ObtainSemaphore(&XSD(cl)->HW_acc); vgaRefreshArea(data, 1, &box); if ( ( (XSD(cl)->mouseX + XSD(cl)->mouseW - 1 >= box.x1) && (XSD(cl)->mouseX <= box.x2) ) || ( (XSD(cl)->mouseY + XSD(cl)->mouseH - 1 >= box.y1) && (XSD(cl)->mouseY <= box.y2) ) ) draw_mouse(XSD(cl)); ReleaseSemaphore(&XSD(cl)->HW_acc); } ReturnVoid("VGAGfx.BitMap::PutImage"); }
/* show_mouse: * Tells Allegro to display a mouse pointer. This only works when the timer * module is active. The mouse pointer will be drawn onto the bitmap bmp, * which should normally be the hardware screen. To turn off the mouse * pointer, which you must do before you draw anything onto the screen, call * show_mouse(NULL). If you forget to turn off the mouse pointer when * drawing something, the SVGA bank switching code will become confused and * will produce garbage all over the screen. */ void show_mouse(BITMAP *bmp) { if (!mouse_driver) return; remove_int(mouse_move); /* Remove the mouse cursor */ if (_mouse_screen) { acquire_bitmap(_mouse_screen); if (gfx_capabilities & GFX_HW_CURSOR) { gfx_driver->hide_mouse(); gfx_capabilities &= ~(GFX_HW_CURSOR|GFX_SYSTEM_CURSOR); hw_cursor_dirty = TRUE; } else draw_mouse(TRUE, FALSE); release_bitmap(_mouse_screen); } _mouse_screen = bmp; if (bmp && (current_cursor != MOUSE_CURSOR_NONE)) { acquire_bitmap(_mouse_screen); /* Default system cursor? */ if ((current_cursor != MOUSE_CURSOR_ALLEGRO) && allow_system_cursor) { if (mouse_driver && mouse_driver->select_system_cursor) { use_system_cursor = mouse_driver->select_system_cursor(current_cursor); if (use_system_cursor) { gfx_capabilities |= GFX_HW_CURSOR|GFX_SYSTEM_CURSOR; hw_cursor_dirty = FALSE; got_hw_cursor = TRUE; } } } else { use_system_cursor = FALSE; } /* Custom hardware cursor? */ if (hw_cursor_dirty) { got_hw_cursor = FALSE; if ((gfx_driver) && (gfx_driver->set_mouse_sprite) && (!_dispsw_status)) if (gfx_driver->set_mouse_sprite(mouse_sprite, mouse_x_focus, mouse_y_focus) == 0) got_hw_cursor = TRUE; hw_cursor_dirty = FALSE; } /* Try to display hardware (custom or system) cursor */ if ((got_hw_cursor) && (is_same_bitmap(bmp, screen))) if (gfx_driver->show_mouse(bmp, mx=mouse_x, my=mouse_y) == 0) gfx_capabilities |= GFX_HW_CURSOR; /* Draw cursor manually if we can't do that */ if (!(gfx_capabilities & GFX_HW_CURSOR)) { draw_mouse(FALSE, TRUE); use_system_cursor = FALSE; } release_bitmap(_mouse_screen); install_int(mouse_move, 10); } else { if (mouse_driver->timer_poll) install_int(mouse_move, 10); } }
static void test_bitmap() { draw_bitmap((bitmap_t*)(p_bk_img_mem), 0, 0, 1024, 768, 0, 0); draw_bitmap((bitmap_t*)(BMP_TEST_ADDR), 500, 500, 60, 18, 0, 0); draw_mouse(); }
void *mouse_ops(void *arg) { mouse_t mevent; memset(&mevent,0,sizeof(mevent)); fb_info mous_inf = fb_inf;; int mfd = open_mice(NULL); int pre_px,pre_py; sleep(1); while(1) { pre_px = mevent.px; pre_py = mevent.py; read_mice(mfd, &mevent, mous_inf); if(mevent.px != pre_px || mevent.py != pre_py){ pthread_mutex_lock(&mutex_lock); memcpy(fb_inf.fbmem,screen_save,screen_size); draw_mouse(mous_inf,mevent); pthread_mutex_unlock(&mutex_lock); usleep(20000); } //recover_mouse(mous_inf,mevent); if(welcome_flag == 1){ if(mevent.button == 1) { if(mevent.px > 200 && mevent.px < 336 && mevent.py > 176 && mevent.py < 200){ pthread_mutex_lock(&mutex_lock); display_string("自动播放",200,200,fb_inf,0x777777); pthread_mutex_unlock(&mutex_lock); rool_flag = 1; mevent.button = 0; mouse_global_flag = 0; usleep(100000); }else if(mevent.px > 406 && mevent.px < 530 && mevent.py > 373 && mevent.py < 400){ pthread_mutex_lock(&mutex_lock); display_string("手动播放",400,400,fb_inf,0x777777); pthread_mutex_unlock(&mutex_lock); rool_flag = 1; mevent.button = 0; mouse_global_flag = 1; }else if(mevent.px > 606 && mevent.px < 730 && mevent.py > 569 && mevent.py < 595){ pthread_mutex_lock(&mutex_lock); display_string("音乐播放",600,600,fb_inf,0x777777); pthread_mutex_unlock(&mutex_lock); rool_flag = 1; mevent.button = 0; mouse_global_flag = 2; }else if(mevent.px > 950 && mevent.px < 1000 && mevent.py > 725 && mevent.py < 753){ pthread_mutex_lock(&mutex_lock); display_string("退出",950,750,fb_inf,0x777777); pthread_mutex_unlock(&mutex_lock); rool_flag = 1; mevent.button = 0; mouse_global_flag = 3; } } }else{ if(mevent.button == 1) { if(mevent.px > 950 && mevent.px < 1000 && mevent.py > 725 && mevent.py < 753){ init_ft("./res/fonts/stsong.ttf",30); display_string("返回",950,750,fb_inf,0x777777); mevent.button = 0; mouse_global_flag = 2; }else{ rool_flag = 1; mevent.button = 0; mouse_global_flag = 1; } } else if(mevent.button == 2){ mouse_global_flag = -1; mevent.button = 0; }else if(mevent.button == 4){ mouse_global_flag = 0; mevent.button = 0; } } usleep(10000); } return (void *)NULL; }