bool in_range(IntPoint chunk, IntPoint coords, IntPoint range_chunk, IntPoint center, IntPoint radius) { IntPoint abs = get_abs(chunk, coords); IntPoint tl_abs = get_abs(range_chunk, IntPoint(center.row - radius.row, center.col - radius.col)); IntPoint br_abs = get_abs(range_chunk, IntPoint(center.row + radius.row, center.col + radius.col)); bool is_x = (abs.col>=tl_abs.col && abs.col<br_abs.col); bool is_y = (abs.row>=tl_abs.row && abs.row<br_abs.row); return (is_x && is_y); }
int main(int argc, char **argv) { char *path = "/root/"; char *name = "gogogo"; char abs[256]; get_abs(path, name, abs); printf("%s\n",abs); return 0; }
void set_float(ControllerMessage& msg, float value) { msg.set_abs_float(get_abs(), value); }
void set(ControllerMessage& msg, int value, int min, int max) { msg.set_abs(get_abs(), value, min, max); }
int get(const ControllerMessage& msg) { return msg.get_abs(get_abs()); }
float get_float(const ControllerMessage& msg) { return msg.get_abs_float(get_abs()); }
void widget::draw_box(int x, int y, int w, int h) { get_abs(x, y); get_screen().draw_rect_2d(static_cast<float>(x), static_cast<float>(y), static_cast<float>(x+w), static_cast<float>(y+h)); } // widget::draw_box()
void widget::draw_line(int x0, int y0, int x1, int y1) { get_abs(x0, y0); get_abs(x1, y1); get_screen().draw_line_2d(x0, y0, x1, y1); } // widget::draw_line()