IoObject *IoSeq_drawQuadTo(IoSeq *self, IoObject *locals, IoMessage *m) { IoSeq_assertIsVector(self, locals, m); { IoSeq *other = IoMessage_locals_pointArgAt_(m, locals, 0); vec2f p = IoSeq_vec2f(self); vec2f p2 = IoSeq_vec2f(other); double x1, y1, x2, y2; double s = 0; if (IoMessage_argCount(m) > 1) { s = IoMessage_locals_doubleArgAt_(m, locals, 1); } x1 = (p.x) + s; y1 = (p.y) + s; x2 = (p2.x) - s; y2 = (p2.y) - s; glBegin(GL_QUADS); glVertex2d(x1, y1); glVertex2d(x2, y1); glVertex2d(x2, y2); glVertex2d(x1, y2); glEnd(); } return self; }
IoObject *IoGLScissor_set(IoGLScissor *self, IoObject *locals, IoMessage *m) { vec2f o = IoSeq_vec2f(IoBox_rawOrigin(DATA(self)->rect)); vec2f s = IoSeq_vec2f(IoBox_rawSize(DATA(self)->rect)); glScissor((GLint)o.x, (GLint)o.y, (GLsizei)s.x, (GLsizei)s.y); return self; }
void IoBox_rawUnion(IoBox *self, IoBox *other) { vec2f o1, o2; vec2f v1 = IoSeq_vec2f(DATA(self)->origin); vec2f v2 = IoSeq_vec2f(DATA(self)->size); v2.x += v1.x; v2.y += v1.y; o1 = IoSeq_vec2f(DATA(other)->origin); o2 = IoSeq_vec2f(DATA(other)->size); o2.x += o1.x; o2.y += o1.y; { vec2f u1, u2, us; NUM_TYPE uw; NUM_TYPE uh; u1.x = v1.x > o1.x ? v1.x : o1.x; u1.y = v1.y > o1.y ? v1.y : o1.y; u2.x = v2.x < o2.x ? v2.x : o2.x; u2.y = v2.y < o2.y ? v2.y : o2.y; uw = u2.x - u1.x; uh = u2.y - u1.y; IoSeq_setVec2f_(DATA(self)->origin, u1); us.x = uw > 0 ? uw:0; us.y = uh > 0 ? uh:0; IoSeq_setVec2f_(DATA(self)->size, us); } }
IoObject *IoBox_drawAsRect(IoBox *self, IoObject *locals, IoMessage *m) { vec2f o = IoSeq_vec2f(DATA(self)->origin); vec2f s = IoSeq_vec2f(DATA(self)->size); GLRECT(o.x, o.y, o.x + s.x, o.y + s.y); return self; }
IoObject *IoBox_scissor(IoBox *self, IoObject *locals, IoMessage *m) { vec2f o = IoSeq_vec2f(DATA(self)->origin); vec2f s = IoSeq_vec2f(DATA(self)->size); printf("Scissor: %i %i, %i %i\n", (int)o.x, (int)o.y, (int)s.x, (int)s.y); glScissor((GLint)o.x, (GLint)o.y, (GLsizei)s.x, (GLsizei)s.y); return self; }
IoObject *IoBox_drawAsRectOutline(IoBox *self, IoObject *locals, IoMessage *m) { vec2f o = IoSeq_vec2f(DATA(self)->origin); vec2f s = IoSeq_vec2f(DATA(self)->size); glBegin(GL_LINE_LOOP); GLVERTEX2(o.x, o.y); GLVERTEX2(o.x, o.y + s.y); GLVERTEX2(o.x + s.x, o.y + s.y); GLVERTEX2(o.x + s.x, o.y); glEnd(); return self; }
IoObject *IoSeq_drawQuad(IoSeq *self, IoObject *locals, IoMessage *m) { IoSeq_assertIsVector(self, locals, m); { vec2f p = IoSeq_vec2f(self); double x, y, w, h; double s = 0; if (IoMessage_argCount(m) > 1) { s = -IoMessage_locals_doubleArgAt_(m, locals, 1); } x = s; y = s; w = (p.x) - (s*2); h = (p.y) - (s*2); glBegin(GL_QUADS); glVertex2d(w, h); glVertex2d(x, h); glVertex2d(x, y); glVertex2d(w, y); glEnd(); } return self; }
IoObject *IoSeq_drawLineLoopi(IoSeq *self, IoObject *locals, IoMessage *m) { IoSeq_assertIsVector(self, locals, m); { vec2f p = IoSeq_vec2f(self); GLint x = (p.x); GLint y = (p.y); GLint s = 0; if (IoMessage_argCount(m)) { s = (GLint)IoMessage_locals_doubleArgAt_(m, locals, 0); } glBegin(GL_LINES); glVertex2i(x-s, y-s); glVertex2i(s, y-s); glVertex2i(s, y-s); glVertex2i(s, s); glVertex2i(s, s); glVertex2i(x-s, s); glVertex2i(x-s, s); glVertex2i(x-s, y-s); glEnd(); } return self; }
IoObject *IoSeq_drawLineLoop(IoSeq *self, IoObject *locals, IoMessage *m) { IoSeq_assertIsVector(self, locals, m); { vec2f p = IoSeq_vec2f(self); GLdouble x = (p.x); GLdouble y = (p.y); glBegin(GL_LINES); glVertex2d(x, y); glVertex2d(0, y); glVertex2d(0, y); glVertex2d(0, 0); glVertex2d(0, 0); glVertex2d(x, 0); glVertex2d(x, 0); glVertex2d(x, y); glEnd(); } return self; }