ソースを参照

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キー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

読み込み中…
キャンセル
保存