GithubHelp home page GithubHelp logo

selene's Introduction

Selene

Selene is a tiny game engine made with C and Lua, the idea is to implementing all engine/framework logic in Lua, and for that i expose some C library functions to Lua.

Modules

C Modules:

  • Data
  • audio (drwav, stb_vorbis)
    • Decoder
  • filesystem
    • File
  • font (stb_truetype, default bit font)
  • image (stb_image)
  • linmath
    • Mat4
  • OpenGL
    • Texture
    • Framebuffer
    • Shader
    • Program
    • VertexArray
    • Buffer
  • SDL2
    • AudioDeviceID
    • AudioStream
    • Event
    • Gamepad (GameController)
    • Joystick
    • GLContext
    • Window
  • system

Lua Modules (core):

  • audio
    • Music
    • Sound
    • SoundInstance
    • AudioSystem
  • graphics
    • Image
    • Canvas
    • Font
    • Batch
    • Effect
    • Renderer
  • input
    • Gamepad
    • Joystick
    • Keyboard
    • Mouse
    • InputSystem
  • App
  • Event
  • Filesystem
  • Point
  • Rect
  • Settings
  • Window

Running projects

Just execute selene passing your project path as argument, if none is provided the current directory will be used.

The directory must contain a main.lua file and a .selene/ folder, and the .selene/ must contains a settings.lua file, and later will be used to store metadata stuff for the editor and engine

usage: ./selene [path/to/project]

The idea is that by using:

local App = require('App')
return App.default()

The project will use the selene default engine, so it will use the (future) AssetManager, RoomManager, UI.

But you can write your own loop by using

main.lua

local App = require('App')
local Color = require('graphics.Color')
local Settings = require('Settings')

local s = Settings.create("game", 640, 380)
local app = App.create(s)

function app:onTick(dt)
end

function app:onRender(render)
    render:setClearColor(Color.black)
    render:clear()

    render:fillRectangle(32, 32, 64, 128)
end
return app

core/

All the Lua modules are located in a directory called core/, and it must be in the same location of the Selene executable. On startup Selene will search for this file, and if not found it will not boot up.

This is the bootup script:

local sdl = selene.sdl2
local function add_path(path)
    package.path = path .. '?.lua;' .. path .. '?/init.lua;' .. package.path
end
return function(args)
    add_path(sdl.getBasePath())
    return require('core')
end

Dependencies

  • A C compiler
  • SDL2 dev lib
  • CMake

Linux

On Linux i use Make for build, so in Debian for example you can install all dependencies with:

sudo apt install gcc make libsdl2-dev cmake

and build with:

cmake -B build && make -C build

Windows

If you going to use the VC++ compiler and Visual Studio Tools, you will need to download the SDL2 dev lib from https://github.com/libsdl-org/SDL/releases/ (Download the SDL2-devel-x.xx.x-VC.zip version), and put the content in external/SDL2/MSVC.

MacOS

For OSX i recommend use homebrew, you can install all dependencies with:

brew install sdl2 cmake make 

(The C compiler is already embedded when you install the build tools)

And for build is the same as Linux:

cmake -B build && make -C build

selene's People

Contributors

canoi12 avatar

Stargazers

Berilo Wanderley avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.