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

Pages: [1]
General / error: redefinition of new
« on: December 21, 2014, 11:48:56 pm »
I am using codeblocks on windows.

i added "#include <SFML/Audio.hpp>" to a file now when I compile I get

c:\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\new||In function 'void* operator new(std::size_t, void*)':|
c:\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\new|111|error: redefinition of 'void* operator new(std::size_t, void*)'|
..\shared\tools.h|36|error: 'void* operator new(size_t, void*)' previously defined here|
c:\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\new||In function 'void* operator new [](std::size_t, void*)':|
c:\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\new|113|error: redefinition of 'void* operator new [](std::size_t, void*)'|
..\shared\tools.h|37|error: 'void* operator new [](size_t, void*)' previously defined here|
c:\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\new||In function 'void operator delete(void*, void*)':|
c:\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\new|117|error: redefinition of 'void operator delete(void*, void*)'|
..\shared\tools.h|38|error: 'void operator delete(void*, void*)' previously defined here|
c:\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\new||In function 'void operator delete [](void*, void*)':|
c:\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\new|118|error: redefinition of 'void operator delete [](void*, void*)'|
..\shared\tools.h|39|error: 'void operator delete [](void*, void*)' previously defined here|
||=== Build finished: 8 errors, 0 warnings (0 minutes, 2 seconds) ===|

I tried including System instead and same errors the errors do not make sense to me. Soon as I remove the include everything is fine.

here is the tools.h file http://websvn.tuxfamily.org/filedetails.php?repname=tesseract%2Fmain&path=%2Fsrc%2Fshared%2Ftools.h

General / Compiling sfml for OSX
« on: December 03, 2012, 08:55:07 am »

I was recently trying to build the sfml 2 sources on OS X Mountain Lion.
Set up all the build stuff. xcode, command line utils and codeblocks.

I used the cmake gui to set everything up and got it to configure and generate after pointing it to freetype lib.

Open the codeblocks project for it and when I try and build I got this.

src/sfml/SFML/Window/GlContext.cpp 105   error: allocating an object of abstract class type 'SFContext'
src/sfml/SFML/Window/GlContext.hpp 174   note: unimplemented pure virtual method 'setVerticalSyncEnabled'  in 'SFContext'
src/sfml/SFML/Window/GlContext.hpp 161   note: unimplemented pure virtual method 'display'  in 'SFContext'
src/sfml/SFML/Window/GlContext.hpp 193   note: unimplemented pure virtual method 'makeCurrent'  in 'SFContext'
src/sfml/SFML/Window/GlContext.cpp 142   error: allocating an object of abstract class type 'SFContext'
src/sfml/SFML/Window/GlContext.cpp 159   error: allocating an object of abstract class type 'SFContext'
src/sfml/SFML/Window/GlContext.cpp 170   error: allocating an object of abstract class type 'SFContext'

Note: I hand typed this. Posting on a different pc. so excuse typos

When I look in src/sfml/SFML/Window/OSX/SFContext.hpp those functions are defined and are not abstract(no =0).

Also in src/sfml/SFML/Window/OSX/SFContext.mm those functions are defined.

Now I am using it with codeblocks with makefiles

I also tried to do it with generating xcode project from cmake. It also had the same errors. Though lacked the notes.

It is really strange and I can not work it out.

Also I really need to build these myself not previously built binaries.

SFML projects / Collision shapes for SFML
« on: November 07, 2012, 04:59:06 pm »
With the talk of the SFML books I was thinking about collision detection and a simple solution.
I have created a function at the moment which accepts sfml shape objects. So you can also draw the shapes your using for debugging or in the actual game.
It works with all the shapes transformations. Such as translation, scale and rotation.
The actual code for this is about 100 lines
This is an example of an person collides with another object it will keep the object out of the wall.
    sf::ConvexShape polygon;
    sf::CircleShape person;
    sf::Vector3f intersect;
    sf::Vector2f pos;
    if(collision(person,polygon,intersect,pos))//order of shapes is important as intersect direction will be reversed

Here is a little demo I was testing. Warning the physics is not even an attempt at proper physics. Though the collision detection works well and you could expand on this with whatever logic you want.


I am not sure what the plan should be next. Should I create Classes for these and that way classes can contain multiple convexShapes to make more usefull collision objects. Should I go as far as some lightweight physics? In any case I am not going to have it do any scene management.

SFML projects / SFML android port
« on: October 16, 2012, 04:50:43 am »
Thought i would give a quick demo of my progress.

The goal is to have all the gui_apps in the examples projects folder in sfmls cmake folder run. Preferably with as little or no changes if possible.

Below is a quick example of sfml system and sfml window parts. It simply makes the entire screen a color.
The green color is controlled by a timer and reset every second and can be reset when your finger touches the screen. The red color is controlled by your fingers last x position and blue by your fingers last y position.

all the same as normal sfml except using gles. There is one part at the top which is driving me nuts. If i have that function where I wanted in sfml window then when it is statically linked the compiler optimizes it out ><. If you have any ideas. I would appreciate it.

stupid peice of code here. The android activity handling stuff would be completely unnoticed.
Though because it is adding a static library and if the ANativeActivity_onCreate entry point is in it. it seems to get Optimised out. >< joy.

#include <android/native_activity.h>
extern void ANativeActivity_onCreate2(ANativeActivity* activity, void* savedState, size_t savedStateSize);

void ANativeActivity_onCreate(ANativeActivity* activity, void* savedState, size_t savedStateSize)
        ANativeActivity_onCreate2(activity, savedState, savedStateSize);

// Headers
#include <SFML/Window.hpp>
#include <GLES/gl.h>

/// Entry point of application
/// \return Application exit code
int main()
    // Create the main window
    sf::Window window(sf::VideoMode(640, 480, 32), "SFML Window", sf::Style::Default, sf::ContextSettings(32));

    // Create a clock for measuring the time elapsed
    sf::Clock clock;

    sf::Vector2u size=window.getSize();

    // Start the game loop
    while (window.isOpen())
        // Process events
        sf::Event event;
        while (window.pollEvent(event))
            // Close window : exit
            if (event.type == sf::Event::Closed)

            if (event.type == sf::Event::MouseButtonPressed)

            // Resize event : adjust viewport
            if (event.type == sf::Event::Resized)
            glViewport(0, 0, event.size.width, event.size.height);
        float x =  sf::Mouse::getPosition(window).x;
        float y = sf::Mouse::getPosition(window).y;

        x /=size.x;
        y /=size.y;

        float val=clock.getElapsedTime().asSeconds();

        glClearColor(x, val, y , 1);

        // Finally, display the rendered frame on screen

    return EXIT_SUCCESS;

below is a video. unfortunately it is not very clear on when i am clicking which is mean to represent my finger on the screen.


I also use extra stuff not shown. Like threads, mutex's and locks. It was required to get the main thread working.

Also any experienced OpenGL ES 2 users around? I suppose this is really not the place where they would be.  Having worked on mobiles which are not really related to SFML. Restructuring the graphics library will be hardest. plus compiling it's libs for android. Hopefully I can offload that work onto you guys :P

Window / Why so many glContexts?
« on: October 14, 2012, 03:50:29 pm »
I have been trying to port sfml to android.

I have worked out the cmake toolchain stuff aswell as getting sfml_system going and some fun with gles aswell.

I have been trying to get sfml_window working(even though the models of android and sfml_window do not match)

Though I have been very confused with some strange results. I noticed that it seems to be coming from having many GLcontexts.

So far the only sfml_window object i use is sf::window yet 2 contexts exist before the windows constructor even gets called.

It appears the first one is created by GlContext::globalInit()

the second is created by by sf::priv::GlContext* getInternalContext()

the third appears to be created by the window constructor which is really the one I thought that makes sense.

Feature requests / sfml for android(already started on)
« on: August 04, 2012, 12:24:48 pm »
I have started working towards getting sfml on android by using the ndk.

I have built a cmake tool-chain that compiles for android and tested it with android.(only tested this through windows)

I have also made something similar to SFML_Main for android. As there is no main function in android to try and replicate it. While ndk works by java making natives calls which would mean the calls could be whatever you want and not having a standard way to make a native activity. Fortunately android has an existing activity called nativeActivity(http://developer.android.com/reference/android/app/NativeActivity.html) which exposes the core functions called during the life cycle of an android activity. Which is what SFML_Main uses.

This is kind of where it goes all to hell. An activity is already a window that calls native code. Which makes the structure of sfml with creating a window after code has started a bit useless. Including all the events and things related to that.

A way around  to have code that  does net need any modifications when using pure sfml between platforms would be to have my sfml_main  store away information about the activity that is needed by the window. Then whenever sfml window is created it could grab all this information. You could then send the activities events through the windows including onPause and all that.

Down side is you would be required to use sfml with sfml main and will not be able to use it with your own custom java front and not using NativeActivity. Which realistically probably isn't that likely.

So I have no idea what the goal should be. And my head is hurting from fighting with cmake ><.

Any suggestions or help would be appreciated. Especially a word from Laurent.

Audio / sounds stream test
« on: April 13, 2012, 08:47:08 pm »
I saw the soundStream class and i decided on testing it out with a little tone synth thing.

I originally had heaps of trouble. It worked but with crackling and pops even when 20 secs of audio of one tone was sent at a time. Drove me mad. I eventually went to the site below and updated openal and it worked(i'm on windows 7 by the way)

What I was wondering is for how many of you does it pop or crackle and if you fixed it with the download from the site. The demo is below. Also remember that if you switch notes quickly you will get a pop. That is because of my implementation and not openal. I only fade in one not and out one note at a time.


Any feedback will be much appreciated.

General discussions / What is SFML_SYSTEM_API for(and others)?
« on: March 25, 2012, 04:39:29 pm »
I just though i would add a class to my sfml system lib to make some things easier things.

i copied clock and based it off that largely(also editing cmake and system.hpp). It has a sections in the header like this.


I have pretty much the same thing

class SFML_SYSTEM_API DateTime

I get this error

error: variable 'sf::SFML_SYSTEM_API sf::DateTime' has initializer but incomplete type

When i remove SFML_SYSTEM_API  from my class definition it compiles and also works in my example program. So i do not really get why it is there and why it will not accept my class.
(I may post full class code later after hearing what it is, and if i can not solve it from that.)

I appreciate any help you guys can give me.

Feature requests / sfml gl lib
« on: March 07, 2012, 02:10:43 am »
I know previously in pre version 2 you seemed to allow the loading of extensions by an application through sfml. I know you have removed this as you are trying to add abstraction for gl es,xbox or whatever.

Though it seems you still load glew into the library, and your libraries are powerful and make it easy to develop for.

I know you can add GLee or glew again. Just seems a slight waste when it is in your library as well.
I was wondering if you might consider making SFML GL library. That helps integrate some of your libraries with someone aiming for using GL.

An example is your powerful font library. I rewrote a sfml text class to be more friendly with my needs in opengl. Also your file texture loading has saved me a huge hassle(nothing really needs to change there. It simply works).

even if the answer is no. Any ideas on what such a library would include would be helpful. Maybe an idea how Drawable classes can be used uniformly open gl.

I'm not really asking that scene managers and all that other stuff be included, because then that is essentially making a 3d engine.

While I do not expect you to drop everything and write it(I and hopefully the community would write it). Would it be something you would consider for inclusion with SFML?

General discussions / google chromes Native Client SDK
« on: December 10, 2011, 02:34:54 am »
I just heard that bastion was released in google chrome. It apparently uses google chromes native client SDK which allows you to compile c and c++ for use in google chrome.

Hopefully SFML can be ported to use this one day. Though it looks like it does not expose opengl or opengl ES(I know sfml doesn't support it but work done for android would simultaneously help this), but it's own abstraction of rendering. Makes sense if plans are to make it run everywhere.

Just thought I would mention it. What are your guys thoughts?

I thought i posted this in "General discussions" not general help. Might need to be moved.

Graphics / Any plans for sfml text to be opengl friendly
« on: October 08, 2011, 03:42:39 pm »
I mainly use SFML to load images and use opengl context.
I would really like to use the amazing feature of SFML fonts. Much better than my bitmap fonts I use now.
Though the problem is it can only be drawn when using render window.

I could rewrite SFML:: text to allow this by copy and pasting it and just modifying Text::Render to use pure opengl commands. Though that seems like a real waste.

Is there any plans of making them friendly to both?

I mean you could have dummy
RenderTarget and Renderer to pass to sfml::Text and then you wouldn't need to change anything of sfml::Text and would allow any drawable object to work.
It would just need to not apply any predefined transformations like renderWindow does. That way transformations in opengl will effect the font and also wont effect other opengl settings.

I would be greatful of an ideas or suggestions.

SFML projects / Instrument rhythm game
« on: September 16, 2011, 10:59:32 am »
It is a rhythm game for real instruments. So far I've only got a visualization for a guitar though i plan to have many different types for at least keyboard and drums.

I am using SFML 1.6
At the moment I don't use SFML for much apart from input,loading images and an openGL context. Though I am thinking of having the option for audio to go with a track. A wave file or something similar. Which SFML audio should be perfect for.I do not know about playing at different tempos. Even if speed can be changed then the pitch of notes will as-well.

At the moment +/- keys can increase tempo while playing. That can not really be kept unless There is a 3rd mode separate of training mode. Have no idea what that would be called.

There is no scoring system apart from a little % sign saying the percentage of notes hit out of the entire song.

some Videos



Window / get a window device context
« on: May 17, 2011, 03:03:30 pm »
I am writing some code to do text in opengl. I am using wglUseFontOutlines based on some tutorials i have read.

The problem is i need a HDC for this to work. I can not see anyway to do that looking at your api.

Could you provide some information about this?

Graphics / render text in 3d space
« on: May 15, 2011, 01:35:55 pm »
I use opengl with sfml and one of the things i wanted to accomplish was to write text in 3d space. A long time ago I did this by having a quad for each letter.

Though I was thinking that sfml already has sf::text which i assume uses the same technique. Though it seems to be only designed to work in 2d.

Is there anyway that i can make sf::string draw to opengl at the current location and rotation?

I appreciate any help or advice you can offer.

General / local symbol `' has no section
« on: May 12, 2011, 09:42:10 am »
I am trying to use two libraries to make a program. One is obviously SFML. The other is RtMidi.

Though I have have this annoying issues where I have everything linked as it should to get both working.
Though when I only have sfml code it is fine.
If I use only RtMidi code it is fine.
Though if i have even a single line from either in the other code I can not compile.

This is the error. There is a square where the question make is(obviously an odd ascii char of some kind) though it doesn't copy well.

warning: C:\SFML-1.6\lib\mingw/libsfml-window-s.a(dwzes00087.o): local symbol `?' has no section

I use code::blocks with mingw.

It has been driving me nuts. I have no idea what is wrong.
Also i'm not using it for midi out if thats what people are thinking. I'm using it for midi in, and it has to be in real time.

Any help would be much appreciated.

Pages: [1]