
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
node-sdl2-engine
Advanced tools
Bindings for SDL2 in Node
This was originally developed by Zetsin from his https://github.com/zetsin/node-sdl2 repo. I needed more funtionality and I needed to change some things. All of the original code is his work and all credit should go to him. Thanks and enjoy!!... if it's useful to you =).
This project is just now being started. It is not ready for use in a production environment. I hope to have it complete soon. Thanks!
Install with npm:
npm install node-sdl2-engine
const NS = require('node-sdl2-engine')
const App = NS.app
const Window = NS.window
let win = new Window
win.on('close', () => {
App.quit()
})
win.on('change', () => {
draw()
})
let draw = () => {
...
}
const NS = require('node-sdl2-engine')
const SDL2_video = NS.require('SDL2_video')
const SDL2_render = NS.require('SDl2_render')
...

Control your application's event lifecycle.
Methods
app.quit()app.hide()app.show()app.exit()Events
app.on('window-all-closed', () = {})app.on('before-quit', (event) = {})
event Object
preventDefalut()app.on('will-quit', (event) = {})
event Object
preventDefault()app.on('drop', (file) = {})
file StringCreate and control
window(s).
Methods
let win = new window(opts)
opts Object
tittle String - ''w Integer - 0x1FFF0000h Integer - 0x1FFF0000x Integer - 0x1FFF0000y Integer - 0x1FFF0000background Integer|Object|Array - rgb | { rgb, a } | { r, g, b, a } | [rgb, a] - 0xFF0000center Boolean - falseshow Boolean - trueclosable Boolean - trueresizable Boolean - trueminimized Boolean - falsemaximized Boolean - falseborderless Boolean - falsefullscreen Boolean - falsekiosk Boolean - falsehdpi Boolean - truemouseCapture Boolean - falsegrab Boolean - falsewin.close()win.destroy()win.restore()win.center()win.setModal(win)
win [Circular]win.render
[Getter] Objectwin.size
[Getter] Array-like Object - { w: 100, h: 200, "1": 100, "2": 200 }[Setter] Object|Array - { w: 100, h: 200 } | [ 100, 200 ]win.bounds
[Getter/Setter] [Array-like Object / Object|Array] - { x, y, w, h }win.minimumSize
[Getter/Setter] [Array-like Object / Object|Array] - { w, h }win.maximumSize
[Getter/Setter] [Array-like Object / Object|Array] - { w, h }win.bordersSize
[Getter] [Array-like Object / Object|Array] - { top, right, bottom, left }win.id
[Getter] Integerwin.focus
[Getter/Setter] Booleanwin.grab
[Getter/Setter] Booleanwin.show
[Getter/Setter] Booleanwin.maximize
[Getter/Setter] Booleanwin.minimize
[Getter/Setter] Booleanwin.fullScreen
[Getter/Setter] Booleanwin.resizable
[Getter] Booleanwin.closable
[Getter/Setter] Booleanwin.position
[Getter/Setter] Booleanwin.title
[Getter/Setter] Stringwin.background
[Getter/Setter] Integerwin.bordered
[Setter] Booleanwin.screenKeyboard
[Getter] Booleanwindow.all
[Getter] winwindow.focused
[Getter] winwindow.mouseFocused
[Getter] winwindow.keyboardFocused
[Getter] winwindow.grabbed
[Getter] winwindow.mouseFocused
[Getter] winwindow.screenSaver
[Getter] winwindow.fromID
[Getter] winwindow.showMessageBox(opts, cb)Events
win.on('change', (w, h) => {})
w Integerh Integerwin.on('close', (event) => {}
event Object
preventDefault()win.on('show', () => {})win.on('hide', () => {})win.on('move', (x, y) => {})
x Integery Integerwin.on('resize', (w, h) => {})
w Integerh Integerwin.on('minimize', () => {})win.on('maximize', () => {})win.on('restore', () => {})win.on('enter', () => {})win.on('leave', () => {})win.on('focus', () => {})win.on('blur', () => {})win.on('keydown', (key) => {})
key Object
scancode Integerscanname Stringkeycode Integerkeyname Stringrepeat Booleanwin.on('keyup', (key) => {})
key Object
scancode Integerscanname Stringkeycode Integerkeyname Stringrepeat Booleanwin.on('editing', ({str, start, length}) => {})
str Stringstart Integerlength Integerwin.on('textinput', (str) => {})
str Stringwin.on('mousemove', (pos) => {})
pos Object
x Integery Integerxrel Integeryrel Integerwin.on('mousedown', (mou) => {})
mou Object
x Integery Integerclicks Integerbutton Stringwin.on('mouseup', (mou) => {})
mou Object
x Integery Integerclicks Integerbutton Stringwin.on('mousewheel', (mou) => {})
mou Object
x Integery Integerclicks Integerbutton StringGet and set the clipboard text.
Methods
clipboard.text
[Getter/Setter] Stringclipboard.hasText
[Getter] BooleanEvents
Control the keyboard.
keyboard.startTextInput()keyboard.stopTextInput()keyboard.setTextInput(rect)
rect Object|Array - { x, y, w, h }keyboard.hasTextInput
[Getter] Booleankeyboard.hasScreenKeyboard
[Getter] Booleankeyboard.state
[Getter] Objectkeyboard.mod
[Getter] ObjectControl the mouse and cursor.
mouse.setCursor(id)mouse.setCursor(image, hot_x, hot_y)mouse.setCursor(data, mask, w, h, hot_x, hot_y)mouse.capture
[Setter] Booleanmouse.relative
[Getter/Setter] Booleanmouse.show
[Getter/Setter] Booleanmouse.state
[Getter] Object
win Object
x Integery Integerglobal Object
x Integery Integerrelative Object
x Integery IntegerMoniter the power infomation of hardware
power.info
[Getter] Object
life Integerpercentage Integerstate StringAllow you drawing text into window's face. please
npm install sdl2-ttfbefore use.
let ft = new font(file, pixelsize, index)
file Stringpixelsize Integerindex Integerft.style
[Geter/Setter] Stringft.outline
[Geter/Setter] Integerft.hinting
[Geter/Setter] Integerft.kerning
[Geter/Setter] Integerft.height
[Geter] Integerft.ascent
[Geter] Integerft.descent
[Geter] Integerft.lineSkip
[Geter] Integerft.solid(text, rgba)
text Stringrgba Integer|Object|Array - rgb | { rgb, a } | { r, g, b, a } | [rgb, a]ft.shade(text, rgba, rgbaBG)
text Stringrgba Integer|Object|Array - rgb | { rgb, a } | { r, g, b, a } | [rgb, a]rgbaBG Integer|Object|Array - rgb | { rgb, a } | { r, g, b, a } | [rgb, a]ft.blend(text, rgba)
text Stringrgba Integer|Object|Array - rgb | { rgb, a } | { r, g, b, a } | [rgb, a]ft.close()ft.test(char)
char Stringft.metrics(char)
char Stringft.getSize(char)
char Stringfont.init()font.wasInit()font.quit()Load image from file. please
npm install sdl2-imagebefore use.
Methods
let img = new image(file)
file Stringimg.free()img.texture(render)Image.init()Image.quit()FAQs
Bindings for SDL2 in Node - from https://github.com/zetsin/node-sdl2
The npm package node-sdl2-engine receives a total of 9 weekly downloads. As such, node-sdl2-engine popularity was classified as not popular.
We found that node-sdl2-engine demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.