file_path stringlengths 3 280 | file_language stringclasses 66
values | content stringlengths 1 1.04M | repo_name stringlengths 5 92 | repo_stars int64 0 154k | repo_description stringlengths 0 402 | repo_primary_language stringclasses 108
values | developer_username stringlengths 1 25 | developer_name stringlengths 0 30 | developer_company stringlengths 0 82 |
|---|---|---|---|---|---|---|---|---|---|
examples/graphics/shader/debug.js | JavaScript | // Debug shader test - use shaders that visibly alter output
// This helps verify the shader is actually being applied
joy.window.setMode(800, 600);
joy.window.setTitle("Debug Shader Test");
joy.graphics.setBackgroundColor(0.2, 0.2, 0.3);
var passthruShader;
var tintShader;
var currentShader = 0;
joy.load = function... | zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
examples/graphics/shader/gradient.js | JavaScript | // Gradient shader example
// Demonstrates using screen coordinates and love_ScreenSize
joy.window.setMode(800, 600);
joy.window.setTitle("Shader - Gradients");
joy.graphics.setBackgroundColor(0.1, 0.1, 0.1);
// Horizontal gradient overlay
var horizontalGradient = joy.graphics.newShader(`
vec4 effect(vec4 vcolor... | zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
examples/graphics/shader/image.js | JavaScript | // Image shader example
// Demonstrates applying shaders to textured images
joy.window.setMode(800, 600);
joy.window.setTitle("Shader - Image Effects");
joy.graphics.setBackgroundColor(0.15, 0.15, 0.2);
var image;
// Pixelate shader
var pixelateShader = joy.graphics.newShader(`
uniform float pixelSize;
vec... | zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
examples/graphics/shader/main.js | JavaScript | // Shader Effects Demo
// Cycles through various shader effects
// Press LEFT/RIGHT to change effects, UP/DOWN to adjust intensity
joy.window.setMode(800, 600);
joy.window.setTitle("Shader Effects Demo");
joy.graphics.setBackgroundColor(0.15, 0.15, 0.2);
var image;
var shaders = [];
var shaderNames = [];
var currentS... | zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
examples/graphics/shader/minimal.js | JavaScript | // Minimal shader test - compare rendering with/without shader
joy.window.setMode(800, 600);
joy.window.setTitle("Minimal Shader Test");
joy.graphics.setBackgroundColor(0.2, 0.2, 0.3);
var shader;
joy.load = function() {
shader = joy.graphics.newShader(`
vec4 effect(vec4 vcolor, Image tex, vec2 texcoord,... | zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
examples/graphics/shader/simple.js | JavaScript | // Simple shader example
// Demonstrates basic custom fragment shaders
joy.window.setMode(800, 600);
joy.window.setTitle("Shader - Simple Effects");
joy.graphics.setBackgroundColor(0.1, 0.1, 0.2);
// Grayscale shader - converts colors to grayscale
var grayscaleShader = joy.graphics.newShader(`
vec4 effect(vec4 v... | zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
examples/graphics/shader/test.js | JavaScript | // Simple shader test - draws a rectangle with and without shader
// to diagnose rendering issues
joy.window.setMode(800, 600);
joy.window.setTitle("Shader Test");
joy.graphics.setBackgroundColor(0.2, 0.2, 0.3);
var shader;
var useShader = false;
joy.load = function() {
// Create the simplest possible shader - j... | zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
examples/graphics/shader/wave.js | JavaScript | // Wave shader example
// Demonstrates time-based animated shaders with uniforms
joy.window.setMode(800, 600);
joy.window.setTitle("Shader - Wave Effect");
joy.graphics.setBackgroundColor(0.05, 0.05, 0.15);
// Wave distortion shader - modulates brightness based on wave pattern
var waveShader = joy.graphics.newShader... | zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
examples/graphics/shapes.js | JavaScript | // Basic shapes example
// Demonstrates drawing shapes with different colors
joy.window.setMode(800, 600);
joy.window.setTitle("Graphics - Shapes");
joy.graphics.setBackgroundColor(0.1, 0.1, 0.2);
joy.load = function() {
console.log("Drawing shapes demo");
console.log("Press Escape to exit");
};
joy.keypres... | zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
examples/gui/advanced/main.js | JavaScript | // GUI Menubar Example - demonstrates menubar, combo, color picker, trees, and more
// State variables
let showWindow = true;
let selectedTheme = 0;
let themes = ["Light", "Dark", "System"];
let selectedFont = 1;
let fonts = ["Small", "Medium", "Large"];
let fontSize = 14;
let opacity = 100;
let enableNotifications... | zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
examples/gui/basic/main.js | JavaScript | // GUI Example - demonstrates Nuklear immediate-mode GUI
// State variables
let showDemoWindow = true;
let showInfoPanel = true;
let showCompact = true;
let sliderValue = 0.5;
let checkboxValue = false;
let counter = 0;
joy.load = function() {
console.log("GUI Example loaded");
joy.window.setTitle("Nuklear GU... | zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
examples/gui/progress/main.js | JavaScript | // GUI Progress Bar Example - demonstrates progress bars and related widgets
// State variables
let downloadProgress = 0;
let isDownloading = false;
let downloadSpeed = 30; // units per second
let uploadProgress = 0;
let isUploading = false;
let taskProgress = [0, 0, 0, 0];
let taskNames = ["Compiling...", "Linking.... | zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
examples/gui/skin/main.js | JavaScript | // GUI Example - demonstrates Nuklear immediate-mode GUI
// State variables
let showDemoWindow = true;
let showInfoPanel = true;
let showCompact = true;
let sliderValue = 0.5;
let checkboxValue = false;
let counter = 0;
joy.load = function() {
console.log("GUI Example loaded");
joy.window.setTitle("Nuklear GU... | zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
examples/gui/text/main.js | JavaScript | // GUI Text Input Example - demonstrates text editing widgets
// State variables
let simpleText = "Hello World";
let multilineText = "This is a multiline\ntext editor.\nTry editing me!";
let nameField = "";
let emailField = "";
let passwordField = "";
let searchQuery = "";
joy.load = function() {
console.log("GUI... | zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
examples/image/main.js | JavaScript | // ImageData example - demonstrating CPU-side image manipulation
// Uses joy.image module to create and manipulate pixel data
const WIDTH = 400;
const HEIGHT = 300;
let imageData = null;
let displayPoints = null;
let mode = 0;
const MODES = ["Gradient", "Checkerboard", "Plasma", "Inverted"];
joy.window.setMode(WIDTH... | zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
examples/keyboard/basic.js | JavaScript | // Basic keyboard example
// Use arrow keys to see the difference between isDown and keypressed
joy.window.setMode(800, 600);
joy.window.setTitle("Keyboard - Arrow Keys Demo");
joy.load = function() {
console.log("Arrow key demo:");
console.log(" LEFT/RIGHT: isDown (fires every frame while held)");
conso... | zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
examples/keyboard/callbacks.js | JavaScript | // Keyboard callbacks example
// Demonstrates keypressed, keyreleased, and textinput callbacks
joy.window.setMode(800, 600);
joy.window.setTitle("Keyboard Callbacks - Type something");
joy.load = function() {
console.log("Type to see textinput callback (actual characters)");
console.log("Press keys to see key... | zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
examples/mandelbrot/main.js | JavaScript | // Mandelbrot set compute benchmark with visualization
// Tests raw floating-point performance of the JS engine
var WIDTH = 800;
var HEIGHT = 600;
var MAX_ITER = 64;
var RUNS = 5;
// Store computed iterations for rendering
var iterations = null;
var benchmarkDone = false;
var benchmarkResults = null;
var rendered = f... | zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
examples/mandelbrot/main.lua | Lua | -- Mandelbrot set compute benchmark with visualization
-- Tests raw floating-point performance of the Lua/LuaJIT engine (using Love2D)
local WIDTH = 800
local HEIGHT = 600
local MAX_ITER = 64
local RUNS = 5
-- Store computed iterations for rendering
local iterations = nil
local benchmarkDone = false
local benchmarkRe... | zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
examples/math/bezier.js | JavaScript | // Bezier curve example
// Demonstrates BezierCurve creation, manipulation, and rendering
joy.window.setMode(800, 600);
joy.window.setTitle("Math - Bezier Curves");
joy.graphics.setBackgroundColor(0.1, 0.1, 0.15);
var controlPoints = [
{x: 100, y: 500},
{x: 200, y: 100},
{x: 400, y: 100},
{x: 500, y:... | zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
examples/math/noise.js | JavaScript | // Noise visualization example
// Demonstrates 2D Perlin/Simplex noise as an animated terrain
joy.window.setMode(800, 600);
joy.window.setTitle("Math - Noise Visualization");
joy.graphics.setBackgroundColor(0.05, 0.05, 0.1);
var time = 0;
var scale = 0.02;
var cellSize = 4;
var cols, rows;
joy.load = function() {
... | zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
examples/math/random.js | JavaScript | // Random number generation example
// Demonstrates RandomGenerator, normal distribution, and seeding
joy.window.setMode(800, 600);
joy.window.setTitle("Math - Random Numbers");
joy.graphics.setBackgroundColor(0.1, 0.1, 0.15);
var particles = [];
var histogram = [];
var histogramNormal = [];
var binCount = 50;
// C... | zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
examples/modules/main.js | JavaScript | // Test ES modules support
import { greet, PI, Counter } from './utils.js';
var counter = new Counter(0);
var message = greet("Joy");
joy.load = function() {
console.log("Module test loaded!");
console.log(message);
console.log("PI =", PI);
};
joy.update = function(dt) {
// Update counter every frame... | zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
examples/modules/utils.js | JavaScript | // A simple utility module
export function greet(name) {
return "Hello, " + name + "!";
}
export const PI = 3.14159;
export class Counter {
constructor(initial = 0) {
this.value = initial;
}
increment() {
this.value++;
}
decrement() {
this.value--;
}
}
| zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
examples/mouse/main.js | JavaScript | // Mouse example
// Demonstrates mouse callbacks, position, buttons, visibility, and cursors
joy.window.setMode(800, 600);
joy.window.setTitle("Mouse Demo");
joy.graphics.setBackgroundColor(0.1, 0.1, 0.2);
var clicks = [];
var currentCursor = "arrow";
var cursorTypes = ["arrow", "ibeam", "wait", "crosshair", "hand",... | zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
examples/system/main.js | JavaScript | // System module example
// Displays system information and demonstrates clipboard, URL, and power functions
joy.window.setMode(800, 600);
joy.window.setTitle("System Info Demo");
joy.graphics.setBackgroundColor(0.1, 0.1, 0.15);
var clipboardText = "";
var lastClipboardCheck = 0;
var urlOpened = false;
joy.load = f... | zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
examples/websocket/client/main.js | JavaScript | // WebSocket client example for Joy2D
let ws = null;
let messages = [];
let inputText = "";
let connected = false;
let statusText = "Disconnected";
joy.load = function() {
joy.graphics.setBackgroundColor(0.1, 0.1, 0.15);
joy.window.setMode(800, 600);
joy.window.setTitle("Client");
connect();
};
funct... | zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
examples/websocket/server/main.go | Go | package main
import (
"fmt"
"log"
"net/http"
"github.com/gorilla/websocket"
)
var upgrader = websocket.Upgrader{
CheckOrigin: func(r *http.Request) bool {
return true // Allow all origins for this example
},
}
func handleWebSocket(w http.ResponseWriter, r *http.Request) {
conn, err := upgrader.Upgrade(w, r... | zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
examples/window/basic.js | JavaScript | // Basic window example
// Creates a simple 800x600 window
joy.window.setMode(800, 600);
joy.window.setTitle("Basic Window Example");
joy.load = function() {
console.log("Window created!");
var mode = joy.window.getMode();
console.log("Size:", mode[0], "x", mode[1]);
};
joy.update = function(dt) {
};
jo... | zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
examples/window/borderless.js | JavaScript | // Borderless window example
// Creates a borderless window
joy.window.setMode(800, 600, {
borderless: true
});
joy.window.setTitle("Borderless Window");
// Center the window on screen
joy.load = function() {
var desktop = joy.window.getDesktopDimensions();
var mode = joy.window.getMode();
var x = (de... | zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
examples/window/fullscreen.js | JavaScript | // Fullscreen example
// Press F to toggle fullscreen, Escape to exit
joy.window.setMode(800, 600);
joy.window.setTitle("Press F to toggle fullscreen, Escape to exit");
joy.load = function() {
console.log("Press F to toggle fullscreen mode");
console.log("Press Escape to exit");
var dims = joy.window.getD... | zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
examples/window/monitors.js | JavaScript | // Multi-monitor info example
// Displays information about all connected monitors
joy.window.setMode(800, 600);
joy.window.setTitle("Monitor Information");
joy.load = function() {
var count = joy.window.getDisplayCount();
console.log("Number of monitors:", count);
for (var i = 0; i < count; i++) {
... | zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
examples/window/resizable.js | JavaScript | // Resizable window example
// Creates a resizable window with minimum size constraints
joy.window.setMode(800, 600, {
resizable: true,
minwidth: 400,
minheight: 300
});
joy.window.setTitle("Resizable Window - Try resizing me!");
var lastWidth = 0;
var lastHeight = 0;
joy.load = function() {
var mode... | zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
examples/window/state.js | JavaScript | // Window state example
// Demonstrates minimize, maximize, and restore
joy.window.setMode(800, 600, {
resizable: true
});
joy.window.setTitle("Window State - M:maximize, R:restore, Escape:exit");
joy.load = function() {
console.log("Press M to maximize");
console.log("Press R to restore");
console.lo... | zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
examples/worker/main.js | JavaScript | // Web Worker example - Rotating square with position updates from worker thread
let worker = null;
let squareX = 400;
let squareY = 300;
let targetX = 400;
let targetY = 300;
let rotation = 0;
const squareSize = 80;
const lerpSpeed = 3;
joy.load = function() {
// Create a worker that will send position updates
... | zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
examples/worker/worker.js | JavaScript | // Worker script - sends random position updates every second
let screenWidth = 800;
let screenHeight = 600;
let margin = 80;
// Handle messages from main thread
self.onmessage = function(event) {
if (event.data.type === "start") {
screenWidth = event.data.width;
screenHeight = event.data.height;
... | zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
resources/ProggyClean.ttf.h | C/C++ Header | unsigned char ProggyClean_ttf[] = {
0x00, 0x01, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x80, 0x00, 0x03, 0x00, 0x40,
0x4f, 0x53, 0x2f, 0x32, 0x88, 0xeb, 0x74, 0x90, 0x00, 0x00, 0x01, 0x48,
0x00, 0x00, 0x00, 0x4e, 0x63, 0x6d, 0x61, 0x70, 0x02, 0x12, 0x23, 0x75,
0x00, 0x00, 0x03, 0xa0, 0x00, 0x00, 0x01, 0x52, 0x63, 0x76, ... | zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
src/bundle.cc | C++ | #include "bundle.hh"
#include "miniz.h"
#include "physfs.h"
#include <cstdio>
#include <cstring>
#include <cstdlib>
namespace joy {
// Read entire file from PhysFS into memory
static char *readPhysFile(const char *path, size_t *out_size) {
PHYSFS_File *file = PHYSFS_openRead(path);
if (!file) {
retur... | zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
src/bundle.hh | C++ Header | #pragma once
namespace joy {
// Create a .joy bundle from a directory
// Returns 0 on success, non-zero on error
int createBundle(const char *output_path, const char *source_dir);
} // namespace joy
| zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
src/engine.cc | C++ | #include "engine.hh"
#include "render.hh"
#include "modules/window/window.hh"
#include "modules/info/info.hh"
#include "modules/keyboard/keyboard.hh"
#include "modules/mouse/mouse.hh"
#include "modules/graphics/graphics.hh"
#include "modules/audio/audio.hh"
#include "modules/filesystem/filesystem.hh"
#include "modules/... | zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
src/engine.hh | C++ Header | #pragma once
#include "SDL3/SDL.h"
#include <memory>
// Forward declarations for js:: abstraction
namespace js {
class Runtime;
class Context;
class Value;
class PersistentValue;
}
namespace joy {
// Forward declarations
namespace render {
class Render;
}
namespace modules {
class Info;
... | zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
src/impl/miniaudio_impl.c | C | // Disable unused audio backends to reduce binary size
#define MA_NO_ENCODING
#define MA_NO_GENERATION
#ifdef __APPLE__
#define MA_NO_WASAPI
#define MA_NO_DSOUND
#define MA_NO_WINMM
#define MA_NO_ALSA
#define MA_NO_PULSEAUDIO
#define MA_NO_JACK
#define MA_NO_SNDIO
#define MA_NO_AUDIO4
... | zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
src/impl/nuklear_impl.c | C | // Nuklear implementation - separate file to avoid STB conflicts with fontstash
#define NK_IMPLEMENTATION
#include "nuklear_config.h"
| zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
src/impl/sokol_impl.c | C | // Sokol implementation - compiled as C (non-Apple platforms)
#include "SDL3/SDL.h"
#define SOKOL_IMPL
#ifdef __EMSCRIPTEN__
#define SOKOL_GLES3
#else
#define SOKOL_GLCORE
#endif
#include "sokol_gfx.h"
#include "sokol_log.h"
// Note: FontStash implementation is in text_renderer.cc
// Text rendering uses our own Text... | zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
src/impl/sokol_impl.m | Objective-C | // Sokol implementation - compiled as Objective-C++ on macOS
#include "SDL3/SDL.h"
#include "SDL3/SDL_metal.h"
#define SOKOL_IMPL
#define SOKOL_METAL
#include "sokol_gfx.h"
#include "sokol_log.h"
// Note: FontStash implementation is in text_renderer.cc
// Text rendering uses our own TextRenderer with BatchRenderer
| zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
src/impl/stb_image_impl.c | C | #define STB_IMAGE_IMPLEMENTATION
#include "stb_image.h"
| zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
src/impl/stb_image_write_impl.c | C | #define STB_IMAGE_WRITE_IMPLEMENTATION
#include "stb_image_write.h"
| zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
src/impl/stb_vorbis_impl.c | C | // stb_vorbis implementation
#include "stb_vorbis.c"
| zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
src/js/js.hh | C++ Header | #pragma once
// Main header for the JavaScript engine abstraction layer.
// Include this to get access to all js:: types.
#include "js_types.hh"
#include "js_value.hh"
#include "js_context.hh"
#include "js_runtime.hh"
#include "js_function.hh"
#include "js_module_builder.hh"
#include "js_class.hh"
#include "js_persis... | zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
src/js/js_class.hh | C++ Header | #pragma once
#include "js_types.hh"
#include "js_value.hh"
#include <cstdint>
#include <memory>
namespace js {
// Opaque class ID type
using ClassID = uint32_t;
// Finalizer callback - called when object is garbage collected
using Finalizer = void (*)(void *opaque);
// Class definition for registering custom JS cl... | zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
src/js/js_constructor.hh | C++ Header | #pragma once
#include "js_types.hh"
#include "js_value.hh"
#include "js_class.hh"
#include <memory>
namespace js {
// Forward declaration
class ConstructorArgs;
// Constructor callback signature
using ConstructorCallback = void(*)(ConstructorArgs &args);
// Accessor callback signatures (use FunctionArgs for consis... | zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
src/js/js_context.hh | C++ Header | #pragma once
#include "js_types.hh"
#include <cstddef>
#include <memory>
namespace js {
class Context {
public:
explicit Context(Runtime &runtime);
~Context();
// Non-copyable
Context(const Context &) = delete;
Context &operator=(const Context &) = delete;
// Movable
Context(Context &&o... | zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
src/js/js_function.hh | C++ Header | #pragma once
#include "js_types.hh"
#include "js_value.hh"
namespace js {
class FunctionArgs {
public:
// Argument access
int length() const;
Value arg(int index) const;
// Get 'this' value
Value thisValue() const;
// Get context
Context &context();
// Set return value
void ret... | zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
src/js/js_module_builder.hh | C++ Header | #pragma once
#include "js_types.hh"
#include "js_value.hh"
#include <memory>
namespace js {
class ModuleBuilder {
public:
ModuleBuilder(Context &ctx, const char *name);
~ModuleBuilder();
// Non-copyable
ModuleBuilder(const ModuleBuilder &) = delete;
ModuleBuilder &operator=(const ModuleBuilder &... | zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
src/js/js_persistent.hh | C++ Header | #pragma once
#include "js_types.hh"
#include "js_value.hh"
#include <memory>
namespace js {
// Persistent handle that prevents a value from being garbage collected.
// Use for storing callbacks, self-references, etc.
class PersistentValue {
public:
PersistentValue();
PersistentValue(Context &ctx, const Value... | zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
src/js/js_runtime.hh | C++ Header | #pragma once
#include "js_types.hh"
#include <memory>
namespace js {
class Runtime {
public:
Runtime();
~Runtime();
// Non-copyable, non-movable
Runtime(const Runtime &) = delete;
Runtime &operator=(const Runtime &) = delete;
Runtime(Runtime &&) = delete;
Runtime &operator=(Runtime &&) =... | zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
src/js/js_types.hh | C++ Header | #pragma once
#include <functional>
#include <memory>
#include <string>
namespace js {
class Value;
class Context;
class Runtime;
class FunctionArgs;
class ModuleBuilder;
using NativeFunction = void (*)(FunctionArgs &);
// Callback for loading ES module source code
// Parameters:
// referrer_path: path of the imp... | zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
src/js/js_value.hh | C++ Header | #pragma once
#include "js_types.hh"
#include <cstdint>
#include <memory>
#include <string>
#include <vector>
namespace js {
class Value {
public:
// Default constructor - creates undefined value
Value();
// Copy semantics
Value(const Value &other);
Value &operator=(const Value &other);
// M... | zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
src/js/quickjs/js_impl.cc | C++ | #include "js/js.hh"
#include "quickjs.h"
#include <cstring>
#include <unordered_map>
#include <vector>
namespace js {
// ============================================================================
// Per-runtime state (stored via JS_SetRuntimeOpaque)
// ===============================================================... | zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
src/js/v8/js_impl.cc | C++ | #include "js/js.hh"
#include "libplatform/libplatform.h"
#include "v8.h"
#include <cstring>
#include <unordered_map>
#include <vector>
#include <memory>
#include <mutex>
namespace js {
// ============================================================================
// V8 Platform (singleton, initialized once - this i... | zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
src/main.cc | C++ | #include "engine.hh"
#include "bundle.hh"
#include "modules/gui/gui.hh"
#include "web-api/websocket.hh"
#include "web-api/worker.hh"
#include "SDL3/SDL.h"
#include "physfs.h"
#include "cwalk.h"
#include <cargs.h>
#include <cstdio>
#include <cstring>
#include <sys/stat.h>
#ifdef __EMSCRIPTEN__
#include <emscripten.h>
... | zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
src/modules/audio/audio.cc | C++ | #include "audio.hh"
#include "modules/sound/sound.hh"
#include "miniaudio.h"
#define STB_VORBIS_HEADER_ONLY
#include "stb_vorbis.c"
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <cfloat>
#include <algorithm>
namespace joy {
namespace modules {
// AudioSource implementation
Audio... | zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
src/modules/audio/audio.hh | C++ Header | #pragma once
#include "miniaudio.h"
#include <vector>
#include <string>
namespace js {
class Context;
class Value;
}
namespace joy {
class Engine;
namespace modules {
// Forward declaration
class SoundData;
class Audio;
// Source types (matching Love2D)
enum class SourceType {
Static, // Fully decoded in m... | zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
src/modules/audio/audio_js.cc | C++ | #include "js/js.hh"
#include "audio.hh"
#include "modules/sound/sound.hh"
#include "engine.hh"
#include "physfs.h"
#include <cstdlib>
#include <cstring>
// Forward declaration from sound_js.cc
namespace joy {
namespace modules {
js::ClassID getSoundDataClassID();
}
}
namespace joy {
namespace modules {
// Helper to... | zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
src/modules/data/data.cc | C++ | #include "data.hh"
#include "miniz.h"
#include <cstring>
#include <cstdlib>
#include <stdexcept>
#include <algorithm>
#include <sstream>
#include <iomanip>
namespace joy {
namespace modules {
// ============================================================================
// Hash implementations (MD5, SHA1, SHA2)
// ... | zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
src/modules/data/data.hh | C++ Header | #pragma once
#include <string>
#include <vector>
#include <cstdint>
#include <cstddef>
#include <memory>
namespace js {
class Context;
class Value;
} // namespace js
namespace joy {
namespace modules {
// Compression format enum
enum class CompressedDataFormat {
LZ4,
ZLIB,
GZIP,
DEFLATE
};
// Hash ... | zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
src/modules/data/data_js.cc | C++ | #include "js/js.hh"
#include "data.hh"
#include "engine.hh"
#include <vector>
#include <cstring>
namespace joy {
namespace modules {
// Class IDs for JS objects
static js::ClassID bytedata_class_id = 0;
static js::ClassID compresseddata_class_id = 0;
static js::ClassID dataview_class_id = 0;
// ====================... | zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
src/modules/filesystem/filesystem.cc | C++ | #include "filesystem.hh"
#include "physfs.h"
#include <cstdlib>
#include <cstring>
#ifdef _WIN32
#include <direct.h>
#define getcwd _getcwd
#else
#include <unistd.h>
#endif
namespace joy {
namespace modules {
//------------------------------------------------------------------------------
// File class implementati... | zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
src/modules/filesystem/filesystem.hh | C++ Header | #pragma once
#include <string>
#include <vector>
#include <cstdint>
// Forward declare PhysFS types
typedef struct PHYSFS_File PHYSFS_File;
namespace js {
class Context;
class Value;
}
namespace joy {
class Engine;
namespace modules {
// File mode for opening files
enum class FileMode {
Closed,
Read,
... | zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
src/modules/filesystem/filesystem_js.cc | C++ | #include "js/js.hh"
#include "filesystem.hh"
#include "engine.hh"
#include "physfs.h"
#include <cstdlib>
#include <cstring>
namespace joy {
namespace modules {
// Helper to get Filesystem module from JS context
static Filesystem *getFilesystem(js::FunctionArgs &args) {
Engine *engine = args.getContextOpaque<Engi... | zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
src/modules/graphics/batch_renderer.cc | C++ | #include "batch_renderer.hh"
#include "shader.hh"
#include <cmath>
#include <cstring>
#include <cstdio>
// Backend selection (matches gui_shaders.h pattern)
#if !defined(SOKOL_GLCORE) && !defined(SOKOL_GLES3) && !defined(SOKOL_METAL)
#if defined(RENDER_METAL)
#define SOKOL_METAL
#elif defined(__EMSCRIP... | zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
src/modules/graphics/batch_renderer.hh | C++ Header | #pragma once
#include "sokol_gfx.h"
#include "renderstate.hh"
#include "pipeline_cache.hh"
#include <vector>
#include <cstdint>
namespace joy {
namespace modules {
class Shader;
// Vertex format: 20 bytes per vertex
// Position is CPU-transformed and stored in NDC
struct BatchVertex {
float x, y; // P... | zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
src/modules/graphics/canvas.cc | C++ | #include "canvas.hh"
#include <cstdio>
#include <cstring>
namespace joy {
namespace modules {
Canvas::Canvas()
: color_image_({SG_INVALID_ID})
, color_view_({SG_INVALID_ID})
, texture_view_({SG_INVALID_ID})
, attachments_({})
, depth_image_({SG_INVALID_ID})
, depth_view_({SG_INVALID_ID})
,... | zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
src/modules/graphics/canvas.hh | C++ Header | #pragma once
#include "sokol_gfx.h"
namespace joy {
namespace modules {
// Canvas - render-to-texture target (Love2D compatible)
// A Canvas is both a render target and a drawable texture
class Canvas {
public:
Canvas();
~Canvas();
// Create a canvas with specified dimensions
// format: "normal" (RG... | zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
src/modules/graphics/graphics.cc | C++ | #include "graphics.hh"
#include "batch_renderer.hh"
#include "text_renderer.hh"
#include "canvas.hh"
#include "shader.hh"
#include "engine.hh"
#include "sokol_gfx.h"
#include "stb_image.h"
#include "physfs.h"
#include <cstring>
#include <cmath>
#include <cstdlib>
// Embedded default font
#include "ProggyClean.ttf.h"
... | zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
src/modules/graphics/graphics.hh | C++ Header | #pragma once
#include "SDL3/SDL.h"
#include "sokol_gfx.h"
#include "fontstash.h"
#include <string>
#include <vector>
namespace js {
class Context;
class Value;
}
namespace joy {
class Engine;
namespace modules {
// Forward declarations
class BatchRenderer;
class Graphics;
class Canvas;
class TextRenderer;
class ... | zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
src/modules/graphics/graphics_js.cc | C++ | #include "js/js.hh"
#include "graphics.hh"
#include "canvas.hh"
#include "shader.hh"
#include "engine.hh"
#include "physfs.h"
#include <cstring>
#include <cstdlib>
#include <unordered_map>
#include <vector>
namespace joy {
namespace modules {
// Helper to get Graphics module from JS context
static Graphics *getGraph... | zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
src/modules/graphics/pipeline_cache.cc | C++ | #include "pipeline_cache.hh"
#include <cstdio>
#include <cstring>
namespace joy {
namespace modules {
// ============================================================================
// PipelineKey Implementation
// ============================================================================
PipelineKey PipelineKey::... | zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
src/modules/graphics/pipeline_cache.hh | C++ Header | #pragma once
#include "sokol_gfx.h"
#include "renderstate.hh"
#include <cstdint>
#include <unordered_map>
#include <vector>
namespace joy {
namespace modules {
// ============================================================================
// Primitive Type (shared with BatchRenderer)
// ============================... | zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
src/modules/graphics/renderstate.cc | C++ | #include "renderstate.hh"
namespace joy {
namespace modules {
// ============================================================================
// BlendState Implementation
// ============================================================================
uint32_t BlendState::toKey() const {
return (static_cast<uint3... | zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
src/modules/graphics/renderstate.hh | C++ Header | #pragma once
#include <cstdint>
namespace joy {
namespace modules {
// ============================================================================
// Blend Factor and Operation Enums
// ============================================================================
enum class BlendFactor : uint8_t {
Zero = 0,
... | zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
src/modules/graphics/shader.cc | C++ | #include "shader.hh"
#include "shader_compiler.hh"
#include "graphics.hh"
#include "batch_renderer.hh"
#include "canvas.hh"
#include <cstdio>
#include <cstring>
#include <regex>
// Backend selection
#if !defined(SOKOL_GLCORE) && !defined(SOKOL_GLES3) && !defined(SOKOL_METAL)
#if defined(RENDER_METAL)
#defi... | zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
src/modules/graphics/shader.hh | C++ Header | #pragma once
#include "sokol_gfx.h"
#include "renderstate.hh"
#include "pipeline_cache.hh"
#include <string>
#include <map>
#include <unordered_map>
#include <vector>
#include <cstdint>
namespace joy {
namespace modules {
class Graphics;
class Texture;
class Canvas;
class BatchRenderer;
// Uniform types supported b... | zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
src/modules/graphics/shader_compiler.cc | C++ | #include "shader_compiler.hh"
#include <cstdio>
// Backend selection
#if !defined(SOKOL_GLCORE) && !defined(SOKOL_GLES3) && !defined(SOKOL_METAL)
#if defined(RENDER_METAL)
#define SOKOL_METAL
#elif defined(__EMSCRIPTEN__)
#define SOKOL_GLES3
#else
#define SOKOL_GLCORE
#endif
#en... | zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
src/modules/graphics/shader_compiler.hh | C++ Header | #pragma once
#include <string>
#include <vector>
#include <map>
#include <cstdint>
namespace joy {
namespace modules {
// Uniform types for shader reflection
enum class ShaderUniformType : uint8_t {
Float,
Vec2,
Vec3,
Vec4,
Mat2,
Mat3,
Mat4,
Int,
IVec2,
IVec3,
IVec4,
S... | zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
src/modules/graphics/text_renderer.cc | C++ | #include "text_renderer.hh"
#include "batch_renderer.hh"
#include <cstdio>
#include <cstring>
// Windows headers needed for fontstash.h (MAX_PATH, CP_UTF8)
#ifdef _WIN32
#include <windows.h>
#endif
// FontStash implementation
#define FONTSTASH_IMPLEMENTATION
#include "fontstash.h"
// Backend selection (matches batch... | zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
src/modules/graphics/text_renderer.hh | C++ Header | #pragma once
#include "sokol_gfx.h"
#include "fontstash.h"
#include <cstdint>
namespace joy {
namespace modules {
class BatchRenderer;
// TextRenderer - manages FontStash rendering through BatchRenderer
// Replaces sokol_fontstash by implementing custom FontStash callbacks
class TextRenderer {
public:
TextRende... | zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
src/modules/gui/gui.cc | C++ | #include "gui.hh"
#include "gui_shaders.h"
#include "sokol_gfx.h"
#include "stb_image.h"
#include "physfs.h"
#include <cstring>
#include <cstdlib>
#include <cstdio>
namespace joy {
namespace modules {
Gui::Gui(Engine *engine)
: engine_(engine)
, window_(nullptr)
, nk_ctx_(nullptr)
, atlas_(nullptr)
... | zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
src/modules/gui/gui.hh | C++ Header | #pragma once
#include "nuklear_config.h"
#include "sokol_gfx.h"
#include "SDL3/SDL.h"
namespace js {
class Context;
class Value;
}
namespace joy {
class Engine;
namespace modules {
class Gui {
public:
Gui(Engine *engine);
~Gui();
// Initialize GUI context and font atlas (call before render backend)
... | zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
src/modules/gui/gui_js.cc | C++ | #include "js/js.hh"
#include "gui.hh"
#include "engine.hh"
#include <cstring>
#include <vector>
namespace joy {
namespace modules {
// Helper to get Gui module from JS context
static Gui *getGui(js::FunctionArgs &args) {
Engine *engine = args.getContextOpaque<Engine>();
return engine ? engine->getGuiModule()... | zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
src/modules/gui/gui_shaders.h | C/C++ Header | #pragma once
// Nuklear GUI shaders for different platforms
// Extracted from sokol_nuklear.h reference implementation
#include <cstdint>
// Backend selection via CMake defines (RENDER_METAL or RENDER_OPENGL)
#if !defined(SOKOL_GLCORE) && !defined(SOKOL_GLES3) && !defined(SOKOL_METAL)
#if defined(RENDER_METAL)
... | zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
src/modules/image/image.cc | C++ | #include "image.hh"
#include "engine.hh"
#include "physfs.h"
#include "stb_image.h"
#include "stb_image_write.h"
#include <cstring>
#include <cstdlib>
#include <algorithm>
#ifdef _WIN32
#define strcasecmp _stricmp
#endif
namespace joy {
namespace modules {
// ImageData implementation
ImageData::ImageData()
: d... | zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
src/modules/image/image.hh | C++ Header | #pragma once
#include <cstdint>
#include <cstddef>
#include <string>
namespace js {
class Context;
class Value;
}
namespace joy {
class Engine;
namespace modules {
// Pixel format enum
enum class PixelFormat {
RGBA8, // 8 bits per channel (32 bpp) RGBA - default
RGBA16, // 16 bits per channel (64... | zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
src/modules/image/image_js.cc | C++ | #include "js/js.hh"
#include "image.hh"
#include "engine.hh"
#include "physfs.h"
#include <cstring>
#include <cstdlib>
namespace joy {
namespace modules {
// ImageData class for JS
static js::ClassID imagedata_class_id = 0;
static void imagedata_finalizer(void *opaque) {
ImageData *data = static_cast<ImageData ... | zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
src/modules/info/info.cc | C++ | #include "info.hh"
namespace joy {
namespace modules {
Info::Info() {
}
Info::~Info() {
}
const char *Info::getVersion() {
return "dev-alpha";
}
const char *Info::getJSEngineName() {
return "QuickJS";
}
} // namespace modules
} // namespace joy
| zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
src/modules/info/info.hh | C++ Header | #pragma once
namespace js {
class Context;
class Value;
} // namespace js
namespace joy {
namespace modules {
class Info {
public:
Info();
~Info();
static const char *getVersion();
static const char *getJSEngineName();
// Initialize JS bindings
static void initJS(js::Context &ctx, js::Value... | zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
src/modules/info/info_js.cc | C++ | #include "info.hh"
#include "js/js.hh"
namespace joy {
namespace modules {
static void js_info_getVersion(js::FunctionArgs &args) {
args.returnValue(js::Value::string(args.context(), Info::getVersion()));
}
static void js_info_getJSEngineName(js::FunctionArgs &args) {
args.returnValue(js::Value::string(args.... | zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
src/modules/joystick/joystick.cc | C++ | #include "joystick.hh"
#include "engine.hh"
#include <cstring>
#include <algorithm>
#include <cstdio>
#include <limits>
namespace joy {
namespace modules {
// Hat name mappings
static const char *hat_names[] = {
"c", // Centered
"u", // Up
"r", // Right
"d", // Down
"l", // Left
"ru... | zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
src/modules/joystick/joystick.hh | C++ Header | #pragma once
#include "SDL3/SDL.h"
#include <string>
#include <vector>
#include <unordered_map>
namespace js {
class Context;
class Value;
}
namespace joy {
class Engine;
namespace modules {
// Joystick hat values (matching Love2D)
enum class JoystickHat {
Centered,
Up,
Right,
Down,
Left,
... | zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
src/modules/joystick/joystick_js.cc | C++ | #include "js/js.hh"
#include "joystick.hh"
#include "engine.hh"
namespace joy {
namespace modules {
// Class ID for Joystick objects
static js::ClassID joystick_class_id = 0;
// Helper to get JoystickModule from JS context
static JoystickModule *getJoystickModule(js::FunctionArgs &args) {
Engine *engine = args.g... | zyedidia/joy | 1 | A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API | C++ | zyedidia | Zachary Yedidia | Stanford University |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.