1. cpasjuste

    OP cpasjuste GBAtemp Maniac
    Member

    Joined:
    Aug 27, 2015
    Messages:
    1,078
    Country:
    France

    libcross2d.png

    libcross2d is a c++ cross platform 2d graphic, input and audio library (and more) which run on Windows, Linux, Nintendo Switch, Nintendo 3DS and Sony PS Vita. It's getting released for the
    GBAtemp Homebrew Bounty: 2018 Switch Edition

    I'v been working since a while on a little C++ 2D cross platform development library for a few devices. All started with the Sony PS Vita and Nintendo 3DS. I wanted to ease the development/deployment process on those devices, and did write psp2shell for the vita, and libctrshell for the 3ds to do so. They allow printing over a WiFi shell for simple debugging, easily load/reload applications and so on. While they do the job, when i started the pFBA project (which didn't had a name yet), it was not enough. I still had to write a lot of custom stuff (graphics, inputs, audio, io...) to handle each devices for doing the same thing but also loose a lot of time to setup, test code and deploy on all of them. Making a simple but functional user interface was also a pain, loosing, again, some precious time for the real stuff (probably because i'm bad at UI too :)).

    So i started to write a simple cross platform library (libcross2d) for my own use, with a primarily goal: run on desktop to bypass all the previously mentioned restrictions, abstracting the targets graphics, inputs, etc..., allowing testing the application on the real device once a week... Then, it needed to be simple to use, and i think it achieve that as you can see in the texture example!

    Since all is about 2D and UI's, i needed a good base to handle this job. It's why the 2D rendering code (textures, shapes, transformations..) is based on SFML which is perfect to handle this task, and libcross2d use hardware acceleration to render this on all the supported devices (desktop, switch, 3ds, vita...). But libcross2d also handle/abstract inputs, ttf fonts, config files, clocks/timers, basic tweening (position, rotate, scale, color..), and a very few widgets. There is no extensive documentation yet, but i did take some time to write some simple examples and how to, which should really be enough to start.

    With the gbatemp homebrew competition announced, i though it could now be a good timing to make this work public, and so i worked hard since it's announcement to make a first public release of this library. I Hope people will be able to make great applications/games with it, adding the comfort of "working" on any computer around and focusing on the real stuff, and maybe submitting some cool stuff to the homebrew bounty using libcross2d !

    libcross2d main features
    • a c++ cross platform 2d graphic, input, audio and config library
    • run on Windows, Linux, Nintendo Switch, Nintendo 3DS and Sony PS Vita
    • draw textures, rectangles, circles, texts (TrueType) and more
    • basic tween engine (move, rotate, scale, color)
    • clock/timer classes
    • configuration file handling
    • pack your application (zip) for release on any target, including resources (data/common)
    • quickly prototype your application on desktop (Linux and Windows)
    • use hardware acceleration on Linux, Windows, Switch, 3DS and PS Vita
    • use some of the great sfml library stuff (fonts, shapes, matrices)
    • use tweeny for the (minimal) tween engine
    • use some of the great libretro shaders (Linux, Switch)
    • use some citro2d code for the 3ds renderer
    • use some vita2d code for the vita renderer
    • use libconfig for the configuration classes
    • preliminary developed for my own use, still a work in progress

    If you need any help and want to discuss, the main discussion thread is here! If you find bugs or want new features, use github issues please. A first release (version 1.0) is located in the gbatemp download center, and on github.

    !! READ THE README !!

    [​IMG]
     
    Last edited by cpasjuste, Oct 30, 2018
    LSolrac, SCOTT0852, Tomobobo and 21 others like this.
  2. jakkal

    jakkal GBAtemp Addict
    Member

    Joined:
    Apr 27, 2018
    Messages:
    2,279
    Country:
    United States
    Good job and congrats on the release
     
  3. lordelan

    lordelan GBAtemp Psycho!
    Member

    Joined:
    Jan 4, 2015
    Messages:
    4,505
    Country:
    Germany
    Although I don't care for the PSP and 3DS, this is massive. Good release man!
     
  4. NANASHI89

    NANASHI89 GBAtemp Addict
    Member

    Joined:
    May 3, 2012
    Messages:
    2,251
    Country:
    United States
    Where can I download?
     
  5. hippy dave

    hippy dave BBMB
    Member

    Joined:
    Apr 30, 2012
    Messages:
    5,756
    Country:
    United Kingdom
    Very nice. Any chance of MacOS support? :)
     
    matt! likes this.
  6. jakibaki

    jakibaki GBAtemp Regular
    Member

    Joined:
    Mar 3, 2017
    Messages:
    296
    Country:
    Germany
    Great work! Thank you very much! :)
     
  7. hippy dave

    hippy dave BBMB
    Member

    Joined:
    Apr 30, 2012
    Messages:
    5,756
    Country:
    United Kingdom
    Glad to give this a bump, as it deserves more attention.

    I've been fiddling with this to get it to work on Mac, mostly just messing with the CMake files, but I did have to change the required GL version in sdl2_gl_renderer.cpp from 4.3 to 3.3 to get the GL display stuff running on my old Mac. Do you know if there's anything in your library that actually requires GL newer than 3.3?
     
    matt! likes this.
  8. cpasjuste

    OP cpasjuste GBAtemp Maniac
    Member

    Joined:
    Aug 27, 2015
    Messages:
    1,078
    Country:
    France
    Hi, cool, some report! :)

    I think 3.3 should be fine, I'll try to take a closer look tomorrow (I did use 4.3 when I moved to new style opengl for the switch, which have a 4.3 main core profile). Lowering down as much as possible is wanted, I think 3.30 is the minimum for shaders.
    Also, if you know how to, feel free to do a "Mac" pull request on github :)
     
    Last edited by cpasjuste, Nov 13, 2018
    lordelan and hippy dave like this.
  9. XorTroll

    XorTroll Tired of classic HOME menu
    Developer

    Joined:
    Dec 28, 2017
    Messages:
    630
    Country:
    Spain
    Great project dude, just one doubt, does this use hardware / GPU acceleration on all supported systems?
    Does it at least on Switch?
     
  10. cpasjuste

    OP cpasjuste GBAtemp Maniac
    Member

    Joined:
    Aug 27, 2015
    Messages:
    1,078
    Country:
    France
    Yes, it use GPU HW acceleration on all supported platforms.
     
  11. hippy dave

    hippy dave BBMB
    Member

    Joined:
    Apr 30, 2012
    Messages:
    5,756
    Country:
    United Kingdom
    I've never done a pull request, sounds like it requires forking, I'll look into it when I have time :)
     
  12. eyeliner

    eyeliner Has an itch needing to be scratched.
    Member

    Joined:
    Feb 17, 2006
    Messages:
    1,091
    Country:
    Portugal
    Too bad I don't C. But I might try this.
     
  13. Mobius3

    Mobius3 Newbie
    Newcomer

    Joined:
    Nov 18, 2018
    Messages:
    2
    Country:
    Brazil
    Hey, congratulations, great project!

    I'm the author of Tweeny and I'm really happy to see it used in your project and also how you used it.

    I wish you success.
     
  14. cpasjuste

    OP cpasjuste GBAtemp Maniac
    Member

    Joined:
    Aug 27, 2015
    Messages:
    1,078
    Country:
    France
    Hi,

    It's awesome to see you here :) I still have some work to implement it better (add callbacks, tween curves and such) but it will be done in time ..
     
  15. Mobius3

    Mobius3 Newbie
    Newcomer

    Joined:
    Nov 18, 2018
    Messages:
    2
    Country:
    Brazil
    I'm looking forward to see it done!

    I just arrived at this community but its surely a nice place to be :)
     
    lordelan likes this.
  16. hippy dave

    hippy dave BBMB
    Member

    Joined:
    Apr 30, 2012
    Messages:
    5,756
    Country:
    United Kingdom
    I've been rebuilding my old puzzle game for cross2d, and just been testing the first playable build on my Switch. Playing my own game on my Switch feels awesome.
    My game uses proc genned levels, and I copied the code for random numbers from your "crazy" example - but I noticed when I ran it on switch, it came out with the same sequence of levels on every startup. I had to change
    Code:
    std::random_device rd;
    std::mt19937 mt(rd());
    to
    Code:
    std::mt19937 mt(time(0));
    It seems random_device isn't random on Switch, thought you might want to know.
     
  17. cpasjuste

    OP cpasjuste GBAtemp Maniac
    Member

    Joined:
    Aug 27, 2015
    Messages:
    1,078
    Country:
    France
    Hi,

    Yes this is good to know, i didn't notice that :) Else I'll be happy to see how you implemented cross2d!
     
    hippy dave likes this.
  18. hippy dave

    hippy dave BBMB
    Member

    Joined:
    Apr 30, 2012
    Messages:
    5,756
    Country:
    United Kingdom
    I'll show you once I've got things a bit more presentable :)
     
  19. minkcv

    minkcv Member
    Newcomer

    Joined:
    Dec 15, 2018
    Messages:
    17
    Country:
    United States
    I'm having issues building on linux for linux. I've opened an issue on github in the examples repo.
     
  20. hippy dave

    hippy dave BBMB
    Member

    Joined:
    Apr 30, 2012
    Messages:
    5,756
    Country:
    United Kingdom
    Yeah I had issues with SDL2 and cmake too on mac, I bodged it somehow.
     
Draft saved Draft deleted
Loading...

Hide similar threads Similar threads with keywords - libcross2d, platform, library