瀏覽代碼

Merge pull request #817 from Demizdor/fix_draw_text_rec_ex

Fixed text selection in DrawTextRecEx()
pull/820/head
Ray 6 年之前
committed by GitHub
父節點
當前提交
e1cd4674e7
沒有發現已知的金鑰在資料庫的簽署中 GPG 金鑰 ID: 4AEE18F83AFDEB23
共有 1 個檔案被更改,包括 2 行新增2 行删除
  1. +2
    -2
      src/text.c

+ 2
- 2
src/text.c 查看文件

@ -900,7 +900,7 @@ void DrawTextRecEx(Font font, const char *text, Rectangle rec, float fontSize, f
int startLine = -1; // Index where to begin drawing (where a line begins)
int endLine = -1; // Index where to stop drawing (where a line ends)
for (int i = 0; i < length; i++)
for (int i = 0, k = 0; i < length; i++, k++)
{
int glyphWidth = 0;
int next = 1;
@ -979,7 +979,7 @@ void DrawTextRecEx(Font font, const char *text, Rectangle rec, float fontSize, f
//draw selected
bool isGlyphSelected = false;
if ((selectStart >= 0) && (i >= selectStart) && (i < (selectStart + selectLength)))
if ((selectStart >= 0) && (k >= selectStart) && (k < (selectStart + selectLength)))
{
Rectangle strec = {rec.x + textOffsetX-1, rec.y + textOffsetY, glyphWidth, (font.baseSize + font.baseSize/4)*scaleFactor };
DrawRectangleRec(strec, selectBack);

Loading…
取消
儲存