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

Pages: [1] 2
1
SFML development / Re: sf::Time & sf::Clock vs C++11 chrono
« on: March 12, 2017, 02:03:25 am »
Both are very great api. I prefer learn both of them. sf::Clock & sf::Time means more sfml-native and more object-oriented. And std::chrono means portable: it can be used not only in sfml, but also many other apis(Saying these words is embarrassed in sfml community ;D), so std::chrono is: learn only once and use anywhere. So,  I prefer learn both.

2
Audio / Audio Spacialization
« on: December 17, 2016, 09:34:44 pm »
Hello, thanks to SFML, it is simple and very easy to learn. The sound play and record works on my FreeBSD  computer. My computer is crude and has low hardware configure. sf::SoundBufferRecorder::getAvailableDevices has found two andio record devices on my system:
OSS Default
pcm2:record:dsp2

The problem is I can't make spacialization aka 3D Sound work. I have tried to set some different distances between the listener and the sound source, but the sound heard in my ears are the same without any differences. The following is my c++ code and shell test script line. (c++ code was compile to ./run with clang. cut.oga is short audio file. mksh)

#include <SFML/Audio.hpp>
#include <iostream>
#include <string>

int main(int argc, char * argv[]) {
        if (argc != 2) {std::cerr << argv[0] << " [Listener Z Position]." << std::endl; return 1;}
        float z = std::stof(argv[1]);

        sf::SoundBuffer buffer;
        if (!buffer.loadFromFile("cut.oga")) {std::cerr << "Load cut.oga error.\n"; return 1;}
        sf::Sound sound;
        sound.setBuffer(buffer);
        sound.play();
        sound.setLoop(false);

        sf::Listener::setPosition(0.0f, 0.0f, z);
        sf::Listener::setDirection(0.0f, 0.0f, -1.0f);
        sf::Listener::setUpVector(0.0f, 1.0f, 0.0f);
        sf::Listener::setGlobalVolume(50.0f);

        sound.setPosition(0.0f, 0.0f, 0.0f);
        sound.setRelativeToListener(false);
        sound.setMinDistance(2.0f);
        sound.setAttenuation(20.0f);

        while (sound.getStatus() == sf::Sound::Playing) {
                sf::sleep(sf::seconds(0.1f));
        }

        return 0;
}
 

z=4; while [ $z -gt -5 ]; do echo $z; ./run $((z--)); done
 

3D GUI world should be rendered in your brain to simplify the code.  ;)

3
General / Re: Android Development
« on: December 17, 2016, 09:17:48 pm »
I am not a cfml user, as I am more interested in c++. I think the csfml is a bind to sfml. So if sfml not works, csfml will not work too. Fortunately, android development is not so hurry, just a new taste. SFML is fine. It works on FreeBSD. Last a long time I put too much my personal time on OpenGL 3D stuff. It's time to do more with SFML now.

4
Graphics / how to apply antialiasingLevel to RenderTarget?
« on: November 17, 2016, 10:26:58 pm »
How to apply sf::ContextSettings antialiasingLevel to the sf::RenderTarget? This is good to make better quality window display, but the sf::RenderTarget results looks very aliasing.

5
General / Re: Android Development
« on: November 10, 2016, 10:56:30 pm »
Hello, thanks to Mario reply and thanks to the sfml dev. That link problem is solved by install an eabi v7a clang compiler (cctools). But some other link problems found.

libc++_shared.so is needed by libsfml-*
I found this lib from the exacted sfml NativeActivity-release-unsigned.apk.

libandroid.so should be linked to use sfml-system

undefined reference to __pthread_gettid when link sfml-window and sfml-graphics
I dont know what lib file to link. It seems that android doesnt have a full pthread.

6
General / Re: Android Development
« on: November 10, 2016, 10:48:39 am »
Is there any specific reason you'll need ARM-x64 for Android? Have you tried running "armeabi" binaries? These should work on pretty much all current phones.

When I link the v7a version of the so libs, both clang and gcc report invalid format in my phone. Most android phones are aarch64 and very cheap now.

7
General / Android Development
« on: November 05, 2016, 07:49:50 am »
Hello, I am a FreeBSD user. I want to make android development and find some tools to write program on android itself. So I can connect my phone from FreeBSD and then push the code. I need a SFML API for android use, such as c4droid, termux environment. But the file downloaded here is for arm v7a:
http://www.sfml-dev.org/artifacts/by-branch/master/

So could somebody build an android aarch64 version of SFML API and share with others? Thank you. Just the include headers and lib*.so or lib*.a are needed. Because I have no windows full android environment to build it.

8
SFML projects / Re: TGUI: GUI library for SFML
« on: September 30, 2016, 07:46:55 am »
Thanks to Ruckamongus and Texus,  Right, std::bind(getValue) is a functional type passed to the signal function, and itself need another parameter which is provided by system, such as the slider changes and then click the button.

9
SFML projects / Re: TGUI: GUI library for SFML
« on: September 29, 2016, 04:10:33 am »
Hello, Texus.
There is a question in my heart for some times.
button->connect("pressed", print, std::bind(getValue));
 
I think this is too loose. I wish it be more strict.

 See this will work too:
button->connect("pressed", print, std::bind(getValue)());
 

auto f = std::bind(getValue);
f is a function.
f() is a value.

We should pass a value as a parameter to print, right? Both will work. But the second one is more strict which is what I wish.

10
SFML projects / Re: TGUI: GUI library for SFML
« on: August 17, 2016, 09:50:58 pm »
From 0.6 to 0.7, the tgui api changes from callback to signal, so does it will be changed in the future release? Is it valued to pay more attention to the signal?

11
SFML projects / Re: TGUI: GUI library for SFML
« on: July 24, 2016, 10:56:35 am »
Yes, it works fine on FreeBSD. I love tgui.  8)

12
SFML projects / Re: TGUI: GUI library for SFML
« on: July 19, 2016, 05:32:35 pm »
Hello. How to write the menubar callback ?
tgui::MenuBar::Ptr bar = std::make_shared<tgui::MenuBar>();
// add some menus and menu items
...
bar->connect("menuItemClicked", [](const std::string & item, int id) {
           // some proccessing
}, "Edit", 1);
 

Why pressing any menu item will trigger the lambda callback, how to write the menu item callback?

13
SFML projects / Re: TGUI: GUI library for SFML
« on: July 03, 2016, 03:32:32 pm »
To Texus:

OK, thank you. That's it.

14
SFML projects / Re: TGUI: GUI library for SFML
« on: July 03, 2016, 03:11:42 pm »
Could you show a minimal code example (something that I can just copy-paste and run) that gives this error?

This happened on the example code from the tgui-0.7.1.zip and also to my own code.
Here its an example:

// main.cpp
#include <TGUI/TGUI.hpp>
#include <cstdlib>

void callback(std::string message) {
        std::cerr << message << std::endl;
        std::exit(EXIT_SUCCESS);
}

int main() {
        sf::RenderWindow window(sf::VideoMode(640, 400), "tgui & freebsd");
        tgui::Gui gui(window);
        gui.setFont("/usr/local/share/fonts/dejavu/DejaVuSansMono.ttf");

        auto button1 = std::make_shared<tgui::Button>();
        button1->setSize(100, 30);
        button1->setPosition(300, 150);
        button1->setText("Click Me");
        std::cerr << "d1" << std::endl;
        button1->connect("ExitButton", callback, "Exit Message");
        std::cerr << "d2" << std::endl;
        gui.add(button1);

        while (window.isOpen()) {
                sf::Event event;
                while (window.pollEvent(event)) {
                        if (event.type == sf::Event::Closed) {
                                window.close();
                        }
                        gui.handleEvent(event);
                }
                window.clear();
                gui.draw();
                window.display();
        }
        return 0;
}
 

// Makefile
Code: [Select]
PROG=app
SRCS=main.cpp
MAN=

LIBS=sfml-graphics gl
CXXFLAGS+=`pkgconf --cflags ${LIBS}` -std=c++1z
LDFLAGS+=`pkgconf --libs ${LIBS}` -lc++ -lm -lthr -ltgui

.include <bsd.prog.mk>

Build and Run:
Code: [Select]
$ make                                                                                                         
$ ./app
d1
Abort trap (core dumped)

15
SFML projects / Re: TGUI: GUI library for SFML
« on: July 03, 2016, 02:59:18 pm »
Hello, the tgui program running failed with "Abort trap (core dumped)" when it runs to connect() or the tgui::Theme::load calling on FreeBSD.
It is srange that the connect() call will pass without extra parameters (Only set the signal name and the callback function).

Pages: [1] 2