
Simple and Fast Multimedia Library
SFML의 Node.js 바인딩입니다. JavaScript나 TypeScript로 네이티브 창을 만들고, 2D 그래픽을 그리고, 오디오를 재생하세요.
npm install sfml.jsmacOS / Windows / Linux
SFML 3.1 기반 · SFML 소개RenderWindow · CircleShape · Color
RenderWindow를 만들고 CircleShape를 그린 다음 프레임을 표시합니다. SFML은 창과 렌더링을, JavaScript는 루프를 담당합니다. TypeScript 타입 선언도 포함되어 있습니다.
빠른 시작 따라 하기데스크톱 그래픽 환경에서 실행하세요. Esc로 창을 닫습니다. setImmediate는 프레임 사이에 Node.js I/O를 처리할 기회를 줍니다.
node hello.cjsconst sf = require('sfml.js');
const win = new sf.RenderWindow(
new sf.VideoMode(new sf.Vector2u(800, 600)),
'Hello, sfml.js',
);
const circle = new sf.CircleShape({ radius: 80 });
circle.setPosition(new sf.Vector2f(320, 220));
circle.setFillColor(new sf.Color(108, 190, 82));
win.setFramerateLimit(60);
function frame() {
win.handleEvents({
Closed: () => win.close(),
KeyPressed: e => {
if (e.code === sf.Keyboard.Key.Escape) win.close();
},
});
if (!win.isOpen()) return;
win.clear(new sf.Color(24, 28, 32));
win.draw(circle);
win.display();
setImmediate(frame);
}
frame();그래픽, 텍스트, 셰이더, 오디오 녹음과 네트워크 통신 예제를 실행해 보세요.
SFML C++ 문서와 바인딩의 타입 레퍼런스를 함께 참고하세요. Promise, 공유 타입 배열, 리소스 수명과 Node.js의 일괄 렌더링은 이 사이트의 가이드에서 설명합니다.