https://github.com/midasvanveen/gamelib
Gamelibrary for lua in c++
https://github.com/midasvanveen/gamelib
cpp game-library lua
Last synced: 6 months ago
JSON representation
Gamelibrary for lua in c++
- Host: GitHub
- URL: https://github.com/midasvanveen/gamelib
- Owner: MidasVanVeen
- Created: 2022-11-17T20:24:55.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-01-08T13:27:57.000Z (about 3 years ago)
- Last Synced: 2025-04-03T18:52:29.513Z (about 1 year ago)
- Topics: cpp, game-library, lua
- Language: C
- Homepage:
- Size: 43 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Gamelibrary for lua in c++
A gamelibaray similar in usage to love.
example usage:
```lua
--[[
-- Filename: main.lua
-- Author: Midas van Veen
-- Description: simple test program for the gamelib ellipse func
--]]
GL_WIDTH=400
GL_HEIGHT=400
local n = 3
function mousePressed()
n = n + 1
print("Number of segments: " .. n)
end
function draw()
GL_Ellipse(0.5,0.5, 0.2, 0.2, n)
end
```
Then run it via the gamelibaray executable
`$ gamelib main.lua`
## Callable functions (in lua)
I've added datatypes for extra clarity.
### GL_Rect
```c
void GL_Rect( float x, float y, float width, float height )
```
Description: Draws a rectangle to the screen
### GL_Ellipse
```c
void GL_Ellipse( float x, float y, float rx, float ry, int num_segments )
```
Description: Draws an ellipse to the screen
### GL_Triangle
```c
void GL_Triangle( float x1, float y1, float x2, float y2, float x3, float y3 )
```
Description: Draws a triangle to the screen
### GL_Line
```c
void GL_Line( float x1, float y1, float x2, float y2 )
```
Description: Draws a line from (x1,y1) to (x2,y2)
### GL_Bezier
```c
void GL_Bezier( float x1, float y1,
float x2, float y2,
float x3, float y3,
float x4, float y4 )
```
Description: Draws a bezier curve, given 4 control points
### GL_Fill
```c
void GL_Fill( int r, int g, int b )
```
Description: Sets the fill color
### GL_Background
```c
void GL_Background( int r, int g, int b )
```
Description: Sets the background color