bool wsheet_add_obj(struct wsheet* wsh, uint16_t type, void* data, int32_t l, int32_t t, int32_t r, int32_t b) { int32_t i, j; struct obj* o = wmalloc(sizeof(*o)); wassert(o); rect_set(&o->extent, l, t, r, b); o->ty = type; o->ref = 0; o->priv = data; for (i = 0; i < wsh->rowN; i++) { for (j = 0; j < wsh->colN; j++) { if (rect_is_overlap2(&o->extent, &wsh->divs[i][j].boundary)) div_add_obj(&wsh->divs[i][j], o); } } /* if obj is not added anywhere, destroy it! */ if (!o->ref) { wfree(o); return false; } else return true; }
/* * 绘制画面切换效果 */ PUBLIC void renderer_drawTransform(Engine *engine, Graphic *g) { Rect rect; rect_set(&rect, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); canvas_fill_Rect(g, &rect); return; }
PUBLIC void renderer_init(Engine *engine) { rect_set(&r.rect, 0, 0, engine->canvasWidth, engine->canvasHeight); canvas_init(engine->screenWidth, engine->screenHeight, engine->canvasWidth, engine->canvasHeight); return; }