瀏覽代碼

providing and example on how to apply the screen scale (as done in the virtual mouse) to the real mouse, to work with raygui (#1481)

pull/1486/head
Matheus Duarte 4 年之前
committed by GitHub
父節點
當前提交
227496bea7
沒有發現已知的金鑰在資料庫的簽署中 GPG Key ID: 4AEE18F83AFDEB23
共有 1 個文件被更改,包括 5 次插入0 次删除
  1. +5
    -0
      examples/core/core_window_letterbox.c

+ 5
- 0
examples/core/core_window_letterbox.c 查看文件

@ -71,6 +71,11 @@ int main(void)
virtualMouse.x = (mouse.x - (GetScreenWidth() - (gameScreenWidth*scale))*0.5f)/scale;
virtualMouse.y = (mouse.y - (GetScreenHeight() - (gameScreenHeight*scale))*0.5f)/scale;
virtualMouse = ClampValue(virtualMouse, (Vector2){ 0, 0 }, (Vector2){ gameScreenWidth, gameScreenHeight });
// Apply the same transformation as the virtual mouse to the real mouse, to work with raygui.
// SetMouseOffset(-(GetScreenWidth() - (gameScreenWidth * scale)) * 0.5f, -(GetScreenHeight() - (gameScreenHeight * scale)) * 0.5f);
// SetMouseScale(1 / scale, 1 / scale);
//----------------------------------------------------------------------------------
// Draw

Loading…
取消
儲存