Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Polyfructol

Pages: [1]
1
All that have been said is absolutely right, but I was curious and I've made the correction by myself. So there you are:

(click to show/hide)

2
General / Re: Team coloring in SFML
« on: September 26, 2013, 12:33:06 pm »
Sprite::setColor will not achieve the same effect as a palette would. But fortunately, SFML supports shaders, and the palette "effect" could be achieved with shader.

On the OpenGL website : http://www.opengl.org/wiki/Common_Mistakes#Paletted_textures

//Fragment shader
#version 110
uniform sampler2D ColorTable;     //256 x 1 pixels
uniform sampler2D MyIndexTexture;
varying vec2 TexCoord0;
 
void main()
{
  //What color do we want to index?
  vec4 myindex = texture2D(MyIndexTexture, TexCoord0);
  //Do a dependency texture read
  vec4 texel = texture2D(ColorTable, myindex.xy);
  gl_FragColor = texel;   //Output the color
}

So you need to create an indexed texture and a palette texture.

3
Graphics / Re: Large Textures & maps
« on: June 24, 2013, 10:42:05 pm »
Yeah I guess so. I might just be stuck in the 1980's xD

Not even close :).

NES sprite size limit was 8x16 pixels. From the beggining, games are made by displaying a lot of "relatively" tiny elements next together.

4
Graphics / Re: Large Textures & maps
« on: June 24, 2013, 09:52:15 pm »
In Limbo, there is large maps, but there is no need to load "large" textures. They just display a lot of objects at given positions. That's why map editor exists: http://forum.unity3d.com/attachment.php?attachmentid=31197&stc=1&d=1329779441

5
Graphics / Re: Complex Map Generation & Rendering
« on: June 24, 2013, 09:32:25 pm »
A nice way to do that is by using a parent/child hierarchy Drawable. You can search for "node" or "scene graph" to find more about it. Here a nice example with code: http://en.sfml-dev.org/forums/index.php?topic=7487.msg49403#msg49403

So you'll just have to move your few layers in order to move everything contained inside.

6
Graphics / Re: Suggestion for displaying text
« on: June 19, 2013, 08:44:22 pm »
You're right, it's even an open issue: https://github.com/SFML/SFML/issues/254
For now, a solution is to recompile SFML with a slight change in Font.cpp, replacing FT_RENDER_MODE_NORMAL by FT_RENDER_MODE_MONO.

But you can almost totally avoid the "smoothing" effect if you take a font that was designed with the size you want (10px for your case). Then you can apply a scale multiplier (power of two for the best result) on the sf::Text in order to fit the size you really want.

I made some tests with 2 differents fonts:

http://www.dafont.com/commodore-64-pixelized.font?text=commodore+pixelized
font=Commodore Pixelized v1.2.ttf; characterSize=10; FT_RENDER_MODE_MONO


font=Commodore Pixelized v1.2.ttf; characterSize=10; FT_RENDER_MODE_NORMAL


font=Commodore Pixelized v1.2.ttf; characterSize=11; FT_RENDER_MODE_MONO


font=Commodore Pixelized v1.2.ttf; characterSize=11; FT_RENDER_MODE_NORMAL


http://www.dafont.com/grand9k-pixel.font
font=Grand9K Pixel.ttf; characterSize=8; FT_RENDER_MODE_MONO


font=Grand9K Pixel.ttf; characterSize=8; FT_RENDER_MODE_NORMAL


font=Grand9K Pixel.ttf; characterSize=9; FT_RENDER_MODE_MONO


font=Grand9K Pixel.ttf; characterSize=9; FT_RENDER_MODE_NORMAL


So, no smoothing effect if you use characterSize=8 for Grand9K and characterSize=10 for Commodore 64  ;D.

Hope it helps!

7
General / Re: SFML game with LibRocket?
« on: June 19, 2013, 06:06:17 pm »
I've never used libRocket, it looks quite interesting! Anyway, it's libRocket that needs to support SFML, not the other way ;).

And guess what I found on the libRocket repository, an SFML 2 sample ! I'm at work and I can't run the sample for now, but I think it might help you.

Pages: [1]
anything