goarrg

package module
v0.0.0-...-0ec750f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 1, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

README

goARRG - go Assembly RequiRed Game-engine

Go Reference
goARRG is a assembly required game engine where the pieces may or may not be provided and it is up to you to put them together. This allows the user to customize the engine almost exactly to their needs. It is not a goal however to make it easy to rip out a piece and replace it later.

Development Roadmap

*Not in actual development order

  • MVP for engine development
    • Platform initialization and setup
    • Maths
    • Glue APIs
    • Basic Tooling
  • Renderer
  • ECS
  • Editor

Supported Platforms

Currently goarrg only supports Ubuntu (tested on 20.04 LTS) and Windows 10, 386 and amd64. Vulkan is only supported on amd64. However, there is nothing preventing you from creating a platform package to support other platforms.

Dependencies

goarrg requires go 1.21+
The following list of dependencies assume you are using the make package to install the rest.

OS Dependencies
Ubuntu sudo apt-get install build-essential cmake libxext-dev libpulse-dev
Windows mingw-w64, cmake
Graphics API Specific
OS API Dependencies
Ubuntu gl sudo apt-get install libglu1-mesa-dev mesa-common-dev

Cross Compile

There is cross compile support for the supported platforms, assuming you installed a C/C++ cross compiler with the correct file names. To cross compile to other platforms, or to use a non default toolchain, you need to set the CC/CXX/AR environmental variables. For Windows, you also need to set RC.

The toolchain/gcc package is there to help setup these environmental variables.

Default Compiler Selection
Taraget Platform Prefix
linux_386 i686-linux-gnu
linux_amd64 x86_64-linux-gnu
windows_386 i686-w64-mingw32
windows_amd64 x86_64-w64-mingw32

CC={{.Prefix}}-gcc
CXX={{.Prefix}}-g++
AR={{.Prefix}}-gcc-ar
Windows Only:
RC={{.Prefix}}-windres

Install instructions

Install Go manually to ensure you have the latest version.
https://golang.org/doc/install

mkdir projectfolder
cd projectfolder
go mod init github.com/username/projectname
go get -d goarrg.com/...

After which you write a ./cmd/make program that imports the goarrg.com/make package to build dependencies and to build your project.

Examples

Examples can be found at https://github.com/goarrg/examples

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(cfg Config) error

func Running

func Running() bool

Running reports whether the engine is considered to still be running. It will only return true when the main loop is running and before shutdown confirmation from Program.Shutdown(). This is so that you can depend on Running() to terminate your loops/threads.

SIGINT will bypass Program.Shutdown() and force a terminate. This is so we have a easy way to terminate the engine in the event of deadlocks.

func Shutdown

func Shutdown()

Shutdown is a thread safe signal to the engine that it should shutdown. The signal usually would come from the Platform or Program packages.

Types

type Audio

type Audio interface {
	AudioConfig() AudioConfig
	Init(AudioConfig) error
	Mix() (int, audio.Track)
	Update()
	Destroy()
}

type AudioConfig

type AudioConfig struct {
	Spec audio.Spec

	// Length of the buffer in terms of samples, this is usually a power of 2
	BufferLength int
}

Refer to driver's documentation on the valid value ranges

type Config

type Config struct {
	Platform Platform
	Audio    Audio
	Renderer Renderer
	Program  Program
}

type GLConfig

type GLConfig struct {
	Major   uint8
	Minor   uint8
	Profile GLProfile
}

type GLInstance

type GLInstance interface {
	ProcAddr() uintptr
	SwapBuffers()
}

type GLProfile

type GLProfile uint8
const (
	GLProfileCore GLProfile = iota
	GLProfileCompat
	GLProfileES
)

type GLRenderer

type GLRenderer interface {
	Renderer
	GLConfig() GLConfig
	GLInit(GLInstance) error
}

type Platform

type Platform interface {
	Init() error
	AudioInit(Audio) error
	DisplayInit(Renderer) error
	Update()
	Destroy()
}

type Program

type Program interface {
	Init() error
	Update(float64)
	Shutdown() bool
	Destroy()
}

type Renderer

type Renderer interface {
	Draw() float64
	Resize(int, int)
	Destroy()
}

type VkConfig

type VkConfig struct {
	API        uint32
	Layers     []string
	Extensions []string
}

type VkInstance

type VkInstance interface {
	Uintptr() uintptr
	ProcAddr() uintptr
	Surface() uintptr
}

type VkRenderer

type VkRenderer interface {
	Renderer
	VkConfig() VkConfig
	VkInit(VkInstance) error
}

Directories

Path Synopsis
cmd
internal
platform
sdl
gcc
git

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL