Not logged inGosu Forums
Forum back to Help Search Register Login
Up Topic Gosu / Extending Gosu / hard rendering
- - By oli.obk Date 2011-09-30 10:03
Hey everyone.

I am developing a cellular automata renderer/editor in c++.
I'm rendering the state of a grid of any size, by updating a Gosu::Bitmap from that grid and then updating a Gosu::Image from that Bitmap.
Every cell occupies exactly one pixel on the Image.
Now for editing purposes (or even viewing) it is often useful to zoom into the grid.
Doing that with Gosu causes really strong smoothing (cells end up being round and melting into each other).
This is (not always) a good thing here. For viewing it looks (to me) much better, but for editing it becomes very hard to know how to click an exact cell.
I extended the Image class to have another boolean parameter that allows "hard" rendering.
It is a quick way to implement this into the current gosu system without changing too much.
There might be better ways, if there are, please tell me :)
click me for diff file

Parent - - By Spooner Date 2011-09-30 12:16 Edited 2011-09-30 12:42
Call Gosu::enabled_undocumented_retrofication, at the start of the game, to disable smoothing. I think it does it just as you have, but is a permanent switch for the game. Generally you want smoothing (high-res game) or not (retro-big pixels) so that is fine.

You can also use the tileable flag when loading images to stop tiles being a bit fuzzy at the edges (it copies the image into a texture with a 1-pixel wide border). This may be what you actually want to use, rather than retrofication, if you just want your tiles to tile properly and not to fuzzy up.
Parent - - By kaBOOM Date 2011-09-30 12:38
Gosu::enabled_undocumented_retrofication needs so serious documentation. ;)
Parent - - By Spooner Date 2011-09-30 12:43
Well, maybe in 0.8 (or there will be a per-image retrofication system like the OP suggested)?
Parent - - By jlnr (dev) Date 2011-09-30 14:02
Yes, which is why I didn't add it in 0.7.x. The Image constructor does not yet accept an arguments hash (or a flags mask in C++).
Parent - By RavensKrag Date 2011-10-01 23:49
Any chance that you could simply add all of these undocumented experimental features into a Gosu::Experimental module/namespace or something? That way they can be tested out, and found relatively easily, even if they are kludgy/undocumented/whatever.
Parent - - By oli.obk Date 2011-10-07 13:35
i could modify my code to use a bitmask.
i just assumed there would be no other settings than smooth/hard.
still can't think of anything now
Parent - By jlnr (dev) Date 2011-10-07 14:43
The tileable thing can go into the bitmask as well. Seeing true and false in argument lists is really hard to understand compared to enum members.

I am just waiting for the next time I change Gosu's public interface until adding something like that, I think I can use your patch as a starting point, so thanks :)
Parent - By oli.obk Date 2011-10-07 13:32
yes, i just wanted some images rendered pixelated.
so now its an image constructor argument, not a permanent switch.
both can coexist in my code
Up Topic Gosu / Extending Gosu / hard rendering

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill