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

Pages: [1]
1
SFML projects / Re: 2D Game Engine Made Using SFML 2.1 - Open Source
« on: June 03, 2017, 02:03:23 pm »
Yes,

I totally agree with you on the keyboard and const reference, especially const reference. Even if the github says 10 months, this code is older than that, 10-11 months ago was when I decided to create a public repository for the project. At that time I was not worried about const reference, which now I totally am right now. But because I never used the engine again I never revisited this code.

For the static variables, as far as I remember those are implemented like that because I wanted to allow access to some functionalities without the need to instantiate that, I will try to revisit this code with another eyes.

As in the proposal of the final project I put to many items I had to implement those like I specified.
There is another point where I want to improve performance, which is the pathfind, as it manages objects with different sizes, but the initialization process of the vector is poorly implemented. Because I calculate for each tile how many tiles around it are free, so if this tile have 4 free neighbors this means that I can pass an element 4 times bigger then it on that tile (or node as it becomes later), the process to analise the neighbors are not well implemented.

Also agreed that I should use fstream, and initializers list (which for the time when I implemented this project it was an experience to use c++11, so a lot of move, initializer list, smart pointers and other nice features were left behind).

Thanks for the feedback :)

2
SFML projects / 2D Game Engine Made Using SFML 2.1 - Open Source
« on: June 03, 2017, 01:04:27 am »
Hi,

I created a 2D Game engine. Most of the documentation is in Portuguese, but the methods names and demos are written in English. If there is enough interest in the engine I will translate it to English. It is open source, here is a video of the demo, using open source assets and some songs from a past game that I started to develop.
The engine contains:
- Character management
- Multiple map layer
- Layers to set: Items, Objects, Collision.
- Positional Sound.
- Dialog management, where you can set options to trigger other dialogs. Also you can set callbacks for each options, creating some kind of tree.
- Sprite management.
- Text/Font management.
- Background Music.
- Level transition.
And others

Notice that most of those features are already present on SFML, like positional sound. The Engine provides a way to load those from files (each map layer (item, object, collision, sound) can be loaded from files).

This project was my final computer science graduation project. Also I wrote an article about it, you can find it here: http://www.sbgames.org/sbgames2015/anaispdf/computacao-short/147421.pdf, on engine implementation you can find the modules.

The code is open source, feel free to modify, improve or change it... if you want. This project is somehow old to me, from 2014. But I saw so many nice SFML projects on the SFML twitter that I imagined that this old project can maybe help someone.

The engine was made to develop zelda style games (action adventure), but can be extended.

Here is a demo of the Engine: https://www.youtube.com/watch?v=7YTccI8_ZTs.
The quality is not great (Should have kept the original one).

This code was tested on windows and mac os x with SFML 2.1. There are some hacks to make it work on previous versions of Visual Studio, like default parameters for a variadic template argument.

You can find the code here: https://github.com/AAGEngine

Hope you guys like :)

NOTE: As it was pointed out, the Engine can have several improvements. I agree with most of them, maybe all of them :). But because it was my first experience with C++11 and it was a graduation project there are several places that the Engine can improve. The main reason why the engine stayed like that was the fact that I was never able to start working on a game, the main reason being that I am horrible at pixel art. If I have free time I will fix several things that were pointed out, probably most of them... But if someone wants to use the engine in total or parts of that, feel free to do so.

3
Graphics / Re: Resize texture and get pixel
« on: November 25, 2014, 09:09:58 pm »
Ohh, so to render the texture i need to add the

clear.
...draw here
display.

What version does SFML use of the libjpg?

4
Graphics / Re: Resize texture and get pixel
« on: November 25, 2014, 06:58:44 pm »
lol, thanks.

After i did that i try to save the image on a file (just to check the size) and i get.

JPEG parameter struct mismatch: library thinks size is 584, caller expects 568

What could be the problem?

The code is

Code: [Select]
Texture tmpTexture;
tmpTexture.loadFromFile(tmp.str());
Sprite tmpSprite(tmpTexture);
tmpSprite.setScale(width/tmpSprite.getLocalBounds().width, height/tmpSprite.getLocalBounds().height);
sf::RenderTexture renderTexture;
renderTexture.create(width, height);
renderTexture.draw(tmpSprite);
Texture t=renderTexture.getTexture();
Image imageOut =t.copyToImage();

tmp.str("");
tmp << "1" << entry->d_name;
imageOut.saveToFile(tmp.str());
cout << imageOut.getSize().x << endl;
cout << imageOut.getSize().y << endl;
tmp.str("");

5
Graphics / Re: AW: Resize texture and get pixel
« on: November 25, 2014, 06:51:01 pm »
The thing is sf::Texture "lives" on the GPU, thus the best way would be to write a shader program.
Otherwise you'll have to render the scaled sprite to a render texture and convert the extracted texture to an sf::Image to get to the pixel info. This can be slow.

How do i convert the RenderTexture to image or Texture to Image.

What i did was:

Code: [Select]
Texture tmpTexture;
tmpTexture.loadFromFile(tmp.str());
               
Sprite tmpSprite(tmpTexture);
tmpSprite.setScale(width/tmpSprite.getLocalBounds().width, height/tmpSprite.getLocalBounds().height);
               
sf::RenderTexture renderTexture;
renderTexture.create(width, height);
renderTexture.draw(tmpSprite);
               
Texture t=renderTexture.getTexture();
Image imageOut.... How do i convert?

6
Graphics / Re: Resize texture and get pixel
« on: November 25, 2014, 05:40:28 pm »
i will generate some data about the R, G, B to do another stuff. In the end i am using the SFML library to do another thing, in the end i will just need to output 3 values to a text file, with (R, G, B).

7
Graphics / Resize texture and get pixel
« on: November 25, 2014, 05:31:43 pm »
Hi,

I need to resize a image and get each pixel (after the image is resized)..
I do the resize using

Code: [Select]
Texture tmpTexture;
tmpTexture.loadFromFile(tmp.str());
               
Sprite tmpSprite(tmpTexture);
tmpSprite.setScale(width/tmpSprite.getLocalBounds().width, height/tmpSprite.getLocalBounds().height);

But after that is possible to get the pixel after the resize operation is performed?

Regards

8
Graphics / Re: Error positioning text at (0, 0)
« on: September 30, 2014, 04:05:04 pm »
Thanks, i will try that.

9
Graphics / Error positioning text at (0, 0)
« on: September 30, 2014, 03:03:51 pm »
Hi,

I had some issues rendering the text (SFML 2.1) at some positions, then i changed the position to (0, 0).
I loaded with
font.loadFromFile(textControl->getFontPath());
text.setFont(font);
 

And rendered with:

    text.setString("TEXT");
    text.setScale(1, 1);
    text.setOrigin(0, 0);
    text.setPosition(0, 0);
    window.draw(text);
 

but the result is:



And as u can see, there is some spacing. I saw the calculation method to do the actual max character height subtract by the text character size and subtract by the localBounds height... but no luck until now.

Thanks :)
Ignore the gray rectangle there :).


10
General / Re: SFML 2 rc XCODE 4
« on: July 02, 2012, 07:41:51 pm »
Just a note.
I have the templates, even if i try to build using one of them i get the same error

11
General / SFML 2 rc XCODE 4
« on: July 02, 2012, 07:26:22 pm »
Hi,
I reinstalled my XCODE 4 and i tried to run my old SFML 2.0 project.
No luck, so i tried to reinstall the SFML 2, i tried the installer and to copy all the files to the library/framework, /usr/local/lib and /usr/local/include

But the message 'SFML/Graphics.hpp' file not found still appearing, someone know if i missed something?

Thanks

Pages: [1]