snap object to grid

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Germanunkol
Party member
Posts: 712
Joined: Fri Jun 22, 2012 4:54 pm
Contact:

Re: snap object to grid

Post by Germanunkol »

Must be the graphics card, yes. It works on my Nvidia card, even on windows.
Sorry about that, then. I thought about hacking together a simpler example for snapping to grid with a camera-offset and zoom, but I have a big exam coming up, so I figured I'd just post something I already had. Bad choice, maybe.

I might add a simpler example if the above one doesn't work for the OP or if he needs it.
If anyone else has more bugs with the example, though, maybe just post it in this thread, because I don't want to hijack this thread for my bugs :P...
trAInsported - Write AI to control your trains
Bandana (Dev blog) - Platformer featuring an awesome little ninja by Micha and me
GridCars - Our jam entry for LD31
Germanunkol.de
User avatar
slime
Solid Snayke
Posts: 3166
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: snap object to grid

Post by slime »

Germanunkol wrote:Must be the graphics card, yes. It works on my Nvidia card, even on windows.
nvidia drivers are known for only loosely following the OpenGL specification, when it suits them. For example, in many cases nvidia's GLSL compiler will allow functions and syntax in versions of GLSL where they're supposed to be disallowed, just because they're allowed in some later version or because their GLSL compiler shares code with their Cg or HLSL compilers where it is allowed.

In any case, "1f" is not valid GLSL for specifying a float literal. "1.f", "1.0f", and "1.0" all work fine, if you change the "1f" in line 10 to use one of those. :)
Germanunkol
Party member
Posts: 712
Joined: Fri Jun 22, 2012 4:54 pm
Contact:

Re: snap object to grid

Post by Germanunkol »

Thanks for pointing that out...!
But I did change it to "1.0", because I suspected something of the sort (well, and mostly because the error was complaining about the f), and bekey still says it's not running...

Is it possible that only 1.0f works, but not 1.0?
Edit: Scratch that.I missed an f :(

Edit2: Updated the Demo above for the 100th time -.-
trAInsported - Write AI to control your trains
Bandana (Dev blog) - Platformer featuring an awesome little ninja by Micha and me
GridCars - Our jam entry for LD31
Germanunkol.de
bekey
Party member
Posts: 255
Joined: Tue Sep 03, 2013 6:27 pm

[]

Post by bekey »

-snip-
Last edited by bekey on Fri Jan 24, 2014 2:11 am, edited 1 time in total.
Germanunkol
Party member
Posts: 712
Joined: Fri Jun 22, 2012 4:54 pm
Contact:

Re: snap object to grid

Post by Germanunkol »

Not a problem. Thanks a lot for reporting!
trAInsported - Write AI to control your trains
Bandana (Dev blog) - Platformer featuring an awesome little ninja by Micha and me
GridCars - Our jam entry for LD31
Germanunkol.de
User avatar
mangadrive
Prole
Posts: 32
Joined: Sat Nov 17, 2012 10:26 pm

Re: snap object to grid

Post by mangadrive »

Thanks for the suggestions and I looked over them.

I hard coded it because it's a static 4x4 box. So it's only 8 checks for x,y and total. The box won't be moving and I've committed to my resolution because I designed the UI first, albeit a weird resolution size but I'm the guy making it so that's my call right? :) In the weird off chance that I do need to move/change, I'd be changing the selector's checks manually but everything else has been based around object.x/y and said selector pointing at it so no harm no foul. Again I was over thinking this graciously, but did learn the perils of going away from a 0,0 centered map, so will avoid that in a future project and everything said will be more relevant.

I still learned from this post and appreciate all of the input.
Post Reply

Who is online

Users browsing this forum: aikusuuta and 7 guests