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.


Topics - kpulv

Pages: [1]
1
SFML projects / All the King's Men
« on: November 13, 2013, 01:20:17 am »
Hey!  I've been using SFML dotnet for a few months now building a little framework thing (http://otter2d.com) and this past weekend I did a game jam to test it out, and it turned out pretty well!

All the King's Men
Download for Windows: http://kpulv.com/downloads/KingsMenWindows.zip
My blog post where you can find more info: http://kpulv.com/210/All_the_King_s_Men/

The idea of the game is that you're trying to protect the King using the guards that are stationed on the path.  I recommend using an xbox360 controller or a similar PC controller, but keyboard works too.

The guards can also go out and find treasure boxes full of amazing loot and bring it back to the King, and if the King does make it to the end of his journey then you'll be scored based off how much treasure the King ended up with.

Here's some screenshots:







Thanks for checking it out! ;D

2
DotNet / Can't modify vertex in vertexarray
« on: November 06, 2013, 01:20:58 am »
I've been working on trying to get batched rendering working for my framework using SFML, but it seems that in dotnet I am unable to edit a vertex after it's in the array.  I'm attempting to draw a large number of sprites that are dynamic with the vertex array, and rebuilding the array during each update to take into account the changes ends up being very costly (5000 quads is when my update loop takes more than 17ms meaning the framerate is no longer a smooth 60)

Is there something I'm missing on how I should be trying to organize this logic?  If I cant modify the vertex after it's in the vertex array, what is the best option for updating the vertices aside from rebuilding the entire array each time?

3
Graphics / SFML Text Origin Y Question
« on: September 23, 2013, 02:05:56 am »
Hello!  I was wondering if this was the intended behavior of the text class when adjusting the Y origin for purposes of scaling and rotating:



Usually for images adjusting the Y origin to half the height of the image will guarantee the perfect center of the image, but for text this doesn't seem to be the case.  In the image above, I'm rendering a red pixel at the X and Y coordinate of the text to show how centered it is.

The first text at the top uses GetLocalBounds().Height * 0.5f.  It doesn't look vertically centered though when scaling.  The second text uses the same thing except 0.75f instead of 0.5f, and ends up looking more vertically centered than the 0.5f one. The third uses 0 just as a reference.

Here's all the code I used to make this example (SFML 2.1 in C#):

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SFML.Graphics;
using SFML.Window;

namespace SFMLTextTest {
    class Program {
        static void Main(string[] args) {
            RenderWindow window = new RenderWindow(new VideoMode(1000, 750), "Test Application");

            Font font = new Font("arial.ttf");
            string testString = "Testing Font yGpQ`";

            Text text = new Text(testString, font);
            text.Origin = new Vector2f(text.GetLocalBounds().Width / 2f, text.GetLocalBounds().Height / 2f);
            text.Position = new Vector2f(window.Size.X / 2f, window.Size.Y * 0.25f);

            text.Color = Color.Yellow;

            CircleShape textCircle = new CircleShape(1f);
            textCircle.Position = text.Position;
            textCircle.FillColor = Color.Red;

            Text text2 = new Text(testString, font);
            text2.Origin = new Vector2f(text2.GetLocalBounds().Width / 2f, text2.GetLocalBounds().Height * .75f);
            text2.Position = new Vector2f(window.Size.X / 2f, window.Size.Y * 0.5f);

            text2.Color = Color.Cyan;

            CircleShape text2Circle = new CircleShape(1f);
            text2Circle.Position = text2.Position;
            text2Circle.FillColor = Color.Red;

            Text text3 = new Text(testString, font);
            text3.Origin = new Vector2f(text2.GetLocalBounds().Width / 2f, 0);
            text3.Position = new Vector2f(window.Size.X / 2f, window.Size.Y * 0.75f);

            text3.Color = Color.Green;

            CircleShape text3Circle = new CircleShape(1f);
            text3Circle.Position = text3.Position;
            text3Circle.FillColor = Color.Red;

            window.Closed += new EventHandler(OnClosed);

            float timePassed = 0;

            float scaleText = 1f;

            while (window.IsOpen()) {
                window.DispatchEvents();

                window.Clear();

                scaleText = (float)(((Math.Sin(timePassed * 0.025f) + 1f) / 2f) * 2.5f);

                text.Scale = text2.Scale = text3.Scale = new Vector2f(scaleText, scaleText);
                timePassed += 0.1f;

                window.Draw(text);
                window.Draw(text2);
                window.Draw(text3);

                window.Draw(textCircle);
                window.Draw(text2Circle);
                window.Draw(text3Circle);

                window.Display();

            }
        }

        static void OnClosed(object sender, EventArgs e) {
            Window window = (Window)sender;
            window.Close();
        }
    }
}
 

Here's another screenshot using characters that display better the bounds of possible characters:



Even here, using Origin Y as half the height seems misaligned.

4
Graphics / SFML Text Artifacts
« on: June 18, 2013, 01:58:08 am »
Using the SFML Text in the DotNet binding I'm having problems with the text class.  I have tried multiple font sizes, and multiple fonts, and multiple strings, all with the same results.





You can see in this example there are stray pixels being rendered in the upper left hand corner of the text.  It seems to always appear on the upper left of the first character's bounding box, and it also seems like it is smaller than a single pixel because moving the text around the screen causes the artifact to appear and reappear.

I have not tried the C++ version yet, but I have spoken to at least one other DotNet developer who is experiencing the same issue with the DotNet binding of SFML.

Does anyone know what's going on or how to fix this?

Update
A friend of mine tried Text in pySFML and found the same result:


Update 2
It seems that further investigation shows that this artifact will appear when the text is drawn at a y coordinate of 0 to 0.5.  So for example if the text is at Y 50.1, the artifact will appear.  However, at 50.51, the artifact will not appear, and then it will appear again at 50.5.

It would seem that rounding is the solution -- however this is not a very good solution as this results in a loss of fidelity in drawing, as things become jittery when moving when they are always rounded to the nearest integer.

Pages: [1]
anything