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

Pages: [1]
I've recently come from SDL to try out SFML and I've discovered there's no line shape class. I generally think it's pretty ridiculous to have rectangle, circle and that but not have the most basic line shape.

I've seen one reply to something on SFML that was the developer saying it can be created using VertexArrays but I don't understand the point then? It's basically like saying. Oh something a program doesn't work on your computer? Why don't you go build your own computer and program.

Yeah it can be created using VertexArrays but then so can a rectangle, a circle and so on. It seems like such a trivial feature that will save people the time of making there own custom class for something that should be implemented already. It seems just a bad argument to say to use VertexArrays when it can be implemented by the SFML developers. If your telling me to use VertexArrays then you might as well just tell me to make my own C++ graphics library.

For example in SDL you have SDL_RenderDrawLine(SDL_RENDERER, x1, y1, x2, y2). Which saves time from creating your own class every time you want to draw a line.

So basically I'm wondering if it's possible to simply add a LineShape class where you can say:

line.setPosition(sf::Vector2f(32, 32), sf::Vector2f(64, 64));

Window / Window resizing?
« on: August 21, 2015, 12:54:12 pm »
I've recently started using SFML and it's great. I've got one problem with it though. In for example Java when creating a window and resizing it the objects inside the window will stay the same size. But in SFML it automatically resizes to fit the screen. Creating a stretched ugly mess I've looked online yet can't find anywhere that lets you disable the window resizing like this?

SFML projects / Klinke
« on: August 20, 2015, 01:14:42 pm »
 ;D  Hey guys!  ;D I recently asked a question here : http://en.sfml-dev.org/forums/index.php?topic=18824.0 about whether you can write a SFML game and get it on the web. From what I gathered there's some outdated program for C++ to HTML that doesn't work with SFML. Basically I really wanted to get SFML stuff on the web so you can play it in your browser and there were no programs for doing that so I decided to start a project called Klinke (note? I'm not sure if it's suppose to be here. It's in C++ and I'm writing SFML code and that). Basically it reads .cpp files with SFML stuff in (2.3.1). Then it does it's best to convert it to HTML5 canvas code. Which basically is a window on a webpage. If you don't know what a canvas looks like then heres an example from some HTML5 tutorial thing: http://www.lostdecadegames.com/demos/simple_canvas_game/.

Basically you download Klinke.exe. You put it in the same directory as the files you want to convert. Then you go into the console and run "Klinke [name of file]". Note: don't write .cpp at the end. It opens the file then read's it and then basically writes to a few variables saying what is in the program. Right now it only detects a window. It get's it's width. Then it writes it to a file called "index.html". Which can then be opened.

Notes :
Right now I just wanted to post it so you can see my progress and also in case it helps anyone. As of right now it's not really the best thing as it only detects and window then it's width. I'm going to be working on other versions but this is literally what I did in one day:

Download: https://github.com/HydraPlays/Klinke

Klinke detects window's and reads their width

Klinke now detects the window's height aswell

General / Does SFML work on the web?
« on: August 19, 2015, 03:55:07 pm »
If for example I created a game in SFML. Is there a way I can then put it on a website like how Unity has it's special plugin for running Unity games?

General discussions / Tutorial :: Installing SFML with CodeLite IDE
« on: August 18, 2015, 06:22:34 pm »
To start off let's recap on what SFML and CodeLite are. SFML is a graphics library for C++ that is designed to be simple. SFML stands for Simple and Fast Multimedia Library. CodeLite is a IDE. IDE stands for intergrated development environment. In simple terms an IDE is a editor for code that has special tools to help you develop faster. CodeLite is open-source, cross-platform. First of all I'll go over installing CodeLite, CodeLite is only supported on these operating systems so make sure one of them is yours:

Windows 7
Windows 8
Windows 8.1
Windows 10
Debian / Ubuntu
Fedora / OpenSUSE
Mac OSX 10.8 and later
FreeBSD (this has no installer)

This tutorial is designed for SFML 2.3.1 and CodeLite 8.1.

Installing CodeLite 8.1
Lets start installing CodeLite 8.1. Go to http://downloads.codelite.org Select a package depending on what OS your on and whether your 64bit or 32bit. I'm Windows 64bit. We will be selecting a "CodeLite Stable Release". So I'll be clicking on CodeLite 8.2.0 for Windows 64 bit Installer Direct Link | SourceForge. Click Direct Link. It should start downloading and once it has downloaded run the .exe. From there it's just the basics of installing programs.

Downloading SFML 2.3.1
Okay, now lets download SFML now that we have CodeLite. Head over to http://www.sfml-dev.org/download/sfml/2.3.1/. You can see there's tabs with: Windows, Linux, Mac and All. The "All" tab contains the source code. We will be downloading the pre-made SFML folder though. Select a tab depending on your OS. Then select a version depending on whether your 32 bit or 64 bit. I'm on Windows 64 bit. If your on WIndows your going to want to download "GCC 4.8.1 TDM (SJLJ)". Ignore the 4.7.1 version. Click on "Download". Once SFML 2.3.1 has download you will get a .zip folder. Open it up and you should see a folder in it called SFML 2.3.1. Drag that folder to your C: drive. You should end up with SFML 2.3.1 in the C: drive next to folders with names like Program Files and Users. If this is true then you have correctly downloaded SFML 2.3.1.

Creating a project in CodeLite
Now you may be thinking you can just open CodeLite and start writing majestic code! Sadly that's not true. What your going to want to do is open up CodeLite 8.1. You should see a main view with tabs such as "New Workspace", "Open Workspace", Forums", Wiki". Click on "New Workspace". Select C++ and click OK. Now you can select the location and name. I set my location in my documents folder. So my "Workspace Path" is:


Now you want to select a workspace name. I set mine as "CodeLiteProjects". Enable "Create the workspace under a separate directory". Then click OK. Now you want to create a project to use SFML out. Click on "File" at the top left of the CodeLite window. Then click "New" and then "New Project". You will see a window pop up with a green box saying "New Project". Below that there will be the word Template then tabs called things like "GUI", "Console", "Others". Click on the plus sign next to "Console". It should expand out to reveal more things. Select "Simple Executable (g++)" and then click "Next >". Now you will see another window with the word "Project Name" and "Project Path". Don't edit Project Path, that is correct by default. For project name enter anything you want. I'll enter "SFML-Demo". Make sure "Create the project under a seperatre directory" is enabled. Then click "Next >".
There should be one last window with the word's "Compiler" and "Debugger". Presuming you have Mingw installed these will by default be correct. Just click "Finish".

Running SFML 2.3.1 in CodeLite
Okay, now we are on the last part! All we need to do is make sure CodeLite knows where SFML 2.3.1 is downloaded to. You should have a project in the "Workspace View" under "CodeLiteProjects". There will be a arrow to the left of the name of your project. Click that to expand the project. Do the same for a folder called "src". Now double click on "main.cpp".
By default main.cpp will have some random stuff in. On the top of the CodeLite window there will be a tab called "Build" click that then click "Run". It will ask you whether you want to build. Say yes and then it should run. It should open a console window with the output "hello world". Close that window. Now we know CodeLite is compiling correctly.
All we have to do now is tell CodeLite where to find SFML 2.3.1. In the workspace view you have your project name. Right click on it. At the bottom of the opened bit there will be Settings. Click on that. Now we see the project settings. There's a few tabs on the left. Click on "Compiler". In the center of the new window you will see text saying "Include Paths". Next to that is a text box. Remember when you downloaded and moved SFML 2.3.1. I download it to the C: drive. So enter in that text box "C:\SFML-2.3.1\include". That is just saying to CodeLite to go to a folder in SFML called include and look at the files in that. Below that text box is another called "Preprocessors". Write in that "SFML_STATIC". Now click on "Linker" on the tabs at the left of the window. You will see a text box called "Libraries Search Path". Enter "C:\SFML-2.3.1\lib". That tells CodeLite to open the files in the SFML folder in the the lib folder. Below that is a text box called libraries. Click the "..." to the right of it. A window will pop up. In that write this:


Now your nearly done! Click "OK" and you should return to the main window. Edit the main.cpp file and enter:

#include <SFML/Graphics.hpp>

int main()
    sf::RenderWindow window(sf::VideoMode(800, 600), "Majestic Window");
    while (window.isOpen())
        sf::Event event;
        while (window.pollEvent(event))
            if (event.type == sf::Event::Closed)

Getting the DLLs
Now if you click "Build" and then "Run". You will be so happy! Then you get annoying popups with called System Error saying they can't find SFML files. How annoying! To fix this we need to add the SFML .dll files to the same directory as our project. Open up where you downloaded SFML (C:\SFML-2.3.1\bin) to and then navigate to the bin folder in that. Copy all the files in that. Then go to where your CodeLite project is (C:\Users\[username]\Documents\CodeLiteProjects\SFML-Demo). There should be a folder called "Debug". Go there and paste all the files. If you run the project now it will return more errors saying about more .dll files. Go to where you installed Mingw. In my case I had CodeBlocks with Mingw installed so it was at "C:\Program Files (x86)\CodeBlocks\MinGW". You should see a bin folder click on that. There's a LOT of files. Look for two dll's. Called libstdc++-6.dll and libgcc_S_sjlj-1.dll. Copy them both into the your SFML project's debug folder. If you run the project now it should work!

Now, your finished getting SFML 2.3.1 to work with CodeLite 8.1. Go build some amazing SFML applications!

Feature requests / Windows OS ::getDesktopMode() fix
« on: August 17, 2015, 08:00:19 pm »
I was looking through the documentation on ways to make a window the size of the screen. I found this page:


If you look at the bottom it says (in exact words):

For some reason, Windows doesn't like windows that are bigger than the desktop. This includes windows created with VideoMode::getDesktopMode(): with the window decorations (borders and titlebar) added, you end up with a window which is slightly bigger than the desktop.

I was almost certain there was a way to fix this and make it work for Windows. I'm using Windows 10 operating system, 64 bit version. I tested and it does indeed produce errors. It gets the correct size but places the window 9 pixels to the right. I managed to fix it with:

window.setPosition(-9, 0)

This was perfectly fine but I wanted to find out why it was 9 pixels difference. I managed to find out that that is the size of the frame surrounding the window. I created a C++ project in CodeBlocks not using SFML. Because according to the documentation this only happens in Windows OS's I was able to narrow it down to fixes that only involved Windows OS's. Thus, I could use the default <window.h> class in C++ for Windows. I produced this code which gets the window's surrounding frame size:

#include <windows.h>

#include <iostream>

int main()
    std::cout << GetSystemMetrics(SM_CXSIZEFRAME) << std::endl;

That code produces the size frame's width. Which produced 9, confirming that it is the frame causing windows to be rendered 9 pixels to the right. In Window's you can change the frame size so you can't really just say minus 9 pixels as it can be changed. Thus I began work on a more dynamic solution. Here is my code which renders the window correctly:

#include <SFML/Graphics.hpp>

#include <windows.h>

int main()
    sf::RenderWindow window(sf::VideoMode::getDesktopMode(), "Majestic SFML Window");

    window.setPosition(sf::Vector2i(0 - GetSystemMetrics(SM_CXSIZEFRAME), 0));

    while (window.isOpen())
        sf::Event event;

        while (window.pollEvent(event))
            if (event.type == sf::Event::Closed)



    return 0;

I am fairly certain that the developer of SFML (I think he's called Laurent) can edit SFML to include this. Obviously you cannot just do this as this wouldn't work on other OS's like Mac and Linux. But that's as simple as checking whether the operating system is Window's and if so then run another class to subtract the size frame's size.

So yeah, basically I was wondering if you could fix this bug.[/code]

SFML website / Spelling Error in Documentation
« on: August 16, 2015, 10:14:45 pm »
I'm new to SFML and whilst looking at the SFML documentation I noticed there's a small spelling mistake:


manipulating is spelt manpulating

Pages: [1]