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

Pages: [1] 2 3
SFML website / Link to Flattr is broken (404)
« on: May 07, 2018, 11:24:55 pm »

Link to Flattr is broken (404).

Why you dont use patreon?


Graphics / Bug with texture rendering
« on: May 22, 2013, 07:58:33 pm »

Im building a game and when i create all in the same class, everything is working fine, and after it works, i separate it into classes and refactored the code.

After refactor, my player class have a texture attribute that store the texture and the engine draw the animated sprite.

So the pseudo-code is:

  - AnimatedSprite *sprite
  - sf::Texture *texture

  - player->update(sf::Time delta)
  - player->draw() or window->draw(*player->sprite)   // both code i get the same problem

Can anyone try help me? I think that is a small problem, because it is moving correctly and everything is working, only the rendering problem while player draw.

Screenshot is attached with result.


[attachment deleted by admin]

General / Shape with alpha effect
« on: May 21, 2013, 11:47:23 pm »

Im drying use shapes to debug box2d physics. But the problem is that shape dont have a method to make it alpha.

I see some examples that you can use opengl direct to do it.

SFML has a native method to make shapes with alpha?

General / Box2D - The physic body is bigger
« on: May 21, 2013, 11:04:42 pm »

Im using the box2d with sfml and animated sprite class.

You see the example in screenshot attached.

My player is 40/56 (width/height) and when i create the physic body, it is bigger than my sprite size.

If you see in screenshot, you will see that the boxes are one up other, and over the player it have a padding/blank space, the boxes collide with a space bigger than my sprite.

My code:

void Engine::createPlayerPhysics(b2World& World, int posX, int posY, int width, int height)
    b2BodyDef BodyDef;
    BodyDef.position = b2Vec2(posX/SCALE, posY/SCALE);
    BodyDef.type = b2_dynamicBody;
    BodyDef.userData = (void*)"mainPlayer";
    playerBody = World.CreateBody(&BodyDef);

    b2PolygonShape Shape;
    Shape.SetAsBox(width/SCALE, height/SCALE);
    b2FixtureDef FixtureDef;
    FixtureDef.density = 10.f;
    FixtureDef.friction = 0.7f;
    FixtureDef.shape = &Shape;

    ////////////// player ////////////////
    int width = 40;
    int height = 56;

    sf::Texture playerTexture;
    playerTexture.loadFromFile(resourcePath() + "images/player1.png");

    Animation walkingAnimation;
    walkingAnimation.addFrame(sf::IntRect(0, 2*height, width, height));
    walkingAnimation.addFrame(sf::IntRect(1*width, 2*height, width, height));
    walkingAnimation.addFrame(sf::IntRect(2*width, 2*height, width, height));
    walkingAnimation.addFrame(sf::IntRect(3*width, 2*height, width, height));

    AnimatedSprite animatedSprite(sf::seconds(0.2));
    createPlayerPhysics(*world, 50, 50, width, height);

What can be wrong?

[attachment deleted by admin]

General / Mac deploy problems
« on: May 21, 2013, 07:35:09 pm »

What libs i need link with my project to deploy my application on other Mac.

I currently link to:
- Box2D
- sndfile (framework)
- freetype (framework)

I need link with these too?

- libGLEW
- libjpeg

I compile the project on my mac with osx 10.8, and on mac 10.7.5 i got error. I think that the problem can be this libs, but i need know if i need link my program with those libraries or the problem is the osx version that is different.


General / Link problem with SFML2
« on: May 17, 2013, 05:06:01 pm »

I have a link problem im my temporary project:

The problem is when the compiler will link the libraries SFML2.

Can anyone analyse the CMakeLists.txt to see if find the problem to help me?

To test it, you only need:

1 - Download from github
2 - cd build
3 - ./rebuild.sh

My log:

Paulos-MacBook-Pro:build paulo$ ./rebuild.sh
-- The C compiler identification is Clang 4.2.0
-- The CXX compiler identification is Clang 4.2.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Found SFML . in /Users/paulo/Documents/workspaces/cpp/sfml-cmake/library/sfml/mac/include
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/paulo/Documents/workspaces/cpp/sfml-cmake/build
/usr/local/Cellar/cmake/ -H/Users/paulo/Documents/workspaces/cpp/sfml-cmake -B/Users/paulo/Documents/workspaces/cpp/sfml-cmake/build --check-build-system CMakeFiles/Makefile.cmake 0
/usr/local/Cellar/cmake/ -E cmake_progress_start /Users/paulo/Documents/workspaces/cpp/sfml-cmake/build/CMakeFiles /Users/paulo/Documents/workspaces/cpp/sfml-cmake/build/CMakeFiles/progress.marks
make -f CMakeFiles/Makefile2 all
make -f CMakeFiles/sfml-project.dir/build.make CMakeFiles/sfml-project.dir/depend
cd /Users/paulo/Documents/workspaces/cpp/sfml-cmake/build && /usr/local/Cellar/cmake/ -E cmake_depends "Unix Makefiles" /Users/paulo/Documents/workspaces/cpp/sfml-cmake /Users/paulo/Documents/workspaces/cpp/sfml-cmake /Users/paulo/Documents/workspaces/cpp/sfml-cmake/build /Users/paulo/Documents/workspaces/cpp/sfml-cmake/build /Users/paulo/Documents/workspaces/cpp/sfml-cmake/build/CMakeFiles/sfml-project.dir/DependInfo.cmake --color=
Dependee "/Users/paulo/Documents/workspaces/cpp/sfml-cmake/build/CMakeFiles/sfml-project.dir/DependInfo.cmake" is newer than depender "/Users/paulo/Documents/workspaces/cpp/sfml-cmake/build/CMakeFiles/sfml-project.dir/depend.internal".
Dependee "/Users/paulo/Documents/workspaces/cpp/sfml-cmake/build/CMakeFiles/CMakeDirectoryInformation.cmake" is newer than depender "/Users/paulo/Documents/workspaces/cpp/sfml-cmake/build/CMakeFiles/sfml-project.dir/depend.internal".
Scanning dependencies of target sfml-project
make -f CMakeFiles/sfml-project.dir/build.make CMakeFiles/sfml-project.dir/build
/usr/local/Cellar/cmake/ -E cmake_progress_report /Users/paulo/Documents/workspaces/cpp/sfml-cmake/build/CMakeFiles 1
[ 25%] Building CXX object CMakeFiles/sfml-project.dir/main.cpp.o
/usr/bin/c++    -g -I/Users/paulo/Documents/workspaces/cpp/sfml-cmake/library/sfml/mac/include    -o CMakeFiles/sfml-project.dir/main.cpp.o -c /Users/paulo/Documents/workspaces/cpp/sfml-cmake/main.cpp
/usr/local/Cellar/cmake/ -E cmake_progress_report /Users/paulo/Documents/workspaces/cpp/sfml-cmake/build/CMakeFiles 2
[ 50%] Building CXX object CMakeFiles/sfml-project.dir/Engine.cpp.o
/usr/bin/c++    -g -I/Users/paulo/Documents/workspaces/cpp/sfml-cmake/library/sfml/mac/include    -o CMakeFiles/sfml-project.dir/Engine.cpp.o -c /Users/paulo/Documents/workspaces/cpp/sfml-cmake/Engine.cpp
/usr/local/Cellar/cmake/ -E cmake_progress_report /Users/paulo/Documents/workspaces/cpp/sfml-cmake/build/CMakeFiles 3
[ 75%] Building CXX object CMakeFiles/sfml-project.dir/Util.cpp.o
/usr/bin/c++    -g -I/Users/paulo/Documents/workspaces/cpp/sfml-cmake/library/sfml/mac/include    -o CMakeFiles/sfml-project.dir/Util.cpp.o -c /Users/paulo/Documents/workspaces/cpp/sfml-cmake/Util.cpp
/usr/local/Cellar/cmake/ -E cmake_progress_report /Users/paulo/Documents/workspaces/cpp/sfml-cmake/build/CMakeFiles 4
[100%] Building CXX object CMakeFiles/sfml-project.dir/ResourcePath.mm.o
/usr/bin/c++    -g -I/Users/paulo/Documents/workspaces/cpp/sfml-cmake/library/sfml/mac/include    -o CMakeFiles/sfml-project.dir/ResourcePath.mm.o -c /Users/paulo/Documents/workspaces/cpp/sfml-cmake/ResourcePath.mm
Linking CXX executable sfml-project.app/Contents/MacOS/sfml-project
/usr/local/Cellar/cmake/ -E cmake_link_script CMakeFiles/sfml-project.dir/link.txt --verbose=1
/usr/bin/c++   -g -Wl,-search_paths_first -Wl,-headerpad_max_install_names -framework Foundation -w CMakeFiles/sfml-project.dir/main.cpp.o CMakeFiles/sfml-project.dir/Engine.cpp.o CMakeFiles/sfml-project.dir/Util.cpp.o CMakeFiles/sfml-project.dir/ResourcePath.mm.o  -o sfml-project.app/Contents/MacOS/sfml-project  ../library/sfml/mac/lib/libsfml-system.dylib ../library/sfml/mac/lib/libsfml-window.dylib ../library/sfml/mac/lib/libsfml-graphics.dylib ../library/sfml/mac/lib/libsfml-network.dylib ../library/sfml/mac/lib/libsfml-audio.dylib
Undefined symbols for architecture x86_64:
  "sf::String::String(std::string const&, std::locale const&)", referenced from:
      Engine::initializeGraphics() in Engine.cpp.o
  "sf::Texture::loadFromFile(std::string const&, sf::Rect<int> const&)", referenced from:
      Engine::run() in Engine.cpp.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [sfml-project.app/Contents/MacOS/sfml-project] Error 1
make[1]: *** [CMakeFiles/sfml-project.dir/all] Error 2
make: *** [all] Error 2

General / sf::Thread is blocking main thread
« on: September 19, 2012, 05:58:19 am »

I create a sample code to illustrate my problem:

void threadMethod()

int main()
    sf::Thread thread(&threadMethod);

    return EXIT_SUCCESS;


When thread start, the process stop/lock until threadMethod exit (in this example, never).

Why it happen if thread is another "process"? The correct is thread start and program finish on "return EXIT_SUCESS". No?

General / SFML + V8 + Threads - How to?
« on: September 17, 2012, 06:58:16 am »

I made a simple thread example using SFML, V8 and SF::THREAD.

The problem is when the thread is executed, my program quit with message "segmentation fault: 11".

I only execute the same method to read a JS and execute it, but on another method by thread.

You can see example here:

To use thread method, change var:
bool useThread = false;

bool useThread = true;

In "main.cpp" file.

The method that thread call is the same of main loop code without thread:

void start()
    v8::HandleScope handleScope;
    v8::Handle<v8::String> source = readFile(resourcePath() + "/js/robot1.js");
    v8::Handle<v8::Script> script = v8::Script::Compile(source);
    v8::Handle<v8::Value> result = script->Run();

Thanks for any help.

General / SFML and V8 - Javascript doesnt know c++ objects
« on: September 16, 2012, 07:25:07 pm »
Hi ppl,

I made with help of people from here a running version of a program that integrate v8 and sfml.

But my problem now is that javascript doesnt know my objects and get an error on console when i execute the program:

<unknown>:232: Uncaught TypeError: Object [object Object] has no method 'walkForward'

But my class is created as same of sf_v8 classes.

You can see here:

My class that is sent to v8:

And my main file that send it to v8:
LINES: 86:92


Graphics / Sprite as attribute doesnt Draw but local sprite Draw
« on: September 14, 2012, 10:50:25 pm »

Im with a small problem here that my sprite that is in my class "Character" doesnt "draw" with "window.draw", but if i create a local sprite (the same sprite code and image) it draw.

You can see here (have both sprite - local and as attribute):

I got no error and when debug, all sprite attributes is fine :(

General / SFML and V8 - Send custom classes and objects to V8 vm
« on: September 14, 2012, 05:14:02 pm »

I made a project that use V8 integration with SFML, but my problem is with custom class/objects that i want that V8 can see.

I created a class "Character" like the same of others "sf_v8" classes. But my application open and close,and the default error "Segment fault".

I can use my project with sf::Sprite class, it is working perfect. But now i want custom classes.

Can anyone help me?

You can see where i stop here:


General / Resources like images are not found by Application
« on: September 14, 2012, 11:21:34 am »

Resources add not recognized by my Application here:

The "images" are in the path "sfml-project.app/Contents/Resources/images" but i get error:

Failed to load image "images/robot1.png". Reason : Unable to open file

Can anyone help me?

General / CMake doesn't link with SFML libaries
« on: September 12, 2012, 04:53:59 pm »

I make a small project to compile projects using CMake. But when i will link the libraries of SFML i got the error:

MacBook-Pro-de-Paulo-Coutinho-2:build paulo$ ./build.sh
-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Checking whether C compiler has -isysroot
-- Checking whether C compiler has -isysroot - yes
-- Checking whether C compiler supports OSX deployment target flag
-- Checking whether C compiler supports OSX deployment target flag - yes
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Checking whether CXX compiler has -isysroot
-- Checking whether CXX compiler has -isysroot - yes
-- Checking whether CXX compiler supports OSX deployment target flag
-- Checking whether CXX compiler supports OSX deployment target flag - yes
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
Found SFML: /usr/local/include
CMake Error at CMakeLists.txt:19 (target_link_libraries):
  Cannot specify link libraries for target
  "/usr/local/lib/libsfml-system.dylib" which is not built by this project.

-- Configuring incomplete, errors occurred!
make: *** No targets specified and no makefile found.  Stop.

The project is located here:


To build, you need enter in "build" directory and call "sh build.sh" and to clear temp. files, call in "build" directory "sh clean.sh".

The libraries was installed using default cmake files of SFML package.

Thans for any help.

General discussions / SFML2 and Box2D Debug Draw
« on: August 12, 2012, 10:56:16 am »

Im searching for a debug draw for SFML2 and Box2D 2.2.1, because i only find old versions on DebugDraw.

Some problems on old classes:

sf::Shape polygon;  <- Shape cannot be created more, it is protected
polygon.AddPoint <- Add point to poligon dont work :*

the correct class name is: b2Draw not b2DebugDraw

Can anyone share it?

Graphics / SFML2 and Qt
« on: August 11, 2012, 10:57:13 pm »

Im trying use Qt with SFML2, but the "Update" method is not called and i only see a blank area on my window.

See the screenshot attached.

Get the code here:


There is a way to use the canvas class in thread?


[attachment deleted by admin]

Pages: [1] 2 3