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

Pages: [1]
1
SFML projects / [Development] [Video Playback] SFVLC
« on: November 10, 2016, 01:28:21 am »
Since i need to play videos with SFML and i found this comment of Ceylo (the creator of sfeMovie)

Quote
Indeed there is the feature/OpenFromStream branch. However it is not finished. It is roughly what a user from SFML forum proposed, but I don't wish to work on sfeMovie anymore so it'll have to be finished by someone else. Basically what lacks at the moment is cleanly design integration and manual tests.

And beacuse i don't want use death projects i decide to write my own video player an take advantage of libVLC, that its core is LPGL-licensed and most of its plug-ins too.
The libVLC plug-in systems works like add-ons, you carry the dlls you want without have to recompile,
so we can have both commercial and non-commercial projects.

I need to polish the final details, that includes a loadFromStream feature, then i will release the source code on github, share the MSVC 2013 libraries, and hope someone help me to create a CMAKE build system.

The players deliver a high-performance, so you won't never be worried about it.

This is an simple example showing few features:



#include <iostream>
#include <cstdio>

#include <SFML/Graphics.hpp>
#include "sf_vlc_video.hpp"

int main()
{  
   
        sf::VideoMode fullScreenMode = sf::VideoMode::getDesktopMode() ;
        sf::VideoMode windowedMode = sf::VideoMode( 800 , 600 ) ;

        sf::RenderWindow window( windowedMode , "Video" ) ;
                         window.setFramerateLimit( 60 ) ;
   
    freopen( "null" , "w+" , stderr ) ; // Disable error/warning messaging. There are no way to fix|disable them.
       
        SFVLC::Video video( { windowedMode.width , windowedMode.height } ) ;

    video.loadFromURL( "http://video.webmfiles.org/big-buck-bunny_trailer.webm" ) ;
    // Or: video.loadFromFile( "myvideo.ogv" ) ;

        video.play() ;

        bool isFullscreen = false ;

        sf::Clock deltaClock ;

    while ( window.isOpen() )
    {  
        sf::Event event;
        while ( window.pollEvent( event ) )
        {
                        switch( event.type )
                        {
                                case sf::Event::Closed :
                                     video.stop() ;
                                         window.close() ;
                                         break ;

                                case sf::Event::KeyPressed :
                                {  
                                        switch( event.key.code )
                                        {
                                            case sf::Keyboard::Escape : // Exit.
                                                     video.stop() ;
                                                     window.close() ;
                                                         break ;
                                                case sf::Keyboard::Space : // Pause | Resume video with the space bar.
                                                {
                                                        if( video.getStatus() == SFVLC::Video::Status::playing )
                                                                video.pause() ;
                                                        else
                                                                video.play() ;
                                                        break ;
                                                }
                                                case sf::Keyboard::F : // Resize video to fullscreen or windowed mode.
                                                {  
                                                   if( !( isFullscreen = !isFullscreen ) )
                                                   {  
                                                       window.create( windowedMode , "Video" ) ;
                                                           window.setFramerateLimit( 60 ) ;
                                                           video.setSize( { windowedMode.width , windowedMode.height } ) ;
                                                   }
                                                   else
                                                   {  
                                                       window.create( fullScreenMode , "Video" sf::Style::Fullscreen ) ;
                                                           window.setFramerateLimit( 60 ) ;
                                                           video.setSize( { fullScreenMode.width , fullScreenMode.height } ) ;
                                                   }
                                                   break ;
                                                }
                                                case sf::Keyboard::BackSpace : // Restart the video.
                                                         video.restart() ;
                                                         break ;          
                                   }
                                }
            }
        }

                const float delta = deltaClock.restart().asSeconds() ;
               
                // Inherits from sf::Transformable.
                if( sf::Keyboard::isKeyPressed( sf::Keyboard::Right ) ) { video.move( delta * 10 , 0 ) ; }
                else if( sf::Keyboard::isKeyPressed( sf::Keyboard::Left ) ) { video.move( - delta * 10 , 0 ) ; }

                if( sf::Keyboard::isKeyPressed( sf::Keyboard::Up ) ) { video.move( 0 , - delta * 10 ) ; }
                else if( sf::Keyboard::isKeyPressed( sf::Keyboard::Down ) ) { video.move( 0 , delta * 10 ) ; }

        window.clear();
                window.draw( video ) ; // It's a sf::Drawable too.
        window.display();
    }

    return 0;
}

 


Hope in this (or the next) week i can release the code on GitHub with a good documentation and test-suite.

Features actually implemented:
-play for local file
-play for url
-get video information (only for local file)
-pause/play/stop/restart
-resize (native way)
-change video playing time.
-set audio channel.
-decrease/increase volume
-set aspect ratio.
-control update rate.

2
SFML projects / Zalaz Engine: Particle Lab
« on: October 27, 2016, 02:44:27 am »
Hello SFML users, long time ago i started a game engine with SFML as it core.
Its only can be scripted with Lua.

The engine have been developed to work with the Lua C-API and the Luajit's FFI (the user can switch APIs at runtime -if wanted- without change any code or logic). So games can achieve native speed with Luajit's ffi.

I need to finish the docs, and finish the others editors.

Later i will make a post of the engine with all its features (it have a LOT of them).

But in this one i want to show the ParticleLab, a tool made using only the engine (entirely in Lua) that will help you in the development of the Particle System you want for your game. (Yes, is done with the engine, for the engine).

I have made so far only one demo video of the ParticleLab:
http://youtu.be/paCmjLWCCXA

The power of the Particle System of the engine is great, you can emulate the great Thor example of Fireworks.
http://youtu.be/IkOu6HypfSY

Or even a moving galaxy for a space shooter game:
http://youtu.be/tiIrnuyWAZs

You only code in Lua, and the editor is for make your the life easier in the process of modify-update the script.

3
General / [Advice/Warning] RenderWindow Android Crash
« on: April 14, 2016, 02:29:07 am »
I want to advice that creating o initializing a RenderWindow before the entry point (main) is called will cause and app crash on Android.

Tested with SFML 2.3.2.
Devices: Sony Xperia E3 & Samsumg Galaxy Note 4.

Example:


sf::RenderWindow window ;

void main() // Entry Point.
{
   // Game logic .. bla bla.
}

 

This will compile but will crash.

If for whatever reason you need the RenderWindow outside the main function, the workaround is make the RenderWindow a pointer.

sf::RenderWindow *window ;

void main() // Entry
{
  sf::RenderWindow win( sf::VideoMode::getDesktopMode() , "" ) ;
  window = &win ;
   // Game logic .. bla bla.
}
 

Hope it help for finding bugs.

If the bug was/is repaired please notify on this topic.

PD: Should i start a "new issue" on GitHub?

4
General / Android undefined reference VS 2013 and Nvidia Nsight
« on: November 04, 2015, 12:17:22 am »
I was trying to make and Android app that uses SFML.

I successfully create all the .so and .a


E:\Android\SFML-master>cmake -DANDROID_ABI=armeabi-v7a -DCMAKE_TOOLCHAIN_FILE=cm
ake/toolchains/android.toolchain.cmake -DANDROID_NDK=E:\Android\android-ndk-r10e

-- Building for: Visual Studio 12 2013
CMake Warning at CMakeLists.txt:97 (message):
  CMake might not properly support setting the STL.  Make sure to adjust all
  generated library projects!


-- Found JPEG: E:/Android/SFML-master/extlibs/libs-android/armeabi-v7a/libjpeg.a

-- Found OpenAL: E:/Android/SFML-master/extlibs/libs-android/armeabi-v7a/libopen
al.so
-- Found VORBIS: E:/Android/SFML-master/extlibs/libs-android/armeabi-v7a/libvorb
is.a
-- Found FLAC: E:/Android/SFML-master/extlibs/libs-android/armeabi-v7a/libFLAC.a

-- Configuring done
-- Generating done
-- Build files have been written to: E:/Android/SFML-master

E:\Android\SFML-master>

 

As you can see, all fine.

I import the sfml's default android example using ( import and ndk-build Android Project ) using the last version of Nvidia Nsight.

I had to change the original android.mk  ( and the application.mk too ) of the example (because don't work at least for me)

my android.mk:
LOCAL_PATH := $(call my-dir)

## sfml-activity ##

        include $(CLEAR_VARS)
                LOCAL_MODULE := sfml-activity-main
                LOCAL_SRC_FILES := libsfml-activity-d.so
        include $(PREBUILT_SHARED_LIBRARY)

## sfml-activity end ##

## sfml-system.so ##

        include $(CLEAR_VARS)
                LOCAL_MODULE := sfml-system
                LOCAL_SRC_FILES := libsfml-system-d.so
        include $(PREBUILT_SHARED_LIBRARY)

## sfml-system.so end ##

## sfml-window.so ##

        include $(CLEAR_VARS)
                LOCAL_MODULE := sfml-window
                LOCAL_SRC_FILES := libsfml-window-d.so
        include $(PREBUILT_SHARED_LIBRARY)
       
## sfml-window.so end ##

## sfml-graphics.so ##

        include $(CLEAR_VARS)
                LOCAL_MODULE := sfml-graphics
                LOCAL_SRC_FILES := libsfml-graphics-d.so
        include $(PREBUILT_SHARED_LIBRARY)
       
## sfml-graphics.so end ##

## sfml-audio.so ##

        include $(CLEAR_VARS)
                LOCAL_MODULE := sfml-audio
                LOCAL_SRC_FILES := libsfml-audio-d.so
        include $(PREBUILT_SHARED_LIBRARY)
       
## sfml-audio.so end ##

## sfml-network.so ##

        include $(CLEAR_VARS)
                LOCAL_MODULE := sfml-network
                LOCAL_SRC_FILES := libsfml-network-d.so
        include $(PREBUILT_SHARED_LIBRARY)
       
## sfml-network.so end ##


## sfml-main ##

        include $(CLEAR_VARS)
                LOCAL_MODULE := sfml-main
                LOCAL_SRC_FILES := libsfml-main-d.a
        include $(PREBUILT_STATIC_LIBRARY)

## sfml-main end ##

## sfml-example ##

    include $(CLEAR_VARS)
                LOCAL_MODULE    := sfml-example
                LOCAL_SRC_FILES := main.cpp
                LOCAL_SRC_FILES += String.cpp

                LOCAL_SHARED_LIBRARIES := sfml-system
                LOCAL_SHARED_LIBRARIES += sfml-window
                LOCAL_SHARED_LIBRARIES += sfml-graphics
                LOCAL_SHARED_LIBRARIES += sfml-audio
                LOCAL_SHARED_LIBRARIES += sfml-network
                LOCAL_STATIC_LIBRARIES := sfml-main
        include $(BUILD_SHARED_LIBRARY)

## sfml-example end ##

## sfml-activity ##

   include $(CLEAR_VARS)

        LOCAL_MODULE    := sfml-start

        LOCAL_SHARED_LIBRARIES := sfml-activity-main

        include $(BUILD_SHARED_LIBRARY)

## sfml-activity end ##
 

I get this undefined:
1>------ Build started: Project: test, Configuration: Debug Tegra-Android ------
1>  [armeabi-v7a] Gdbserver      : [arm-linux-androideabi-4.8] ../../../prueba/test/test/Tegra-Android/Debug//libs/armeabi-v7a/gdbserver
1>  [armeabi-v7a] Gdbsetup       : ../../../prueba/test/test/Tegra-Android/Debug//libs/armeabi-v7a/gdb.setup
1>  [armeabi-v7a] Install        : libsfml-start.so => ../../../prueba/test/test/Tegra-Android/Debug//libs/armeabi-v7a/libsfml-start.so
1>  [armeabi-v7a] Compile++ thumb: sfml-example <= main.cpp
1>  [armeabi-v7a] Compile++ thumb: sfml-example <= String.cpp
1>  [armeabi-v7a] Install        : libsfml-activity-d.so => ../../../prueba/test/test/Tegra-Android/Debug//libs/armeabi-v7a/libsfml-activity-d.so
1>  [armeabi-v7a] Install        : libsfml-system-d.so => ../../../prueba/test/test/Tegra-Android/Debug//libs/armeabi-v7a/libsfml-system-d.so
1>  [armeabi-v7a] Install        : libsfml-window-d.so => ../../../prueba/test/test/Tegra-Android/Debug//libs/armeabi-v7a/libsfml-window-d.so
1>  [armeabi-v7a] Install        : libsfml-graphics-d.so => ../../../prueba/test/test/Tegra-Android/Debug//libs/armeabi-v7a/libsfml-graphics-d.so
1>  [armeabi-v7a] Install        : libsfml-audio-d.so => ../../../prueba/test/test/Tegra-Android/Debug//libs/armeabi-v7a/libsfml-audio-d.so
1>  [armeabi-v7a] Install        : libsfml-network-d.so => ../../../prueba/test/test/Tegra-Android/Debug//libs/armeabi-v7a/libsfml-network-d.so
1>  [armeabi-v7a] Install        : libc++_shared.so => ../../../prueba/test/test/Tegra-Android/Debug//libs/armeabi-v7a/libc++_shared.so
1>  [armeabi-v7a] SharedLibrary  : libsfml-example.so
1>E:\Android\prueba\test\test\jni\main.cpp(13): error :  error: undefined reference to 'sf::Texture::loadFromFile(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, sf::Rect<int> const&)'
1>E:\Android\prueba\test\test\jni\main.cpp(21): error :  error: undefined reference to 'sf::Music::openFromFile(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)'
1>  collect2.exe: error: ld returned 1 exit status
1>  make.exe: *** [../../../prueba/test/test/Tegra-Android/Debug//local/armeabi-v7a/libsfml-example.so] Error 1
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

 

I add to the jni path String.hpp for resolve the undefined Sf::String() symbol, if i add Music.hpp and Texture.hpp start asking for more and more include...

 As you can see i'm using debug libraries, but i tested in release ( i take care of don't mix them, i have both release/debug) even i tried with the stripped_libsfml-xxx.so that automatically generates NSight among the libsfml_xxx.so.

I try using esfml ( https://github.com/Sonkun/esfml ) i built fine but get the same linking symbols error.

 I had to change LOCAL_WHOLE_STATIC_LIBRARIES for LOCAL_STATIC_LIBRARIES , using the first one (like in the original example) give me more a lot of undefined.

I used ARMEABI-V7A for compiling all .so and .a and try to make the .apk (because i don't find the option inside NSight to try with ARMEABI ) seems that only support V7 , V8, x86 , x86_64.

The STL type is the default one (GNU libstdc++ Static)

I use the sfml's cmake toolchain, even i tried all using ""another"" toolchain (seems to make the same result , https://github.com/taka-no-me/android-cmake/blob/master/android.toolchain.cmake , i don't know is both are the same)

The minAndroidApi lvl i use is 14 ( in making all .so and .a and the .apk)
The target  and max are NotSpecified

Can someone help me?
I need to give more details?

5
SFML projects / Particle System!
« on: June 13, 2015, 08:50:26 pm »
This is a particle system written in pure c++/sfml by me.
It'll be used on my lua game engine. (Will have 2 particle system, the two have "physics" but the first won't interact will Box2D/LiquidFun objects, and the second will).

Particles can have a lot of behaviors by setting severals params.
About the perfomace can move 4000 particles with a framerate at 2,250+ fps ; 

If someone are interested on the source code can contact me, you can use my particle system in yours games too.

I'll append some images link. Jope you like it.

http://www.subirimagenes.com/imagedata.php?url=http://s2.subirimagenes.com/imagen/9391062effect01.png

http://www.subirimagenes.com/imagedata.php?url=http://s2.subirimagenes.com/imagen/9391064effect02.png

http://www.subirimagenes.com/imagedata.php?url=http://s2.subirimagenes.com/imagen/9391072effect3.png

http://www.subirimagenes.com/imagedata.php?url=http://s2.subirimagenes.com/imagen/9391065effect4.png

http://www.subirimagenes.com/imagedata.php?url=http://s2.subirimagenes.com/imagen/9391067effect5.png

http://www.subirimagenes.com/imagedata.php?url=http://s2.subirimagenes.com/imagen/9391068effect6.png

http://www.subirimagenes.com/imagedata.php?url=http://s2.subirimagenes.com/imagen/9391073effect7.png

6
I'm making a lua-sfml engine and i decide to test the performace making the same code on pure C++.

All compiler optimizations are on on both projects ( -O3 -fexpensive-optimizations ). (using codeblocks)

Not frame limit in both projects.

Lua-jit gets version  11 fps stable ( with  1000 crates on display , physics engine active ( there are 3 physics object active in the scene, some events dispatcher actives )

In C++ pure version got 8 fps stable ( with ONLY 1000 crates on the display..no physics engine active..no Lua states actives )

I use 2 counters for the test.. a custom counter on the game..and FRAPS.. both counter say the same fps rate. ( 11 for  lua / 8 for  c++ )

C++ code for the test only this no more:
#include <iostream>

using namespace std ;
#include <SFML/Graphics.hpp>
using namespace sf ;

int main()
{
    // create the window
    sf::RenderWindow window(sf::VideoMode(600, 600), "My window") ;
    int fps_rate = 0 ;
    Clock *fps = new Clock ;
    sf::Texture t ;
    // load the texture
    t.loadFromFile( "crate.png" ) ;
    t.setSmooth( true ) ;

    Sprite *obj = new Sprite[ 1000 ] ;
    for( int s = 0 ; s < 1000 ; ++s )
           obj[s].setTexture( t ) ;

    // run the program as long as the window is open
    while (window.isOpen())
    {
       
       // fps counter
        ++fps_rate ;
        if ( fps->getElapsedTime().asSeconds() >= 1 )
        {   fps->restart() ;
            cout << fps_rate << endl ;
            fps_rate = 0 ;
        }

        // check all the window's events that were triggered since the last iteration of the loop
        sf::Event event;
        while (window.pollEvent(event))
        {
            // "close requested" event: we close the window
            if (event.type == sf::Event::Closed)
                window.close();
        }

        // clear the window with black color
        window.clear(sf::Color::Black);

        // draw everything here...

        for( int i = 0 ; i < 1000 ; ++i )
        {
            window.draw( obj[ i ] ) ;
        }

        // end the current frame
        window.display();
    }

    return 0;
}
 


Screenshots:

lua version



The small crate and the long crates are physics objects. (the small crates is falling)
The bigs crates ( there are one thousand , you cant see it because are one behind other )
The console show the fps..and the yellow numbers are shown by FRAPS.

The same in the C++ version :



As you can see.. no physics..no lua States..

Please..if you can optimizate more this c++ code please post it for test it.

I would like yours reviews. :)

PD: link for the full images:

c++ : http://www.subirimagenes.com/imagedata.php?url=http://s2.subirimagenes.com/imagen/9376734c.png

lua : http://www.subirimagenes.com/imagedata.php?url=http://s2.subirimagenes.com/imagen/9376732luaversion.png

Lua game engine topic: http://en.sfml-dev.org/forums/index.php?topic=18074.0

Pages: [1]
anything