• Hey! Guest! The 37th GMC Jam will take place between May 28th, 12:00 UTC and June 1st, 12:00 UTC. Why not join in! Click here to find out more!

Pixel rotation not sub pixels(Fixed)

I am currently attempting to rotate a sprite using code to be pixel perfect. I initially simply rotated in an image editor and made its image_index = VPos(image_angle)/-7.2(50 images, 360 degrees, 360/7.2=50).
The issue with this is the amount of weapons in the game is to much and it slows GM having individual weapons each having an entire rotated set. I tried messing around with possible using the round() function but it image_angle never rounds correctly to a whole pixel, so how could you rotate an image without sub pixels?
(I understand GM actually scales out the amount of pixels to allow for smooth movement but i would like to have the room size remain the same due to the room editor.)


Friendly Tyrant
Forum Staff
You need to set the application surface to be same size as the room. So, for example, if you have a room that is 240x135, and then use a viewport (window size) that is 960x540, the app surface will be at this size so you'll get sub-pixels drawn. Use the function surface_resize() after setting up the initial view ports to set the app surface to the correct size, which for our example would be 240x135, and GMS2 wlll then draw things correctly, scaling up the app surface to fit the game window.