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 - delio

Pages: [1] 2 3 4
1
General / Re: Get size of content
« on: May 02, 2014, 07:02:38 pm »
Thanks  :) , zsbzsb and eXpl0it3r

2
General / Re: Get size of content
« on: May 02, 2014, 04:03:33 pm »
Sorry I've no idea what you're asking for...
If you want the zoom factor, then you need to track that on your own.
Sorry for bad explanation.
Ok I'll try it.

3
General / Get size of content
« on: May 02, 2014, 03:55:22 pm »
At first, Content's width is 50 px.


Then, I zoom in. So contents are bigger. It's width is 100px


How can I get contents' width, when I've zoom?

I've try "view.getSize" .
but While Contents are bigger, "view.getSize.x" is lower.

delio

4
General / Re: Algorithm help!
« on: April 15, 2014, 07:24:44 pm »
What 40 colors do you have then? I mean how do they define these 40 colors?
40 colors is colors that my teacher define.

Not sure if I'm starting to understand you, do you want to convert each pixel and then draw each pixel with a vertex array/tile map?
Yes!!

So SFML can't do this
I'll find another library
Thanks for answer :)

I don't know, bit converting some colors from the 32bit color space to your 40 color space shouldn't be so hard, if the 40 colors are logically choosen (while ignoring the uselessness of a 40 color limit).
40 colors isn't chosen by logically :(.

Why don't you ask your assistant/prof/teacher first then? Because they (usually) get payed for their teaching/assistance, plus they probably speak your lanuage.
This is project, I do by myself. No teacher can teach me :) .

like to do this in Photoshop
http://graphicdesign.stackexchange.com/questions/654/convert-a-pattern-photo-to-a-given-palette

5
General / Re: Algorithm help!
« on: April 15, 2014, 05:58:17 pm »
Tile map mean this : http://www.sfml-dev.org/tutorials/2.1/graphics-vertex-array.php#example-tile-map

I use tileset as a index of colors, and have only 40 colors.
but bitmap 32 bits have more than 40 colors.

I want to convert a bitmap picture to display in Tilemap by convert colors and store in array.


I don't understand what you mean exactly, but you can iterate over all the pixels and change them with some simple math.
Simple math is something about Hue or saturation?

Why is there such a color limit?
Why don't you save the *.bmp directly with these colors, so you don't have to do it at runtime? ;)
All of this is an argument of my school project :)

6
General / Algorithm help!
« on: April 15, 2014, 05:38:16 pm »
Hi,
I want to import bmp file to Tilemap.
but My tile map has only 40 colors.

This is my algorithm
1.Use SFML to convert color of bitmap to My Tilemap color.
2.read pixel of bitmap and store in array.
3.display Tilemap

Question is
1.How can I read pixel color in SFML?
2.How can I convert bmp color to nearest tilemap color by using SFML?

Sorry for bad explanation
Thanks,
delio

7
DotNet / Re: Tile map in C#[Updated]
« on: April 07, 2014, 04:10:26 pm »
What did I tell you about properties....  :)

Okay :-[
m_vertices.PrimitiveType = SFML.Graphics.PrimitiveType.Quads;

Thanks for every answer  :)

8
DotNet / Re: Tile map in C#[Updated]
« on: April 07, 2014, 04:00:39 pm »
Hi,
I have no idea how can I set it?
m_vertices.PrimitiveType(SFML.Graphics.PrimitiveType.Quads);
This gives error "Cannot use like this method"

9
DotNet / Re: Tile map in C#
« on: April 07, 2014, 03:34:55 pm »
Noticed that most of the loading functions are in the constructors in C#.  Also in some cases you'll need to use properties in place of getters and setters you'd use in C++.  Since I'm not working with tilemaps right now I really can't help much with this.
Now I can loading tileset.
But problem is my program display as dot, not areas.

11
DotNet / [Solved]Tile map in C#
« on: April 05, 2014, 03:35:44 pm »
class TileMap : Drawable
        {

            public bool load(string tileset, SFML.Window.Vector2u tileSize, int[] tiles, uint width, uint height)
            {

                // resize the vertex array to fit the level size
                // m_vertices.PrimitiveType(Quads);
                m_vertices.Resize(width * height * 4);

                // populate the vertex array, with one quad per tile
                for (uint i = 0; i < width; ++i)
                {
                    for (uint j = 0; j < height; ++j)
                    {
                        // get the current tile number
                        int tileNumber = tiles[i + j * width];

                        // find its position in the tileset texture
                        long tu = tileNumber % (m_tileset.Size.X / tileSize.X);
                        long tv = tileNumber / (m_tileset.Size.X / tileSize.X);

                        // get a pointer to the current tile's quad
                        uint index = (i + j * width) * 4;

                        // define its 4 corners
                        m_vertices[index + 0] = new Vertex(new Vector2f(i * tileSize.X, j * tileSize.Y), new Vector2f(tu * tileSize.X, tv * tileSize.Y));
                        m_vertices[index + 1] = new Vertex(new Vector2f((i + 1) * tileSize.X, j * tileSize.Y), new Vector2f((tu + 1) * tileSize.X, tv * tileSize.Y));
                        m_vertices[index + 2] = new Vertex(new Vector2f((i + 1) * tileSize.X, (j + 1) * tileSize.Y), new Vector2f((tu + 1) * tileSize.X, (tv + 1) * tileSize.Y));
                        m_vertices[index + 3] = new Vertex(new Vector2f(i * tileSize.X, (j + 1) * tileSize.Y), new Vector2f(tu * tileSize.X, (tv + 1) * tileSize.Y));
                    }
                }

                return true;
            }

            void Drawable.Draw(SFML.Graphics.RenderTarget target, SFML.Graphics.RenderStates states)
            {
                // apply the transform
                //states.Transform *= getTransform();

                // apply the tileset texture
                states.Texture = m_tileset;

                // draw the vertex array
                target.Draw(m_vertices, states);
            }

            public SFML.Graphics.Texture m_tileset = new SFML.Graphics.Texture(@"d:/tileset.png");
            private SFML.Graphics.VertexArray m_vertices = new SFML.Graphics.VertexArray();

        }
This is my code
And problem is It display as dot, not areas.
like in the picture

What is the mistake?
Thanks

12
DotNet / Re: Change C++ to C# problem
« on: April 04, 2014, 08:33:25 am »
If you haven't found it already here's the Github to the window events.

Very useful.  https://github.com/SFML/SFML.Net/blob/master/src/Window/Window.cs#L554

It should help speed things along. :)
Thanks you very much :)

13
DotNet / Re: Change C++ to C# problem
« on: April 03, 2014, 09:11:54 am »
Busy converting some of the C++ examples to C# before I start working on what I'm up to so I might be able to help. :)  Working on the one on the first page after going into the classes list. :)

Thanks but I want to try by myself :)

14
DotNet / Re: Change C++ to C# problem
« on: April 02, 2014, 04:41:01 pm »
OK, Thanks

15
DotNet / Re: Change C++ to C# problem
« on: April 02, 2014, 04:30:26 pm »
I'm considering about C++ and C#
C++ -- GUI is too hard for me. but I don't have to change SFML code.
C#   -- GUI is easier but I haven't learn.

Which one is worthy?

Pages: [1] 2 3 4
anything