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

Pages: [1]
1
General discussions / Re: Custom SFML Wizard for QtCreator
« on: September 10, 2018, 09:52:38 am »
This page has been in my bookmarks for a very long time. I created qtcreator-template-sfml project using the information in this page and the Adding New Custom Wizards document.

With this template, a simple SFML example can be created that uses one of the CMake, QMake, Qbs build systems. I just tested it on Fedora. For now, it's likely that it will not work on other Linux distributions, other operating systems, and other processor architectures without some changes being made.

So any contribution to the project is welcomed :)

Similar projects:

SFMLGameTemplate
sfml-project
base-sfml

2
General discussions / Google Summer of Code 2018
« on: January 04, 2018, 06:39:55 pm »
It would be nice to see SFML in Google Summer of Code :)

Quote
Do you lead or represent a free or open source software organization? Are you seeking new contributors? (Who isn’t?) Do you enjoy the challenge and reward of mentoring new developers? Apply to be a mentor organization for Google Summer of Code 2018![1]

Discussions in previous years:

Google Summer of Code
Google Summer of Code?

Some ideas:

  • Haiku support[2, 3]
  • SailfishOS support[4]


[1] https://opensource.googleblog.com/2018/01/seeking-open-source-projects-for-google.html
[2] https://discuss.haiku-os.org/t/sfml-support-in-haiku/3612
[3] https://www.haiku-os.org/community/gsoc/2017/ideas/#other
[4] https://build.merproject.org/package/show/home:maidis/SFML#

3
General / Implementation of Input Observer in C#
« on: December 22, 2017, 01:36:42 pm »
Hello there,

I'm trying to port a network pong game [1] written in C++ to C# which I know at a very basic level. I've ported about half of the game [2]. Only input manager and network support left. I've some ideas about what I need to do about network support, and probably there will be no problems to do so. But I'm lost on input manager. I checked on observer pattern [3] and some other projects [4] but so far it has not helped much.

Any idea on where I made mistakes or any source that I could use would be very much appreciated.

[1] https://github.com/aweAshikaga/AshiNetworkPong
[2] https://paste.ubuntu.com/26232721/
[3] http://www.dofactory.com/net/observer-design-pattern
[4] https://github.com/leftidev/csharp-Spin-Pong/blob/708f33c9f84731da2b9f2896e71ff1609c08fdbe/src/GameStates/MenuState.cs

4
General discussions / Re: 50% Discount on SFML e-books!
« on: June 06, 2015, 09:39:30 pm »
It's nice to see new SFML books and discounts for them :) This link could be better.

5
Graphics / Re: How to display a digital clock on SFML window?
« on: December 05, 2013, 10:29:30 pm »
Probably not the best way to create clock with SFML but at least it'll give you an idea and a working example :) Here is example code [1] which mostly based on this analog clock [2]. And here is digital clock's screenshot [3]. Also I give a try to do a binary clock similar to this [4].

Edit: There is already a binary clock written with SFML [5].

[1] http://pastebin.kde.org/pee140834
[2] https://github.com/SFML/SFML/wiki/Source%3A-Analog-Clock
[3]
[4]
[5] https://github.com/Gjum/BinClock

6
SFML projects / Re: What are you working on?
« on: September 22, 2013, 08:56:44 pm »
A number guessing game:


7
Graphics / Pentagon not being quite right?
« on: March 28, 2011, 10:35:12 pm »
pi must be 3.141592654 :)

const float pi=3.141592654;

8
Graphics / Porting an openFrameworks graphic example
« on: December 14, 2010, 12:47:21 am »
Hi,

I'm porting advancedGraphicsExample from openFrameworks [1] to SFML for learning something. I splited example to three parts:

- sfml-lissajous
- sfml-pixel-ocean
- sfml-rgb-circles

But i can't make last one yet. Is there any easy way to link three circles together to rotate without using any gl* stuffs.

sfml-lissajous.cpp
Code: [Select]
////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <SFML/Graphics.hpp>
#include <iostream>

////////////////////////////////////////////////////////////
/// Entry point of application
/// Ported from openFrameworks advancedGraphicsExample
///
/// \return Application exit code
///
////////////////////////////////////////////////////////////
int main()
{
    // Create main window
    sf::RenderWindow App(sf::VideoMode(800, 600), "SFML Lissajous");

    // Limit to 60 frames per second
    App.SetFramerateLimit(60);

    // Define and initialize some variables
    float x, y, spin, spinPct, prevMY, prevMX = 0;
    bool bFirstMouseMove = 1;

    // Start game loop
    while (App.IsOpened())
    {
        // Process events
        sf::Event Event;
        while (App.GetEvent(Event))
        {
            // Close window : exit
            if (Event.Type == sf::Event::Closed)
                App.Close();

            // Escape key : exit
            if ((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::Escape))
                App.Close();

            // MouseMove event : adjust spinPct
            if (Event.Type == sf::Event::MouseMoved)
            {
                // Update spinPct by the distance the mouse moved in x and y.
                // We use abs so it always spins in the same direction

                // We use the "bFirstMouseMove" flag so that we calculate only
                // after we have the first prevMY and prevMX stored;
                if (bFirstMouseMove == false)
                    {
                    spinPct += (float)abs(y - prevMY) * 0.03;
                    spinPct += (float)abs(x - prevMX) * 0.03;
                    } else bFirstMouseMove = false;

                // Store the x and y so we can get the prev value
                // next time the mouse is moved
                prevMY = y;
                prevMX = x;
            }
        }

        // Reduce the spinPct by a small amount so that the spinning eventually stops
        spinPct *= 0.99f;

        // Update the spin -which is storing the total rotation- by spinPct
        spin += spinPct;

        // Lets make the curves out of a series of points
        for(int i = 0; i < 800; i++)
        {
            // Lets use the mouse x and y position to affect the x and y paramters of the curve.
            // These values are quite large, so we scale them down by 0.0001
            float xPct = (float)(i * App.GetInput().GetMouseX()) * 0.0001;
            float yPct = (float)(i * App.GetInput().GetMouseY()) * 0.0001;

            // Lets also use the spin to transform the curve over time
            xPct += spin * 0.002;
            yPct += spin * 0.003;

            // Lets feed these two values to sin and cos functions and multiply
            // by how large we want it to be. Because the sin function is producing
            // -1 to 1 results the total width in this case will be double what we specify.
            x =  800.0  * sin(xPct) * 0.5;
            y =  600.0  * cos(yPct) * 0.5;

            // We draw the rects as small 2 pixel by 2 pixel squares and
            // add the position we want them to be osicalting around
            sf::Shape Rect2 = sf::Shape::Rectangle(0, 0, 2, 2, sf::Color::Green);
            Rect2.Move(x + 400, y + 300);
            App.Draw(Rect2);
        }

        // Display current Lissajous curve and then clear screen
        App.Display();
        App.Clear();
    }

    return EXIT_SUCCESS;
}



sfml-pixel-ocean.cpp
Code: [Select]
////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <SFML/Graphics.hpp>
#include <iostream>

////////////////////////////////////////////////////////////
/// Entry point of application
/// Ported from openFrameworks advancedGraphicsExample
///
/// \return Application exit code
///
////////////////////////////////////////////////////////////
int main()
{
    // Create main window
    sf::RenderWindow App(sf::VideoMode(800, 600), "SFML Pixel Ocean");

    // Limit to 60 frames per second
    App.SetFramerateLimit(60);

    // Define and initialize some variables
    float counter, k = 0.0;

    // Start game loop
    while (App.IsOpened())
    {
        // Process events
        sf::Event Event;
        while (App.GetEvent(Event))
        {
            // Close window : exit
            if (Event.Type == sf::Event::Closed)
                App.Close();

            // Escape key : exit
            if ((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::Escape))
                App.Close();
        }

        // Add 0.029 to our counter
        counter = counter + 0.029f;

        // Lets make some 8bit looking waves out of rectangles
        for(int i = 0; i < App.GetView().GetSize().x; i += 50)
        {
            // Lets get a unique height for our 'wave' using sine
            float height = sin(counter + k);

            // sin produces -1 to 1 values, lets add 1 to make sure the height is always positive
            height += 1.0;

            // Now it is going from 0 to 2 but we want it to be taller than that.
            // Lets make it go from 0 - 100 by multiplying 50
            height *= 50;

            // Lets draw it!
            sf::Shape Rect3 = sf::Shape::Rectangle(0, 0, 50, -height, sf::Color(0, 90, 170, 128));
            Rect3.Move(i, App.GetView().GetSize().y);
            Rect3.SetBlendMode(sf::Blend::Alpha);
            App.Draw(Rect3);

            // This variable makes sure that each rect has a unique height otherwise
            // they would all be moving up and down at the same time
            k+=0.7;
        }

        // This is doing it again but for a different color
        k = 0;

        for(int i = 0; i < App.GetView().GetSize().x; i+= 50)
        {
            sf::Shape Rect4 = sf::Shape::Rectangle(0, 0, 50, -50 * (sin(1.4 * counter - k) + 1.0), sf::Color(0, 120, 190, 128));
            Rect4.Move(i + 5, App.GetView().GetSize().y);
            Rect4.SetBlendMode(sf::Blend::Alpha);
            App.Draw(Rect4);
            k += 0.4;
        }

        // Display waves and then clear screen
        App.Display();
        App.Clear();
    }

    return EXIT_SUCCESS;
}



Screenshots from original example and mines [2, 3].

[1] https://github.com/openframeworks/openFrameworks/blob/master/apps/examples/advancedGraphicsExample/src/testApp.cpp
[2] http://imgur.com/TQhat
[3] http://imgur.com/w8NdD

Pages: [1]