瀏覽代碼

Corrected issue with new functionality

Using default font texture as base white texture for rectangles reduces
draw calls considerably, actually, raygui can be drawn with a single
pass!
pull/432/head
raysan5 7 年之前
父節點
當前提交
0e48396369
共有 1 個檔案被更改,包括 6 行新增4 行删除
  1. +6
    -4
      src/shapes.c

+ 6
- 4
src/shapes.c 查看文件

@ -36,6 +36,8 @@
*
**********************************************************************************************/
#define USE_DEFAULT_FONT_TEXTURE
#include "raylib.h"
#include "rlgl.h" // raylib OpenGL abstraction layer to OpenGL 1.1, 2.1, 3.3+ or ES2
@ -280,19 +282,19 @@ void DrawRectangleV(Vector2 position, Vector2 size, Color color)
// NOTE: Default raylib font character 95 is a white square
rlTexCoord2f((float)GetDefaultFont().chars[95].rec.x/GetDefaultFont().texture.width,
(float)GetDefaultFont().chars[95].rec.y/GetDefaultFont().texture.height);
rlVertex2f(rec.x, rec.y);
rlVertex2f(position.x, position.y);
rlTexCoord2f((float)GetDefaultFont().chars[95].rec.x/GetDefaultFont().texture.width,
(float)(GetDefaultFont().chars[95].rec.y + GetDefaultFont().chars[95].rec.height)/GetDefaultFont().texture.height);
rlVertex2f(rec.x, rec.y + rec.height);
rlVertex2f(position.x, position.y + size.y);
rlTexCoord2f((float)(GetDefaultFont().chars[95].rec.x + GetDefaultFont().chars[95].rec.width)/GetDefaultFont().texture.width,
(float)(GetDefaultFont().chars[95].rec.y + GetDefaultFont().chars[95].rec.height)/GetDefaultFont().texture.height);
rlVertex2f(rec.x + rec.width, rec.y + rec.height);
rlVertex2f(position.x + size.x, position.y + size.y);
rlTexCoord2f((float)(GetDefaultFont().chars[95].rec.x + GetDefaultFont().chars[95].rec.width)/GetDefaultFont().texture.width,
(float)GetDefaultFont().chars[95].rec.y/GetDefaultFont().texture.height);
rlVertex2f(rec.x + rec.width, rec.y);
rlVertex2f(position.x + size.x, position.y);
rlEnd();
rlDisableTexture();

Loading…
取消
儲存