Example #1
0
void graphics_Batch_draw(graphics_Batch const* batch,
                         float x, float y, float r, float sx, float sy,
                         float ox, float oy, float kx, float ky) {

  glActiveTexture(GL_TEXTURE0);
  glBindTexture(GL_TEXTURE_2D, batch->texture->texID);

  glBufferData(GL_ARRAY_BUFFER, 4*batch->maxCount*sizeof(graphics_Vertex), batch->vertexData, batch->usage);
  m4x4_newTransform2d(&moduleData.tr2d, x, y, r, sx, sy, ox, oy, kx, ky);
  float const * color = batch->colorUsed ? defaultColor : graphics_getColor();


  graphics_drawArray(&fullQuad, &moduleData.tr2d, moduleData.sharedIndexBuffer, batch->insertPos*6, GL_TRIANGLES,
                     GL_UNSIGNED_SHORT,  color, 1.0f, 1.0f);

}
Example #2
0
File: font.c Project: Murii/CLove
      moduleData.x = px + font->ch.bearingx;
      moduleData.y = py - font->ch.bearingy;
		
      if (moduleData.cp == '\n'){
          px = moduleData.x - (((font->ch.advancex >> 6)) * (font->ch.sizex + font->ch.bearingx));
          if (px < moduleData.storeX)
            px = moduleData.storeX;
          py += floor(font->ch.bearingy + 5.25f);
          continue;
        }

      m4x4_newTransform2d(&moduleData.tr2d, moduleData.x, moduleData.y, r, sx, sy, ox, oy, kx, ky);

      graphics_drawArray(&quad, &moduleData.tr2d,  font->ibo, 4, GL_TRIANGLE_STRIP, GL_UNSIGNED_BYTE,
                         graphics_getColor(), quad.w * font->ch.sizex , quad.h * font->ch.sizey);

      font->w = (int )&font->face->glyph->bitmap.width;
      font->w = font->w >> 6;
      px += font->ch.advancex >> 6;
      py += font->ch.advancey >> 6;
    }
  graphics_setShader(shader);

}

void graphics_Font_print(graphics_Font* font, char const* text, int px, int py, float r, float sx, float sy, float ox, float oy, float kx, float ky) {
  moduleData.x = 0;
  moduleData.storeX = 0;
  moduleData.y = font->face->ascender;