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

Pages: [1] 2 3 ... 5
1
General discussions / Re: SFML 3 - What is your vision?
« on: April 30, 2014, 08:08:08 am »
Don't try to teach me the good coding behavior, I know them, this is my work to know that. But I'll tried to explain what I do with SFML.

I'm mainly using SFML to make games. And for making games is not about perfect code, with perfect architecture and perfect respect of all programming matter such as choosing the right type. For me is about prototyping and fast development and trashing.  You're right in everything you said but in that special case I couldn't care less about coding right. I just want to make a prototype and work on the gameplay. Maybe I should not use SFML for that purpose and using something like unity or gamemaker. But I like C++ and SFML  ;D

I always use float, and it's wrong but it work fine.

You're asking what's battering us, I'm just answering.

PS: I've read this class so many times... I don't know how I could not see that constructor. ^^

Edit: I'm not sure you will have good answer with this question (about our vision) I find more interesting to know what people are doing with SFML. And then you will know what SFML is lacking. If everyone is making 2D game, maybe it's wise to help them with a game module.

2
General discussions / Re: SFML 3 - What is your vision?
« on: April 30, 2014, 12:07:39 am »
Quote
It is uncomfortable for me (and I think I am not alone) to have 3 different vector types (Vector2u, Vector2f, Vector2i) and 2 different rectangle types (FloatRect, IntRect).
There are several types of vectors and rectangles for the same reason that there are several types for numbers. Because each type is suitable in a given situation.

Yeah I find it really annoying too. I get what you're saying Laurent, but most of the time I only use/care about the float version. Could you at least provide cast facilities ? something like that (if you don't have a better ideas):

sf::Vector2i exactPos = floatPos.to<int>();

3
General discussions / Re: SFML 3 - What is your vision?
« on: April 28, 2014, 10:00:42 am »
You are talking different backends, this isn't as simple as you think and would require a complete redesign of SFML internally.

You can use ANGLE to do that, Qt is using it to provide OpenGL ES or DirectX on Windows http://qt-project.org/wiki/Qt-5-on-Windows-ANGLE-and-OpenGL

I also like to have some of QML (from Qt) capabilities ie : (Which are also present in JavaFX take a look)
  • A Scene Graph (with basic positionner container like column, row, grid)
  • Anchors
  • Animation (property, tween, easing ...)
  • Multi-Touch and Basic Gesture (pinch, multi finger tap and swipe)

For game purpose I see everyone re-developping the same thing :
  • TileMap rendering
  • Sprite Batching
  • Entity System
  • Particules
  • Improving sf::Text with metric, alignement and true multi ligne

This is the few thing I've been rewriting over and over again from the past years, for every game I made.
To illustrate the SceneGraph stuff take a look at one of my last project I'm working on https://github.com/Canadadry/PineApple/blob/master/src/main.cpp

4
Feature requests / Re: Touch Events Interface Request
« on: January 17, 2014, 08:43:27 am »
But what about touch event on Windows, MacOS and Linux ?

5
SFML projects / Re: Lua Binding
« on: December 15, 2013, 12:35:05 pm »
I'm not sure if I will maintain it over time, since I'm doing this this mainly for me. It's development is directly link to what I need, which project I'm working on. So don't get to excited. At least I provide my sources ^^.
Even if it's not complete you can already do a lot with it.

Thank a lot for the link Nexus I was looking for something simple and light to do the binding. But I've found nothing. So i've directly use lua C-API. It's been hard but I've learn a lot.

I will try to simplify the binding, but I'm currently limited by my knowledge of lua c-api and my time. ^^
I'm aiming something like LOVE for the simplicity and I also wanna add physics, 2D engine and stuff.
I don't know when it will be done, or if it will be done. I'll try to improve it until I get bored or I find something that fit all my need.

I'm not fan of using string instead of enum. It doesn't seems right.

I really like Lua and such but I don't think that completely/automatically mirroring the c++ API 1 to 1 is a good idea.

I know I should adapt to lua convention, but I'm not used to it and it could force me to write a documentation. Currently C++ doc is enough. It's a huge project I don't want to get bored or frightened by doing thing like this.
This is not the best but better is enemy of good.

Awesome stuff :). Will be really nice once it's more Lua-like. e.g.,

window = sf.RenderWindow{w=640, h=480, title = "Test"}


It could be great but I'm not sure how to achieve this ^^

6
SFML projects / Lua Binding
« on: December 14, 2013, 12:18:50 pm »
Hi,

During a long time I was looking for a simple and fast GameEngine but I could find something as simple and light weight as SFML. So I found myself writing one, but more the time pass, less I wanted to lost time with C++. I wanted to be able to fast prototyping like it can be done with GameMaker for example.  And here I am porting SFML to Lua.

I wanted it to be simple (mirroiring SFML API) light weight (no Boost at all). It's not finished yet (no network for example). I've added some extra classes like TileMap or SceneGraph Item.

I've not reach yet my objective to fast prototyping but it's been pretty fun. I hope you will enjoy it.

The source code is avaible https://github.com/Canadadry/luaSFML
On the repo you will find some test project I've made in the demo folder. There is a Tetris, a pong, and a Minesweeper.

Here an example of script :

math.randomseed(os.time())

window = sfRenderWindow.new(sfVideoMode.new(640,480,32),"Test",sfWindowStyle.Default);
window:setFramerateLimit(30)


circle = sfeSGItem.new();
circle:move(50,50);
circle:setWidth(100);
circle:setHeight(100);

child1 = sfeSGItem.new(circle);
child1:setWidth(50);
child1:setHeight(50);


clearColor = sfColor.new(math.random(256)-1,math.random(256)-1,math.random(256)-1);

event = sfEvent.new();
while window:isOpen() do
    i = 0;
    while window:pollEvent(event) do
        if(event:type() == sfEventType.Closed) then window:close(); end
        if(event:type() == sfEventType.KeyReleased and event:key():code() == sfKey.Escape ) then window:close(); end
        if(event:type() == sfEventType.KeyReleased and event:key():code() == sfKey.Q and event:key():system() == true ) then window:close(); end
    end

        circle:rotate(1);
        child1:rotate(-2);

    window:clear(clearColor);
        window:draw(circle);
    window:display();
end
 


Thanks for reading me :)
 

7
General discussions / Re: Android and iOS ports available for testing
« on: December 14, 2013, 11:49:16 am »
Hi,
I'm on the iOS port too.  :D
I've tried to build it whitout any succes. 
First error that pops to me : it can't find <GL/glew.h> to fix it I had to modified XCode projet and add a user search Path to the extlibs/header you've provided.
Then it couldn't find <OpenGL/glu.h> and I don't know why.... I will look further more later.

I've recently moved to Maverick via update and install the last XCode (5.something) through AppStore. So it's might be to link to all of this. Maybe a clean install will help....  :(
Still, I'm eager to try this ^^

Thanks for the work you've done.

8
Feature requests / Re: 9 Slice Scaling
« on: November 16, 2013, 10:11:26 am »
You don't need anything more from SFML. You can write it pretty easily like this :

headers
#ifndef BORDERIMAGE_H_
#define BORDERIMAGE_H_

namespace sf{
class Texture;
class Color;
}

#include <SFML/Graphics/Transformable.hpp>
#include <SFML/Graphics/Drawable.hpp>
#include <SFML/Graphics/VertexArray.hpp>


class BorderImage : public sf::Drawable, public sf::Transformable
{
public:
        BorderImage();
        virtual ~BorderImage();


        sf::Vector2u getSize() const;
        void setSize(sf::Vector2u size);
        void setWidth(unsigned int width);
        void setHeight(unsigned int height);

        void setTexture(const sf::Texture& texture, unsigned int border);

        void setLeftBorder  (unsigned int leftBorder);
        void setRightBorder (unsigned int rightBorder);
        void setTopBorder   (unsigned int upBorder);
        void setBottomBorder(unsigned int downBorder);
        unsigned int   leftBorder() const;
        unsigned int  rightBorder() const;
        unsigned int    topBorder() const;
        unsigned int bottomBorder() const;

        void setColor(const sf::Color& color);
        sf::Color color() const;

private:
        const sf::Texture* m_texture;
        unsigned int m_left;
        unsigned int m_right;
        unsigned int m_top;
        unsigned int m_bottom;
        unsigned int m_width;
        unsigned int m_height;

        mutable sf::VertexArray    m_vertex_array;
        mutable bool m_need_update;

        void updateVertices() const;
        virtual void draw(sf::RenderTarget& target, sf::RenderStates states) const;

};

#endif /* BORDERIMAGE_H_ */

source
#include "BorderImage.h"


#include <SFML/Graphics/RenderTarget.hpp>
#include <SFML/Graphics/Texture.hpp>

BorderImage::BorderImage()
    : m_texture(0)
    , m_left(0)
    , m_right(0)
    , m_top(0)
    , m_bottom(0)
    , m_width(0)
    , m_height(0)
    , m_need_update(true)
    , m_vertex_array(sf::TrianglesStrip, 24)
{
}

BorderImage::~BorderImage()
{
}

sf::Vector2u BorderImage::getSize() const
{
    return sf::Vector2u(m_width,m_height);
}

void BorderImage::setSize(sf::Vector2u size)
{
    m_width  = size.x;
    m_height = size.y;
    m_need_update = true;
}

void BorderImage::setWidth(unsigned int width)
{
    m_width  = width;
    m_need_update = true;
}

void BorderImage::setHeight(unsigned int height)
{
    m_height = height;
    m_need_update = true;
}

void BorderImage::setTexture(const sf::Texture& texture, unsigned int border)
{
    m_left = border;
    m_right = border;
    m_top = border;
    m_bottom = border;
    m_texture = &texture;
    m_need_update = true;
}

void BorderImage::setLeftBorder (unsigned int border)
{
    m_left = border;
    m_need_update = true;
}

void BorderImage::setRightBorder(unsigned int border)
{
    m_right = border;
    m_need_update = true;
}

void BorderImage::setTopBorder   (unsigned int border)
{
    m_top = border;
    m_need_update = true;
}

void BorderImage::setBottomBorder (unsigned int border)
{
    m_bottom = border;
    m_need_update = true;
}

unsigned int  BorderImage::leftBorder() const  { return m_left;  }
unsigned int BorderImage::rightBorder() const  { return m_right; }
unsigned int    BorderImage::topBorder() const  { return m_top;   }
unsigned int  BorderImage::bottomBorder() const { return m_bottom;}


void BorderImage::setColor(const sf::Color& color)
{
    for(int i=0;i<24;i++)
    {
        m_vertex_array[ i].color = color;
    }
}

void BorderImage::draw(sf::RenderTarget& target,sf::RenderStates states) const
{
    if( m_need_update == true)
    {
        updateVertices();
        m_need_update = false;
    }
    if (m_texture)
    {
        states.transform *= getTransform();
        states.texture = m_texture;
        target.draw(m_vertex_array,states);
    }
}

void BorderImage::updateVertices() const
{
    // http://dan.lecocq.us/wordpress/wp-content/uploads/2009/12/strip.png
    //     i ->
    //   j  0     1    2    3
    //   |
    //   V  4     5    6    7
    //
    //      8     9    10   11
    //
    //     12    13    14   15
    //
    // =>       0, 4, 1, 5, 2, 6, 3, 7, 7, 11, 6, 10, 5, 9 ,4 ,8, 8 ,12 ,9 ,13, 10 ,14, 11,15

    const unsigned int triangleStripVextexCount = 24;
    const unsigned int triangleStripVertexOrder[triangleStripVextexCount] = {0, 4, 1, 5, 2, 6, 3, 7, 7, 11, 6, 10, 5, 9 ,4 ,8, 8 ,12 ,9 ,13, 10 ,14, 11,15};

    if (m_texture)
    {
        unsigned int x_pos[4] = {0 , m_left , m_width  - m_right  , m_width};
        unsigned int y_pos[4] = {0 , m_top  , m_height - m_bottom , m_height};
        sf::Vector2f verticesPosition[16];

        unsigned int t_width = m_texture->getSize().x;
        unsigned int t_height = m_texture->getSize().x;

        unsigned int x_textCoord[4] = {0,m_left , t_width  - m_right  , t_width};
        unsigned int y_textCoord[4] = {0,m_top  , t_height - m_bottom , t_height};
        sf::Vector2f verticesTextCoord[16];

        for(int i = 0; i< 4;i++)
        {
            for(int j = 0; j< 4;j++)
            {
                verticesPosition[i+4*j] = sf::Vector2f(x_pos[i],y_pos[j]);
                verticesTextCoord[i+4*j] = sf::Vector2f(x_textCoord[i],y_textCoord[j]);
            }
        }

        for(int i = 0; i<triangleStripVextexCount;i++)
        {
            m_vertex_array[ i].position  = verticesPosition [ triangleStripVertexOrder[i]];
            m_vertex_array[ i].texCoords = verticesTextCoord[ triangleStripVertexOrder[i]];
        }
    }
}
 

9
General discussions / Re: SFML team is growing
« on: August 06, 2013, 02:47:53 pm »
So you will only support mono-touch ? Or do you have other ideas ?

10
I'm glad to here that.  :)
You won't be out of work for a long time with plan like that.  :P

11
Hi,

I've read the example you provided and it look just great.  :D I've always search for something that make writing a client/server communication simple but I've never found something really simple and useful. Now it's done thanks to you.

I hope some day Laurent will write more than just a socket class and more client/server object. Like he did with graphic renderer. Your project would clearly make the job.  :D

Just one question why in the BaseProtocol::send and received doesn't you directly provide the packet instead of the socket? In my opinion, we don't want  the user to mess with the socket here. We just want to let it him read/write data onto a packet. Don't you think ?

Again great job with this  :D

12
Feature requests / Re: Pixel Buffer Objects support in SFML2
« on: February 11, 2013, 07:04:25 pm »
I'll try to write something clear to show you. For performance, you could watch that http://www.songho.ca/opengl/gl_pbo.html. For me PBO run 6 times faster than glTexSubImage2D. He's uploading a texture (1024x1024 as RGBA) with pbo which take less than a millisec (and 6ms without).

For The API I guess an UpdatableTexture with the exact same interface as the current Texture would fit perfectly. It just need a create and an update function to work.
 

13
Feature requests / Re: Pixel Buffer Objects support in SFML2
« on: February 11, 2013, 12:15:29 am »
I've already done that. But I don't want to be cut off the official sfml, it's to much work for a so small feature. I rather like use an ugly trick (like "#define private public") than fork SFML. But that's not the point here. 

14
Feature requests / Re: Pixel Buffer Objects support in SFML2
« on: February 10, 2013, 08:48:36 pm »
Hi,
I'm finding this function quite interesting too. And I wonder if we could have at least virtual functions to let us implement it ?
Thanks.

15
General discussions / Re: SFML 2 and Qt5 on Windows
« on: January 07, 2013, 09:40:51 am »
Here a list of all OpenGL ES function : http://pastebin.com/bZK6Bnj6

For SFML2, that imply do not use anymore Matrix functions and use allways shader. Re-write context creation code. I guess this is all it has to be done.

Pages: [1] 2 3 ... 5