Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Implementing in a 360p game

A topic by Varcroft created Oct 12, 2024 Views: 202 Replies: 3
Viewing posts 1 to 3

Dope extension definitely eliminates the mouse lag!

I was wondering if there's a way to have the cursor be draw in-scale and snap to pixels in my 360p game. currently with window_set_cursor_sprite it draws my cursor at 1:1 with my monitor pixels (a lot smaller than I need it and out of scale with my game).  I tried to use window_set_cursor_sprite_ext and set the x and y scale dynamically based on the display resolution... but 1. the image_blend set to -1 is incorrently drawing the sprite colors, and the cursor doesn't snap to the in game pixels as i want it to. 

TLDR: is there a way to draw the cursor pixel perfect snapped to in-game pixels?

Thanks!

Developer(+1)

Can’t say much about colors from that description alone, but you should be generally using the V2 extension unless you’re targeting Windows+HTML5 or using an old version of GM.

As for snapping, the way things work is that Windows tells you “the mouse is now over here, you can change the cursor as appropriate”. So the mouse is already on spot by the time you get to handle the message and the user might have already witnessed it draw there with the current cursor.

That said, I have now released an update that adds a callback that executes with lowest possible delay - you can try swapping cursors for ones with different origin points or anything, though

  1. I don’t think you can easily “outsmart” the system in this regard
  2. I don’t think pixel-snapped cursor will feel good for the player

Thanks for the reply!

I updated to the newest version, still getting the color issue, I’ll attack a photo of what I mean. It may be some code I have elsewhere that's changing the color or filter somehow? Because weirdly on screen recordings it shows the correct colors! while in game it shows up more blue/washed out. (left is the native cursor using the extension, right is drawn using a game object that tracks the mouse)

As you can see I am using a pixel filter to give my game a lo-fi feel, similar to animal well. That is mainly why I want to snap the cursor to in game pixels, so that it adheres to and also if possible sits behind the pixel filter. Nitpicky I know, but I'm really going for that pixel perfect feel within the game.

Would having the cursor drawn at a lower depth than the pixel filter be possible? (pixel filter is drawn on draw gui end step)

If these are solvable issues within the plugin without me having to learn the ins and outs of the WINapi language let me know! I would definitely pay more / donate to your project if theses issues could be solved.

thanks again and sorry for the litany of questions

Developer

Try reproducing the color issue in an empty project and email me a copy if that works out.

The only caveat I’m currently aware of is that for some things Windows requires images to have pre-multiplied alpha (for GameMaker, that’s a checkbox in the sprite overview), but your cursor doesn’t look semi-transparent.

Would having the cursor drawn at a lower depth than the pixel filter be possible? (pixel filter is drawn on draw gui end step)

You don’t draw the cursor, the system draws the cursor. The cursor does its own thing in general - if you have multiple monitors and the system BSODs, you can still move around the cursor on the secondary monitor while the system writes the dump file.

If you’d like to try doing your own thing, I tested with Windows’ Windows, and it does look like you should be able to make a snappy “cursor” out of a shaped window if you do its message handling on a separate thread with 1ms pause or alike.