Cleanup workspace
This commit is contained in:
parent
b089c76938
commit
2a93a78c4f
393
.gitignore
vendored
393
.gitignore
vendored
@ -1,394 +1,5 @@
|
|||||||
build
|
artifacts/
|
||||||
obj
|
|
||||||
*.make
|
*.make
|
||||||
premake5
|
premake5
|
||||||
Makefile
|
Makefile
|
||||||
|
.vscode/
|
||||||
## Ignore Visual Studio temporary files, build results, and
|
|
||||||
## files generated by popular Visual Studio add-ons.
|
|
||||||
##
|
|
||||||
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
|
|
||||||
|
|
||||||
# User-specific files
|
|
||||||
*.rsuser
|
|
||||||
*.suo
|
|
||||||
*.user
|
|
||||||
*.userosscache
|
|
||||||
*.sln.docstates
|
|
||||||
|
|
||||||
# User-specific files (MonoDevelop/Xamarin Studio)
|
|
||||||
*.userprefs
|
|
||||||
|
|
||||||
# Mono auto generated files
|
|
||||||
mono_crash.*
|
|
||||||
|
|
||||||
# Build results
|
|
||||||
[Dd]ebug/
|
|
||||||
[Dd]ebugPublic/
|
|
||||||
[Rr]elease/
|
|
||||||
[Rr]eleases/
|
|
||||||
x64/
|
|
||||||
x86/
|
|
||||||
[Ww][Ii][Nn]32/
|
|
||||||
[Aa][Rr][Mm]/
|
|
||||||
[Aa][Rr][Mm]64/
|
|
||||||
bld/
|
|
||||||
[Bb]in/
|
|
||||||
[Oo]bj/
|
|
||||||
[Ll]og/
|
|
||||||
[Ll]ogs/
|
|
||||||
|
|
||||||
# Visual Studio 2015/2017 cache/options directory
|
|
||||||
.vs/
|
|
||||||
# Uncomment if you have tasks that create the project's static files in wwwroot
|
|
||||||
#wwwroot/
|
|
||||||
|
|
||||||
# Visual Studio 2017 auto generated files
|
|
||||||
Generated\ Files/
|
|
||||||
|
|
||||||
# MSTest test Results
|
|
||||||
[Tt]est[Rr]esult*/
|
|
||||||
[Bb]uild[Ll]og.*
|
|
||||||
|
|
||||||
# NUnit
|
|
||||||
*.VisualState.xml
|
|
||||||
TestResult.xml
|
|
||||||
nunit-*.xml
|
|
||||||
|
|
||||||
# Build Results of an ATL Project
|
|
||||||
[Dd]ebugPS/
|
|
||||||
[Rr]eleasePS/
|
|
||||||
dlldata.c
|
|
||||||
|
|
||||||
# Benchmark Results
|
|
||||||
BenchmarkDotNet.Artifacts/
|
|
||||||
|
|
||||||
# .NET Core
|
|
||||||
project.lock.json
|
|
||||||
project.fragment.lock.json
|
|
||||||
artifacts/
|
|
||||||
|
|
||||||
# ASP.NET Scaffolding
|
|
||||||
ScaffoldingReadMe.txt
|
|
||||||
|
|
||||||
# StyleCop
|
|
||||||
StyleCopReport.xml
|
|
||||||
|
|
||||||
# Files built by Visual Studio
|
|
||||||
*_i.c
|
|
||||||
*_p.c
|
|
||||||
*_h.h
|
|
||||||
*.ilk
|
|
||||||
*.meta
|
|
||||||
*.obj
|
|
||||||
*.iobj
|
|
||||||
*.pch
|
|
||||||
*.pdb
|
|
||||||
*.ipdb
|
|
||||||
*.pgc
|
|
||||||
*.pgd
|
|
||||||
*.rsp
|
|
||||||
*.sbr
|
|
||||||
*.tlb
|
|
||||||
*.tli
|
|
||||||
*.tlh
|
|
||||||
*.tmp
|
|
||||||
*.tmp_proj
|
|
||||||
*_wpftmp.csproj
|
|
||||||
*.log
|
|
||||||
*.tlog
|
|
||||||
*.vspscc
|
|
||||||
*.vssscc
|
|
||||||
.builds
|
|
||||||
*.pidb
|
|
||||||
*.svclog
|
|
||||||
*.scc
|
|
||||||
|
|
||||||
# Chutzpah Test files
|
|
||||||
_Chutzpah*
|
|
||||||
|
|
||||||
# Visual C++ cache files
|
|
||||||
ipch/
|
|
||||||
*.aps
|
|
||||||
*.ncb
|
|
||||||
*.opendb
|
|
||||||
*.opensdf
|
|
||||||
*.sdf
|
|
||||||
*.cachefile
|
|
||||||
*.VC.db
|
|
||||||
*.VC.VC.opendb
|
|
||||||
|
|
||||||
# Visual Studio profiler
|
|
||||||
*.psess
|
|
||||||
*.vsp
|
|
||||||
*.vspx
|
|
||||||
*.sap
|
|
||||||
|
|
||||||
# Visual Studio Trace Files
|
|
||||||
*.e2e
|
|
||||||
|
|
||||||
# TFS 2012 Local Workspace
|
|
||||||
$tf/
|
|
||||||
|
|
||||||
# Guidance Automation Toolkit
|
|
||||||
*.gpState
|
|
||||||
|
|
||||||
# ReSharper is a .NET coding add-in
|
|
||||||
_ReSharper*/
|
|
||||||
*.[Rr]e[Ss]harper
|
|
||||||
*.DotSettings.user
|
|
||||||
|
|
||||||
# TeamCity is a build add-in
|
|
||||||
_TeamCity*
|
|
||||||
|
|
||||||
# DotCover is a Code Coverage Tool
|
|
||||||
*.dotCover
|
|
||||||
|
|
||||||
# AxoCover is a Code Coverage Tool
|
|
||||||
.axoCover/*
|
|
||||||
!.axoCover/settings.json
|
|
||||||
|
|
||||||
# Coverlet is a free, cross platform Code Coverage Tool
|
|
||||||
coverage*.json
|
|
||||||
coverage*.xml
|
|
||||||
coverage*.info
|
|
||||||
|
|
||||||
# Visual Studio code coverage results
|
|
||||||
*.coverage
|
|
||||||
*.coveragexml
|
|
||||||
|
|
||||||
# NCrunch
|
|
||||||
_NCrunch_*
|
|
||||||
.*crunch*.local.xml
|
|
||||||
nCrunchTemp_*
|
|
||||||
|
|
||||||
# MightyMoose
|
|
||||||
*.mm.*
|
|
||||||
AutoTest.Net/
|
|
||||||
|
|
||||||
# Web workbench (sass)
|
|
||||||
.sass-cache/
|
|
||||||
|
|
||||||
# Installshield output folder
|
|
||||||
[Ee]xpress/
|
|
||||||
|
|
||||||
# DocProject is a documentation generator add-in
|
|
||||||
DocProject/buildhelp/
|
|
||||||
DocProject/Help/*.HxT
|
|
||||||
DocProject/Help/*.HxC
|
|
||||||
DocProject/Help/*.hhc
|
|
||||||
DocProject/Help/*.hhk
|
|
||||||
DocProject/Help/*.hhp
|
|
||||||
DocProject/Help/Html2
|
|
||||||
DocProject/Help/html
|
|
||||||
|
|
||||||
# Click-Once directory
|
|
||||||
publish/
|
|
||||||
|
|
||||||
# Publish Web Output
|
|
||||||
*.[Pp]ublish.xml
|
|
||||||
*.azurePubxml
|
|
||||||
# Note: Comment the next line if you want to checkin your web deploy settings,
|
|
||||||
# but database connection strings (with potential passwords) will be unencrypted
|
|
||||||
*.pubxml
|
|
||||||
*.publishproj
|
|
||||||
|
|
||||||
# Microsoft Azure Web App publish settings. Comment the next line if you want to
|
|
||||||
# checkin your Azure Web App publish settings, but sensitive information contained
|
|
||||||
# in these scripts will be unencrypted
|
|
||||||
PublishScripts/
|
|
||||||
|
|
||||||
# NuGet Packages
|
|
||||||
*.nupkg
|
|
||||||
# NuGet Symbol Packages
|
|
||||||
*.snupkg
|
|
||||||
# The packages folder can be ignored because of Package Restore
|
|
||||||
**/[Pp]ackages/*
|
|
||||||
# except build/, which is used as an MSBuild target.
|
|
||||||
!**/[Pp]ackages/build/
|
|
||||||
# Uncomment if necessary however generally it will be regenerated when needed
|
|
||||||
#!**/[Pp]ackages/repositories.config
|
|
||||||
# NuGet v3's project.json files produces more ignorable files
|
|
||||||
*.nuget.props
|
|
||||||
*.nuget.targets
|
|
||||||
|
|
||||||
# Nuget personal access tokens and Credentials
|
|
||||||
nuget.config
|
|
||||||
|
|
||||||
# Microsoft Azure Build Output
|
|
||||||
csx/
|
|
||||||
*.build.csdef
|
|
||||||
|
|
||||||
# Microsoft Azure Emulator
|
|
||||||
ecf/
|
|
||||||
rcf/
|
|
||||||
|
|
||||||
# Windows Store app package directories and files
|
|
||||||
AppPackages/
|
|
||||||
BundleArtifacts/
|
|
||||||
Package.StoreAssociation.xml
|
|
||||||
_pkginfo.txt
|
|
||||||
*.appx
|
|
||||||
*.appxbundle
|
|
||||||
*.appxupload
|
|
||||||
|
|
||||||
# Visual Studio cache files
|
|
||||||
# files ending in .cache can be ignored
|
|
||||||
*.[Cc]ache
|
|
||||||
# but keep track of directories ending in .cache
|
|
||||||
!?*.[Cc]ache/
|
|
||||||
|
|
||||||
# Others
|
|
||||||
ClientBin/
|
|
||||||
~$*
|
|
||||||
*~
|
|
||||||
*.dbmdl
|
|
||||||
*.dbproj.schemaview
|
|
||||||
*.jfm
|
|
||||||
*.pfx
|
|
||||||
*.publishsettings
|
|
||||||
orleans.codegen.cs
|
|
||||||
|
|
||||||
# Including strong name files can present a security risk
|
|
||||||
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
|
|
||||||
#*.snk
|
|
||||||
|
|
||||||
# Since there are multiple workflows, uncomment next line to ignore bower_components
|
|
||||||
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
|
|
||||||
#bower_components/
|
|
||||||
|
|
||||||
# RIA/Silverlight projects
|
|
||||||
Generated_Code/
|
|
||||||
|
|
||||||
# Backup & report files from converting an old project file
|
|
||||||
# to a newer Visual Studio version. Backup files are not needed,
|
|
||||||
# because we have git ;-)
|
|
||||||
_UpgradeReport_Files/
|
|
||||||
Backup*/
|
|
||||||
UpgradeLog*.XML
|
|
||||||
UpgradeLog*.htm
|
|
||||||
ServiceFabricBackup/
|
|
||||||
*.rptproj.bak
|
|
||||||
|
|
||||||
# SQL Server files
|
|
||||||
*.mdf
|
|
||||||
*.ldf
|
|
||||||
*.ndf
|
|
||||||
|
|
||||||
# Business Intelligence projects
|
|
||||||
*.rdl.data
|
|
||||||
*.bim.layout
|
|
||||||
*.bim_*.settings
|
|
||||||
*.rptproj.rsuser
|
|
||||||
*- [Bb]ackup.rdl
|
|
||||||
*- [Bb]ackup ([0-9]).rdl
|
|
||||||
*- [Bb]ackup ([0-9][0-9]).rdl
|
|
||||||
|
|
||||||
# Microsoft Fakes
|
|
||||||
FakesAssemblies/
|
|
||||||
|
|
||||||
# GhostDoc plugin setting file
|
|
||||||
*.GhostDoc.xml
|
|
||||||
|
|
||||||
# Node.js Tools for Visual Studio
|
|
||||||
.ntvs_analysis.dat
|
|
||||||
node_modules/
|
|
||||||
|
|
||||||
# Visual Studio 6 build log
|
|
||||||
*.plg
|
|
||||||
|
|
||||||
# Visual Studio 6 workspace options file
|
|
||||||
*.opt
|
|
||||||
|
|
||||||
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
|
|
||||||
*.vbw
|
|
||||||
|
|
||||||
# Visual Studio LightSwitch build output
|
|
||||||
**/*.HTMLClient/GeneratedArtifacts
|
|
||||||
**/*.DesktopClient/GeneratedArtifacts
|
|
||||||
**/*.DesktopClient/ModelManifest.xml
|
|
||||||
**/*.Server/GeneratedArtifacts
|
|
||||||
**/*.Server/ModelManifest.xml
|
|
||||||
_Pvt_Extensions
|
|
||||||
|
|
||||||
# Paket dependency manager
|
|
||||||
.paket/paket.exe
|
|
||||||
paket-files/
|
|
||||||
|
|
||||||
# FAKE - F# Make
|
|
||||||
.fake/
|
|
||||||
|
|
||||||
# CodeRush personal settings
|
|
||||||
.cr/personal
|
|
||||||
|
|
||||||
# Python Tools for Visual Studio (PTVS)
|
|
||||||
__pycache__/
|
|
||||||
*.pyc
|
|
||||||
|
|
||||||
# Cake - Uncomment if you are using it
|
|
||||||
# tools/**
|
|
||||||
# !tools/packages.config
|
|
||||||
|
|
||||||
# Tabs Studio
|
|
||||||
*.tss
|
|
||||||
|
|
||||||
# Telerik's JustMock configuration file
|
|
||||||
*.jmconfig
|
|
||||||
|
|
||||||
# BizTalk build output
|
|
||||||
*.btp.cs
|
|
||||||
*.btm.cs
|
|
||||||
*.odx.cs
|
|
||||||
*.xsd.cs
|
|
||||||
|
|
||||||
# OpenCover UI analysis results
|
|
||||||
OpenCover/
|
|
||||||
|
|
||||||
# Azure Stream Analytics local run output
|
|
||||||
ASALocalRun/
|
|
||||||
|
|
||||||
# MSBuild Binary and Structured Log
|
|
||||||
*.binlog
|
|
||||||
|
|
||||||
# NVidia Nsight GPU debugger configuration file
|
|
||||||
*.nvuser
|
|
||||||
|
|
||||||
# MFractors (Xamarin productivity tool) working folder
|
|
||||||
.mfractor/
|
|
||||||
|
|
||||||
# Local History for Visual Studio
|
|
||||||
.localhistory/
|
|
||||||
|
|
||||||
# BeatPulse healthcheck temp database
|
|
||||||
healthchecksdb
|
|
||||||
|
|
||||||
# Backup folder for Package Reference Convert tool in Visual Studio 2017
|
|
||||||
MigrationBackup/
|
|
||||||
|
|
||||||
# Ionide (cross platform F# VS Code tools) working folder
|
|
||||||
.ionide/
|
|
||||||
|
|
||||||
# Fody - auto-generated XML schema
|
|
||||||
FodyWeavers.xsd
|
|
||||||
|
|
||||||
# VS Code files for those working on multiple tools
|
|
||||||
.vscode/*
|
|
||||||
!.vscode/settings.json
|
|
||||||
!.vscode/tasks.json
|
|
||||||
!.vscode/launch.json
|
|
||||||
!.vscode/extensions.json
|
|
||||||
*.code-workspace
|
|
||||||
|
|
||||||
# Local History for Visual Studio Code
|
|
||||||
.history/
|
|
||||||
|
|
||||||
# Windows Installer files from build outputs
|
|
||||||
*.cab
|
|
||||||
*.msi
|
|
||||||
*.msix
|
|
||||||
*.msm
|
|
||||||
*.msp
|
|
||||||
|
|
||||||
# JetBrains Rider
|
|
||||||
.idea/
|
|
||||||
*.sln.iml
|
|
||||||
|
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
[submodule "ogre"]
|
||||||
|
path = libs/ogre
|
||||||
|
url = https://github.com/OGRECave/ogre.git
|
3
.vscode/settings.json
vendored
Normal file
3
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"cmake.configureOnOpen": true
|
||||||
|
}
|
7
MyGraphicsEngine/Shader/vertex.shader
Normal file
7
MyGraphicsEngine/Shader/vertex.shader
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
#version 330 core
|
||||||
|
layout (location = 0) in vec3 aPos;
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
gl_Position = vec4(aPos.x, aPos.y, aPos.z, 1.0);
|
||||||
|
}
|
135
MyGraphicsEngine/glWindow.c
Normal file
135
MyGraphicsEngine/glWindow.c
Normal file
@ -0,0 +1,135 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include "glfw3.h"
|
||||||
|
//#include "spdlog.h"
|
||||||
|
GLFWwindow * window;
|
||||||
|
|
||||||
|
int main (void) {
|
||||||
|
|
||||||
|
// spdlog::info("Welcome to spdlog!");
|
||||||
|
|
||||||
|
if ( !glfwInit()){
|
||||||
|
puts("Failed to initialize GLFW!");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
window = glfwCreateWindow( 640 , 480, "BarinkEngine", NULL, NULL);
|
||||||
|
|
||||||
|
if( !window){
|
||||||
|
puts("Failed to create the window");
|
||||||
|
glfwTerminate();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
glfwMakeContextCurrent(window);
|
||||||
|
|
||||||
|
if(glfwVulkanSupported())
|
||||||
|
{
|
||||||
|
puts("Vulkan is supported!");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int width,height;
|
||||||
|
glfwGetFramebufferSize(window, &width, &height);
|
||||||
|
glViewport(0,0, width, height);
|
||||||
|
|
||||||
|
// SOURCE: https://learnopengl.com/Getting-started/Hello-Triangle
|
||||||
|
|
||||||
|
|
||||||
|
float vertices[] = {
|
||||||
|
-0.5, -0.5f, 0.0f,
|
||||||
|
0.5, -0.5f, 0.0f,
|
||||||
|
0.5, 0.5f, 0.0f,
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
unsigned int VBO;
|
||||||
|
glGenBuffers(1,&VBO);
|
||||||
|
|
||||||
|
glBindBuffer(GL_ARRAY_BUFFER, VBO);
|
||||||
|
|
||||||
|
glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);
|
||||||
|
|
||||||
|
// Load the vertex shader program
|
||||||
|
const char *vertexShaderSource = "#version 330 core\n"
|
||||||
|
"layout (location = 0) in vec3 aPos;\n"
|
||||||
|
"void main()\n"
|
||||||
|
"{\n"
|
||||||
|
" gl_Position = vec4(aPos.x, aPos.y, aPos.z, 1.0);\n"
|
||||||
|
"}\0";
|
||||||
|
|
||||||
|
unsigned int vertexShader;
|
||||||
|
vertexShader = glCreateShader(GL_VERTEX_SHADER);
|
||||||
|
glShaderSource(vertexShader, 1, &vertexShaderSource, NULL);
|
||||||
|
glCompileShader(vertexShader);
|
||||||
|
|
||||||
|
const char *fragmentShaderSource = "#version 330 core\n"
|
||||||
|
"out vec4 FragColor;\n"
|
||||||
|
"void main ()\n {\n"
|
||||||
|
"FragColor = vec4(1.0f, 0.5f, 0.2f, 1.0f); \n"
|
||||||
|
"}\n";
|
||||||
|
|
||||||
|
unsigned int fragmentShader ;
|
||||||
|
fragmentShader = glCreateShader(GL_FRAGMENT_SHADER);
|
||||||
|
glShaderSource(fragmentShader, 1, &fragmentShaderSource, NULL);
|
||||||
|
glCompileShader(fragmentShader);
|
||||||
|
|
||||||
|
unsigned int shaderProgram;
|
||||||
|
shaderProgram = glCreateProgram();
|
||||||
|
|
||||||
|
glAttachShader (shaderProgram, vertexShader);
|
||||||
|
glAttachShader(shaderProgram, fragmentShader);
|
||||||
|
glLinkProgram(shaderProgram);
|
||||||
|
|
||||||
|
glUseProgram(shaderProgram);
|
||||||
|
|
||||||
|
glVertexAttribPointer(0,3,GL_FLOAT,GL_FALSE,3*sizeof(float), (void*)0);
|
||||||
|
glEnableVertexAttribArray(0);
|
||||||
|
|
||||||
|
// Copy our vertices array in a buffer for OpenGL to use
|
||||||
|
glBindBuffer(GL_ARRAY_BUFFER, VBO);
|
||||||
|
glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);
|
||||||
|
|
||||||
|
// then set the vertex attributes pointers
|
||||||
|
glVertexAttribPointer(0,3,GL_FLOAT,GL_FALSE,3*sizeof(float), (void*)0);
|
||||||
|
glEnableVertexAttribArray(0);
|
||||||
|
|
||||||
|
|
||||||
|
unsigned int VAO;
|
||||||
|
glGenVertexArrays(1,&VAO);
|
||||||
|
|
||||||
|
glBindVertexArray(VAO);
|
||||||
|
|
||||||
|
// use our hader program when we want to render an object
|
||||||
|
glUseProgram(shaderProgram);
|
||||||
|
glBindVertexArray(VAO);
|
||||||
|
|
||||||
|
|
||||||
|
while(!glfwWindowShouldClose(window)){
|
||||||
|
/* Start rendering here */
|
||||||
|
glClearColor(0.2f, 0.3f, 0.3f, 1.0f);
|
||||||
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
|
|
||||||
|
|
||||||
|
glDrawArrays(GL_TRIANGLES, 0, 3);
|
||||||
|
|
||||||
|
|
||||||
|
/* Swap front and back buffers */
|
||||||
|
glfwSwapBuffers(window);
|
||||||
|
|
||||||
|
/* Poll for and process events */
|
||||||
|
glfwPollEvents();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
glDeleteShader(vertexShader);
|
||||||
|
glDeleteShader(fragmentShader);
|
||||||
|
|
||||||
|
|
||||||
|
glfwTerminate();
|
||||||
|
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
69
SandboxApplication/hello.cpp
Normal file
69
SandboxApplication/hello.cpp
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <lua.h>
|
||||||
|
|
||||||
|
extern "c" {
|
||||||
|
static int l_cppfunction(lua_State *L) {
|
||||||
|
double arg = luaL_checknumber(L,1);
|
||||||
|
lua_pushnumber(L, arg * 0.5);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int main (int argc, char *argv[] ){
|
||||||
|
printf("Test lua embedding");
|
||||||
|
printf("init lua");
|
||||||
|
lua_State *L;
|
||||||
|
L = luaL_newState();
|
||||||
|
printf("Load the (optional) standard libraries, to have to print function");
|
||||||
|
luaL_openLibs(L);
|
||||||
|
printf("Load chenk. without executing it.");
|
||||||
|
if( luaL_loadfile(L, "hello.lua")){
|
||||||
|
printf("Something went wrong loading the check (syntax error?)");
|
||||||
|
printf(lua_tostring(L, -1));
|
||||||
|
lua_pop(L,1);
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("Make a insert a global var into lua from C++");
|
||||||
|
lua_pushnumber(L, 1.1);
|
||||||
|
lua_setglobal(L, "cppvar");
|
||||||
|
|
||||||
|
printf("Execute the Lua chunk");
|
||||||
|
if(lua_pcall(L, 0, LUA_MULTRET, 0)){
|
||||||
|
printf("Something went wrong during execution");
|
||||||
|
printf(lua_tostring(L, -1));
|
||||||
|
lua_pop(L,1);
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("read a global var from lua into C++");
|
||||||
|
lua_getglobal(L, "luavar");
|
||||||
|
double luavar = lua_tonumber(L, -1);
|
||||||
|
lua_pop(L,1);
|
||||||
|
printf("c++ can read the value set from lua luavar = %s", luavar );
|
||||||
|
|
||||||
|
printf("execute a lua function from cpp");
|
||||||
|
lua_getglobal(L, "myluafunction");
|
||||||
|
lua_pushnumber(L, 5);
|
||||||
|
lua_pcall(L,1,1,0);
|
||||||
|
printf("the return value of the function was %s", lua_tostring(L, -1));
|
||||||
|
lua_pop(L,1);
|
||||||
|
|
||||||
|
printf("execute a cpp function from lua");
|
||||||
|
printf("first register the function in lua");
|
||||||
|
lua_pushcfunction(L , l_cppfunction);
|
||||||
|
lua_setglobal(L, "cppfunction");
|
||||||
|
|
||||||
|
printf("Call a lua function that uses the cpp function");
|
||||||
|
lua_setglobal(L, "myFunction");
|
||||||
|
lua_pushnumber(L, 5);
|
||||||
|
lua_pcall(L,1,1,0);
|
||||||
|
printf("the return value of the function was %s", lua_tonumber(L,-1));
|
||||||
|
lua_pop(L,1);
|
||||||
|
|
||||||
|
printf("Release the lua environment");
|
||||||
|
lua_close(L);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
14
SandboxApplication/hello.lua
Normal file
14
SandboxApplication/hello.lua
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
-- Pack this into object file with ld: ld -r -b binary -o hello.o hello.lua
|
||||||
|
|
||||||
|
print ("Hello from lua")
|
||||||
|
print ("Lua code is capable of reading value set from C++", cppvar)
|
||||||
|
luavar = cppvar * 3
|
||||||
|
|
||||||
|
function myluafunction (times)
|
||||||
|
return string.rep("(-)", times)
|
||||||
|
end
|
||||||
|
|
||||||
|
function myfunction(arg)
|
||||||
|
return cppfunction(arg)
|
||||||
|
end
|
||||||
|
|
72
premake5.lua
72
premake5.lua
@ -1,18 +1,66 @@
|
|||||||
workspace "BarinkEngine"
|
workspace "BarinkEngine"
|
||||||
configurations { "Debug", "Release" }
|
configurations { "Debug", "Test", "Release" }
|
||||||
|
|
||||||
project "Engine"
|
project "SandboxApplication"
|
||||||
kind "ConsoleApp"
|
kind "ConsoleApp"
|
||||||
language "C"
|
language "C++"
|
||||||
targetdir "build/%{cfg.buildcfg}"
|
cppdialect "C++17"
|
||||||
|
targetdir "./artifacts/build/%{cfg.buildcfg}"
|
||||||
|
objdir "./artifacts/obj/%{cfg.buildcfg}"
|
||||||
|
|
||||||
files { "src/*.c"}
|
includedirs {
|
||||||
|
"./libs/lua-5.4.3/",
|
||||||
|
|
||||||
filter "configurations:Debug"
|
}
|
||||||
defines {"DEBUG"}
|
|
||||||
symbols "On"
|
|
||||||
|
|
||||||
filter "configurations:Release"
|
libdirs {
|
||||||
defines {"NDEBUG"}
|
os.findlib("lua")
|
||||||
optimize "On"
|
}
|
||||||
|
|
||||||
|
|
||||||
|
files {
|
||||||
|
"SandboxApplication/*.c"
|
||||||
|
}
|
||||||
|
|
||||||
|
links{
|
||||||
|
"lua"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
project "MyGraphicsEngine"
|
||||||
|
kind "ConsoleApp"
|
||||||
|
language "C++"
|
||||||
|
cppdialect "c++17"
|
||||||
|
targetdir "./artifacts/build/%{cfg.buildcfg}"
|
||||||
|
objdir "./artifacts/obj/%{cfg.buildcfg}"
|
||||||
|
buildmessage "Building MyGraphicsEngine"
|
||||||
|
|
||||||
|
includedirs {
|
||||||
|
"./libs/glfw-3.3.4/include/GLFW/",
|
||||||
|
"./libs/spdlog-1.9.1/include/spdlog/"
|
||||||
|
}
|
||||||
|
|
||||||
|
libdirs{
|
||||||
|
"./libs/spdlog-1.9.1/build/libspdlog.a",
|
||||||
|
os.findlib("glfw3"),
|
||||||
|
}
|
||||||
|
links {
|
||||||
|
-- "libspdlog",
|
||||||
|
"glfw3",
|
||||||
|
"X11",
|
||||||
|
"GL",
|
||||||
|
"GLU",
|
||||||
|
"pthread",
|
||||||
|
"dl",
|
||||||
|
"m"
|
||||||
|
}
|
||||||
|
|
||||||
|
files {"MyGraphicsEngine/*.c"}
|
||||||
|
|
||||||
|
filter "configurations:Debug"
|
||||||
|
defines {"DEBUG"}
|
||||||
|
symbols "On"
|
||||||
|
|
||||||
|
filter "configurations:Release"
|
||||||
|
defines {"NDEBUG"}
|
||||||
|
optimize "On"
|
||||||
|
@ -1,11 +0,0 @@
|
|||||||
# Sets up a comfortable terminal experience
|
|
||||||
|
|
||||||
# Define aliases
|
|
||||||
alias gg="git status"
|
|
||||||
alias ga="git add"
|
|
||||||
alias gm="git commit"
|
|
||||||
alias gp="git push"
|
|
||||||
alias run=$(pwd)/scripts/run.sh
|
|
||||||
|
|
||||||
# Define environment variables
|
|
||||||
export message="Hello environment!"
|
|
@ -1,8 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
echo $0
|
|
||||||
|
|
||||||
if [ $0 -eq "Release" ]; then
|
|
||||||
echo "Run release"
|
|
||||||
else
|
|
||||||
echo "Run debug"
|
|
||||||
fi
|
|
@ -1,6 +0,0 @@
|
|||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
int main (void) {
|
|
||||||
puts("Hello, world!");
|
|
||||||
return 0;
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user