šŸš€ Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more →
Socket
Sign inDemoInstall
Socket

github.com/somenoe/raylib-hot-reload-go

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/somenoe/raylib-hot-reload-go

v0.0.0-20241219170321-496a504cd358
Source
Go
Version published
Created
Source

Raylib Hot Reload in Go

A proof of concept of using hot reload with the raylib library in Go.

Overview

This project demonstrates a hot-reloading mechanism for game development in Go, leveraging Raylib for graphics and Yaegi for dynamic code interpretation. This setup allows for rapid iteration by applying code changes without recompiling or restarting the application.

Prerequisites

Before running this project, ensure you have the following installed:

  • Go: Make sure you have Go installed and configured correctly. This includes having a working Go environment with either GOPATH set up or Go modules enabled. (otherwise, yaegi extract will fail)

  • Yaegi: Install Yaegi using the following command:

    go install github.com/traefik/yaegi/cmd/yaegi@latest
    

How to Extract Raylib Symbols

To enable Yaegi to interact with Raylib, you need to extract the necessary symbols. Follow these steps:

  • Navigate to the symbols directory:

    cd symbols
    
  • Run the Yaegi extraction command:

    yaegi extract github.com/gen2brain/raylib-go/raylib
    

How to Run the Project

  • Clone the repository.

  • Navigate to the project directory.

  • Run the main application:

    go run .
    
  • Modify the src/game.go file while the application is running. Changes will be applied dynamically.

Project Structure

  • main.go: The main application file that sets up the Raylib window, the Yaegi interpreter, and the file watcher.
  • src/game.go: Contains the game logic that is dynamically reloaded.
  • symbols/: Contains the extracted Raylib symbols.

Inspiration

This project was inspired by Gandalf-Le-Dev/ebitengine-yaegi-hotreload, which demonstrates a similar hot-reloading approach for the Ebitengine game library.

FAQs

Package last updated on 19 Dec 2024

Did you know?

Socket

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.

Install

Related posts