소스 검색

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
No known key found for this signature in database 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

불러오는 중...
취소
저장