Repository navigation
view_set_viewport: keep fractions in roomRectX/Y/W/H - #808
Conversation
The room rectangle is the view's camera, and camera_set_view_pos and friends take reals, but view_set_viewport read every field with yyGetInt32, so roomRectX: 10.5 became 10. The roomRect fields are now read as reals; the screen fields (the port, in pixels) stay whole numbers. Found by GM-TestFramework#386 at f511079. Claude-Session: https://claude.ai/code/session_01EgTASfpMoBvX7TBDy119t5
Automated reviewThis PR changes This matches how Nothing open. Reviewed 02fc9e9 Advisory: this check doesn't block merging. It runs again on each push. Reply in a comment's thread if it is wrong, and resolve the thread once it is dealt with: the next review reads both. |
iampremo
left a comment
There was a problem hiding this comment.
Reviewed at 02fc9e9.
Looks good to me. Reading roomRect* with yyGetReal makes it match camera_set_view_pos/camera_set_view_size. The view arrays were already written through index-based writes with no truncation, so the fractional values carry through CopyViewsFromArrays into pView.world* unchanged. Nothing downstream truncates them with bitwise ops. The screen* fields correctly stay yyGetInt32 for the port.
A small correction to the bot's summary: room_get_viewport only returns the port fields and the visible flag, never the room rectangle, so it isn't affected either way. That doesn't change anything here.
Follow-up to #806 and #807 (
view_set_viewport, non-rectangular viewports, https://github.com/YoYoGames/GMS2-Runner-Main/issues/1076).view_set_viewportread every field withyyGetInt32, soroomRectX: 10.5became 10. The room rectangle is the view's camera, andcamera_set_view_posand the other camera functions take reals. TheroomRect*fields are now read as reals. Thescreen*fields are the port, in pixels, so they stay whole numbers.I also checked the JSON string form, and it needs no change. It calls the runner's own
json_parse(Function_File.js), the same function GML'sjson_parseuses. So it accepts exactly whatjson_parseaccepts, comments and trailing commas included wherejson_parseallows them.Tests: BasicViewSetViewportTestSuite from YoYoGames/GM-TestFramework#386 at f511079, raw build, headless Chrome. There were no console errors.
develop21d8f87camera_get_view_xwas 10, not 10.5)