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
src/modules/keyboard/keyboard.cc
C++
#include "keyboard.hh" #include "engine.hh" #include <unordered_map> #include <string> namespace joy { namespace modules { // Key name to SDL scancode mapping static const std::unordered_map<std::string, SDL_Scancode> name_to_scancode = { // Letters {"a", SDL_SCANCODE_A}, {"b", SDL_SCANCODE_B}, {"c", SDL_SCA...
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/keyboard/keyboard.hh
C++ Header
#pragma once #include "SDL3/SDL.h" namespace js { class Context; class Value; } namespace joy { class Engine; namespace modules { class Keyboard { public: Keyboard(Engine *engine); ~Keyboard(); // Check if keys are down bool isDown(const char **keys, int count); bool isScancodeDown(const int ...
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/keyboard/keyboard_js.cc
C++
#include "js/js.hh" #include "keyboard.hh" #include "engine.hh" namespace joy { namespace modules { // Helper to get Keyboard from JS context static Keyboard *getKeyboard(js::FunctionArgs &args) { Engine *engine = args.getContextOpaque<Engine>(); return engine ? engine->getKeyboardModule() : nullptr; } stati...
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/math/math.cc
C++
#include "math.hh" #include "noise1234.hh" #include "simplexnoise1234.hh" #include <cmath> #include <cstdlib> #include <ctime> #include <sstream> #include <iomanip> #include <limits> #include <list> #include <algorithm> #include <stdexcept> #ifndef M_PI #define M_PI 3.14159265358979323846 #endif namespace joy { name...
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/math/math.hh
C++ Header
#pragma once #include <vector> #include <string> #include <cstdint> namespace js { class Context; class Value; } // namespace js namespace joy { namespace modules { // Forward declarations class RandomGenerator; class BezierCurve; class Transform; // Vector2 structure for geometric operations struct Vector2 { ...
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/math/math_js.cc
C++
#include "js/js.hh" #include "math.hh" #include "engine.hh" #include <cstdlib> #include <vector> namespace joy { namespace modules { // Helper to get Math module from JS context static Math *getMath(js::FunctionArgs &args) { Engine *engine = args.getContextOpaque<Engine>(); return engine ? engine->getMathMod...
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/math/noise1234.cc
C++
// Noise1234 // Author: Stefan Gustavson (stegu@itn.liu.se) // // This library is public domain software, released by the author // into the public domain in February 2011. You may do anything // you like with it. You may even remove all attributions, // but of course I'd appreciate it if you kept my name somewhere. //...
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/math/noise1234.hh
C++ Header
// Noise1234 // Author: Stefan Gustavson (stegu@itn.liu.se) // // This library is public domain software, released by the author // into the public domain in February 2011. You may do anything // you like with it. You may even remove all attributions, // but of course I'd appreciate it if you kept my name somewhere. //...
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/math/simplexnoise1234.cc
C++
// SimplexNoise1234 // Copyright 2003-2011, Stefan Gustavson // // Contact: stegu@itn.liu.se // // This library is public domain software, released by the author // into the public domain in February 2011. You may do anything // you like with it. You may even remove all attributions, // but of course I'd appreciate it ...
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/math/simplexnoise1234.hh
C++ Header
// SimplexNoise1234 // Copyright 2003-2011, Stefan Gustavson // // Contact: stegu@itn.liu.se // // This library is public domain software, released by the author // into the public domain in February 2011. You may do anything // you like with it. You may even remove all attributions, // but of course I'd appreciate it ...
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/mouse/mouse.cc
C++
#include "mouse.hh" #include "engine.hh" #include <unordered_map> #include <string> #include <cstring> namespace joy { namespace modules { // System cursor name to enum mapping static const std::unordered_map<std::string, SystemCursor> name_to_system_cursor = { {"arrow", SystemCursor::Arrow}, {"ibeam", Syste...
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/mouse/mouse.hh
C++ Header
#pragma once #include "SDL3/SDL.h" namespace js { class Context; class Value; } namespace joy { class Engine; namespace modules { // System cursor types (matching Love2D CursorType enum) enum class SystemCursor { Arrow, Ibeam, Wait, Crosshair, WaitArrow, SizeNWSE, SizeNESW, SizeWE,...
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/mouse/mouse_js.cc
C++
#include "js/js.hh" #include "mouse.hh" #include "engine.hh" namespace joy { namespace modules { // Helper to get Mouse module from JS context static Mouse *getMouse(js::FunctionArgs &args) { Engine *engine = args.getContextOpaque<Engine>(); return engine ? engine->getMouseModule() : nullptr; } // Cursor cla...
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/sound/sound.cc
C++
#include "sound.hh" #define STB_VORBIS_HEADER_ONLY #include "stb_vorbis.c" #include <cstdio> #include <cstring> #include <cstdlib> #include <cmath> #include <algorithm> namespace joy { namespace modules { // SoundData implementation SoundData::SoundData(int sampleCount, int sampleRate, int bitDepth, int channels) ...
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/sound/sound.hh
C++ Header
#pragma once #include <cstddef> #include <cstdint> #include <vector> #include <string> namespace js { class Context; class Value; } namespace joy { class Engine; namespace modules { // SoundData - raw audio samples in memory // Stores decoded audio data that can be played back, manipulated sample-by-sample, // or...
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/sound/sound_js.cc
C++
#include "js/js.hh" #include "sound.hh" #include "engine.hh" #include "physfs.h" #include <cstdlib> namespace joy { namespace modules { // Class IDs for SoundData and Decoder static js::ClassID sounddata_class_id = 0; static js::ClassID decoder_class_id = 0; // Finalizers static void sounddata_finalizer(void *opaqu...
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/system/system.cc
C++
#include "system.hh" #include "engine.hh" #include <SDL3/SDL.h> namespace joy { namespace modules { System::System(Engine *engine) : engine_(engine) { } System::~System() { } const char *System::getOS() { #if defined(__APPLE__) #if TARGET_OS_IOS return "iOS"; #else return "OS X"; #e...
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/system/system.hh
C++ Header
#pragma once #include <string> #include <vector> namespace js { class Context; class Value; } namespace joy { class Engine; namespace modules { class System { public: enum PowerState { POWER_UNKNOWN, POWER_BATTERY, POWER_NO_BATTERY, POWER_CHARGING, POWER_CHARGED }; ...
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/system/system_js.cc
C++
#include "system.hh" #include "js/js.hh" #include "engine.hh" namespace joy { namespace modules { static System *getSystem(js::FunctionArgs &args) { Engine *engine = args.getContextOpaque<Engine>(); return engine ? engine->getSystemModule() : nullptr; } static void js_system_getOS(js::FunctionArgs &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/timer/timer.cc
C++
#include "timer.hh" #include "SDL3/SDL.h" namespace joy { namespace modules { // Static helper to get high-precision time static double getTimeAbsolute() { static Uint64 freq = SDL_GetPerformanceFrequency(); Uint64 counter = SDL_GetPerformanceCounter(); return (double)counter / (double)freq; } Timer::Tim...
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/timer/timer.hh
C++ Header
#pragma once namespace js { class Context; class Value; } // namespace js namespace joy { namespace modules { class Timer { public: Timer(); ~Timer(); // Measures time between frames, updates internal values double step(); // Sleeps for the specified number of seconds void sleep(double seco...
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/timer/timer_js.cc
C++
#include "timer.hh" #include "js/js.hh" #include "engine.hh" namespace joy { namespace modules { static Timer *getTimer(js::FunctionArgs &args) { Engine *engine = args.getContextOpaque<Engine>(); return engine ? engine->getTimerModule() : nullptr; } static void js_timer_step(js::FunctionArgs &args) { Tim...
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/window/window.cc
C++
#include "window.hh" #include "engine.hh" #include <cstdlib> #include <cstring> namespace joy { namespace modules { Window::Window(Engine *engine) : engine_(engine) { } Window::~Window() { } bool Window::setMode(int width, int height, bool fullscreen, bool resizable, bool borderless, int minwidth, int minheigh...
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/window/window.hh
C++ Header
#pragma once #include "SDL3/SDL.h" namespace js { class Context; class Value; } namespace joy { // Forward declaration class Engine; namespace modules { class Window { public: Window(Engine *engine); ~Window(); // Window mode bool setMode(int width, int height, bool fullscreen, bool resizable, bo...
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/window/window_js.cc
C++
#include "js/js.hh" #include "window.hh" #include "engine.hh" #include <cstdlib> #include <vector> namespace joy { namespace modules { // Helper to get Window from JS context static Window *getWindow(js::FunctionArgs &args) { Engine *engine = args.getContextOpaque<Engine>(); return engine ? engine->getWindow...
zyedidia/joy
1
A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API
C++
zyedidia
Zachary Yedidia
Stanford University
src/nuklear_config.h
C/C++ Header
#pragma once #define NK_INCLUDE_FIXED_TYPES #define NK_INCLUDE_STANDARD_IO #define NK_INCLUDE_DEFAULT_ALLOCATOR #define NK_INCLUDE_VERTEX_BUFFER_OUTPUT #define NK_INCLUDE_FONT_BAKING #define NK_INCLUDE_DEFAULT_FONT #include "nuklear.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/render.hh
C++ Header
#pragma once #include "SDL3/SDL.h" namespace joy { // Forward declarations namespace modules { class Graphics; class Gui; } namespace render { class Render { public: Render(); virtual ~Render(); // Initialize renderer with SDL window bool init(SDL_Window *window); // Begin/end frame r...
zyedidia/joy
1
A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API
C++
zyedidia
Zachary Yedidia
Stanford University
src/render_metal.mm
Objective-C++
#include "render.hh" #include "modules/graphics/graphics.hh" #include "modules/gui/gui.hh" #include "SDL3/SDL.h" #include "SDL3/SDL_metal.h" #import "Metal/Metal.h" #import "QuartzCore/CAMetalLayer.h" #include "sokol_gfx.h" #include "sokol_log.h" #include <cstdio> namespace joy { namespace render { Render::Render() ...
zyedidia/joy
1
A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API
C++
zyedidia
Zachary Yedidia
Stanford University
src/render_opengl.cc
C++
#include "render.hh" #include "modules/graphics/graphics.hh" #include "modules/gui/gui.hh" #include "SDL3/SDL.h" #include "sokol_gfx.h" #include "sokol_log.h" #include <cstdio> #include <cstring> namespace joy { namespace render { // Custom logger that filters out uniform-not-found warnings // These happen when shad...
zyedidia/joy
1
A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API
C++
zyedidia
Zachary Yedidia
Stanford University
src/web-api/curl-websocket-utils.c
C
/* clang-format off */ /* * Copyright (C) 2016 Gustavo Sverzut Barbieri * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights...
zyedidia/joy
1
A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API
C++
zyedidia
Zachary Yedidia
Stanford University
src/web-api/curl-websocket.c
C
/* clang-format off */ /* * Copyright (C) 2016 Gustavo Sverzut Barbieri * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights...
zyedidia/joy
1
A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API
C++
zyedidia
Zachary Yedidia
Stanford University
src/web-api/curl-websocket.h
C/C++ Header
/* clang-format off */ /* * Copyright (C) 2016 Gustavo Sverzut Barbieri * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights...
zyedidia/joy
1
A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API
C++
zyedidia
Zachary Yedidia
Stanford University
src/web-api/message_queue.hh
C++ Header
#pragma once #include <mutex> #include <queue> #include <vector> #include <string> #include <cstdint> namespace joy::webapi { // Serialized message for cross-thread transfer // Data is serialized using JS_WriteObject2/JS_ReadObject2 struct SerializedMessage { std::vector<uint8_t> data; bool is_error = false;...
zyedidia/joy
1
A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API
C++
zyedidia
Zachary Yedidia
Stanford University
src/web-api/websocket.cc
C++
#include "websocket.hh" #include "engine.hh" #include "curl-websocket.h" #include <cstring> #include <cstdlib> namespace joy::webapi { // WebSocket ready states (matches browser API) enum { WS_STATE_CONNECTING = 0, WS_STATE_OPEN = 1, WS_STATE_CLOSING = 2, WS_STATE_CLOSED = 3 }; // Event indices enum...
zyedidia/joy
1
A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API
C++
zyedidia
Zachary Yedidia
Stanford University
src/web-api/websocket.hh
C++ Header
#pragma once #include "js/js.hh" #ifndef __EMSCRIPTEN__ #include <curl/curl.h> #include <unordered_map> #endif namespace joy { class Engine; namespace webapi { // Forward declaration struct WebSocketData; class WebSocket { public: WebSocket(Engine *engine); ~WebSocket(); // Called each frame to pump...
zyedidia/joy
1
A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API
C++
zyedidia
Zachary Yedidia
Stanford University
src/web-api/websocket_emscripten.cc
C++
#include "websocket.hh" #include "engine.hh" #include <emscripten/websocket.h> #include <cstring> #include <cstdlib> namespace joy::webapi { // WebSocket ready states (matches browser API) enum { WS_STATE_CONNECTING = 0, WS_STATE_OPEN = 1, WS_STATE_CLOSING = 2, WS_STATE_CLOSED = 3 }; // Event indice...
zyedidia/joy
1
A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API
C++
zyedidia
Zachary Yedidia
Stanford University
src/web-api/worker.cc
C++
#include "worker.hh" #include "message_queue.hh" #include "engine.hh" #include <thread> #include <atomic> #include <memory> #include <algorithm> namespace joy::webapi { // Forward declaration of worker thread entry point (in worker_thread.cc) void workerThreadEntry(std::shared_ptr<MessageQueue> incoming, ...
zyedidia/joy
1
A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API
C++
zyedidia
Zachary Yedidia
Stanford University
src/web-api/worker.hh
C++ Header
#pragma once #include "js/js.hh" #include <vector> #include <memory> namespace joy { class Engine; namespace webapi { // Forward declaration struct WorkerData; class Worker { public: Worker(Engine *engine); ~Worker(); // Called each frame to process worker->main messages void update(); // Re...
zyedidia/joy
1
A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API
C++
zyedidia
Zachary Yedidia
Stanford University
src/web-api/worker_thread.cc
C++
#include "worker.hh" #include "message_queue.hh" #include "js/js.hh" #include "modules/filesystem/filesystem.hh" #include "modules/timer/timer.hh" #include "modules/math/math.hh" #include <thread> #include <atomic> #include <chrono> #include <memory> #include <cstdio> namespace joy::webapi { // Worker-side context d...
zyedidia/joy
1
A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API
C++
zyedidia
Zachary Yedidia
Stanford University
web/shell.html
HTML
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"> <title>Joy2D</title> <style> * { margin: 0; padding: 0; box-sizing: border-box; }...
zyedidia/joy
1
A framework for building 2D desktop games in JavaScript, with a Love2D-inspired API
C++
zyedidia
Zachary Yedidia
Stanford University
disarm-sys/build.rs
Rust
use std::env; use std::path::PathBuf; use std::process::Command; fn main() { let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap()); let manifest_dir = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap()); let disarm_dir = manifest_dir.join("disarm"); // Generate the include files using parse.py ...
zyedidia/rdisarm
0
Rust
zyedidia
Zachary Yedidia
Stanford University
disarm-sys/src/lib.rs
Rust
#![allow(non_upper_case_globals)] #![allow(non_camel_case_types)] #![allow(non_snake_case)] #![allow(unsafe_op_in_unsafe_fn)] include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
zyedidia/rdisarm
0
Rust
zyedidia
Zachary Yedidia
Stanford University
src/lib.rs
Rust
//! Safe Rust bindings for the disarm64 AArch64 disassembler library. //! //! This crate provides a Rust-friendly API for decoding and formatting //! AArch64 (ARM64) instructions. //! //! # Example //! //! ``` //! use rdisarm::Instruction; //! //! // Decode a NOP instruction (0xD503201F) //! let inst = Instruction::dec...
zyedidia/rdisarm
0
Rust
zyedidia
Zachary Yedidia
Stanford University
fadec-sys/build.rs
Rust
use std::env; use std::path::PathBuf; use std::process::Command; fn main() { let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap()); let manifest_dir = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap()); let fadec_dir = manifest_dir.join("fadec"); // Generate the decode tables using parseinstrs...
zyedidia/rfadec
0
Rust
zyedidia
Zachary Yedidia
Stanford University
fadec-sys/src/lib.rs
Rust
//! Low-level FFI bindings to the fadec x86 decoder library. //! //! This crate provides raw bindings to the fadec C library. For a safe, //! ergonomic Rust API, use the `rfadec` crate instead. #![allow(non_camel_case_types)] #![allow(non_snake_case)] #![allow(non_upper_case_globals)] use std::ffi::c_char; use std::o...
zyedidia/rfadec
0
Rust
zyedidia
Zachary Yedidia
Stanford University
src/lib.rs
Rust
//! Safe Rust bindings for the fadec x86/x86-64 decoder. //! //! # Example //! //! ``` //! use rfadec::{Decoder, Mode}; //! //! let code = [0x48, 0x89, 0xc3]; // mov rbx, rax //! let decoder = Decoder::new(Mode::Long); //! //! if let Some(instr) = decoder.decode(&code) { //! println!("{}", instr); //! } //! ``` us...
zyedidia/rfadec
0
Rust
zyedidia
Zachary Yedidia
Stanford University