More actions
Libcross2D | |
---|---|
General | |
Author | Cpasjuste |
Type | Developments |
Version | 1.1 |
License | Mixed |
Last Updated | 2018/12/05 |
Links | |
Download | |
Website | |
Source | |
Support Author | |
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 all began with the Sony PS Vita and Nintendo 3DS. The original idea is to ease the development/deployment process on those devices, using 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, a lot of custom stuff has to be written (graphics, inputs, audio, io...) to handle each devices for doing the same thing, however it takes 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.
A simple cross platform library (libcross2d) was then created with the primary goal of running on desktop to bypass all previously mentioned restrictions. The library abstracts the target graphics, inputs, etc. allowing for testing of the application on the real device once a week. The library was designed to be simple to use, as demonstrated in the texture example.
For the purpose of handling 2D and UI's, a solid foundation was required. Therefore, the 2D rendering code (textures, shapes, transformations...) is based on SFML which is well-suited for this task, and libcross2d uses hardware acceleration to render on all supported devices including desktop, Switch, 3DS, Vita, and others. In addition, libcross2d also handle/abstract inputs, TTF fonts, config files, clocks/timers, basic tweening (position, rotate, scale, color...), and a few widgets. While comprehensive documentation is not yet available, some simple examples and instructions have been provided to help users get started.
libcross2d was first released for the GBAtemp Homebrew Bounty: 2018 Switch Edition.
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.
User guide
Some cross2d examples:
- texture - drawing a simple texture.
- font - drawing some text.
- input - handle inputs (gamepads, keyboard on linux).
- fps - all about timing (fps, time, delta).
- config - handle a configuration file.
- configbox - draw a configuration to screen.
- filer - a file manager example.
- crazy - some tweeny stuff.
- physics - basic box2d support.
Build and run:
- See libcross2d-template repository
- Please note that the example repository does not contain platform specific data (to run on switch, vita, ps4...). You'll have to copy them from the "libcross2d" data directories if you want to run the examples on these devices.
Media
libcross2d (cpasjuste)
Changelog
v1.1
- Renderer: Add onInput and onDraw override possibility.
- Io::getDirList: Allow skipping hidden files.
- Io::File: Add size to constructor.
- Io::Posix: Don't use stat on switch.
- Input: Refactor key names.
- Input: Add basic touch support.
- Shape: Fix getGlobalBounds.
- Shape: Set all function virtual.
- Shape: Set/getOrigin: rename to set/getOriginVector.
- Shape: SetAlpha: add recursion flag.
- Shape: Add vertexArray getter.
- Sprite: Add sprite class.
- Tween: Add setFromTo function.
- Widgets::ListBox: don't use font outline by default.
- Utility: Use std::string for removeExt function.
- switch: Add sys/clock class (overclock).