0.3.0 - Fonts, Audio & Networking
VitaJS v0.3.0
VitaJS is an experimental JavaScript runtime for building games and homebrew applications for PlayStation Vita using QuickJS, VitaSDK and vita2d.
This release significantly expands the runtime with font rendering, game audio and native networking support.
What's new
- Added TTF/OTF font loading and rendering through
Font - Added WAV sound effects through the new
Audiomodule - Added native HTTP networking through
Net - Added GET, POST and generic HTTP requests
- Added network connection and local IP helpers
- Improved QuickJS native object handling
- Fixed font-related crashes on physical PS Vita hardware
- Improved compatibility with current VitaSDK / GCC toolchains
- Added JavaScript IntelliSense definitions through
vitajs.d.ts - Expanded documentation and usage examples
Available modules
Screen— 2D rendering and texturesPads— controller inputFont— font loading and text renderingAudio— WAV sound effects and mixingNet— HTTP networkingSystem— filesystem and system utilitiesstd/os— QuickJS standard APIs
Example
const texture = Screen.load_png_file("app0:/assets/test1.png");
const font = Font.load_font_file("app0:/assets/segoeui.ttf");
const sound = Audio.load_wav("app0:/assets/audio.wav");
Audio.play(sound);
Screen.start_drawing();
Screen.clear(15, 18, 24, 255);
Screen.draw_texture(texture, 200, 200);
Font.font_draw_text(
font,
30,
50,
0xffffffff,
28,
"Hello from VitaJS!"
);
Screen.end_drawing();
Screen.swap_buffers();Networking
The current Net API is synchronous:
const response = Net.get("http://192.168.1.20:3000/data.json");
if (response.ok) {
const data = JSON.parse(response.body);
console.log(data);
}Asynchronous / Promise-based networking is planned for a future release.
Installation
Download vitajs-v0.3.0.vpk below and install it on your PS Vita.
VitaJS is still experimental. APIs may change between releases and testing on real PS Vita hardware is recommended.