Skip to content

Commit

Permalink
Temporarily disable scripting
Browse files Browse the repository at this point in the history
  • Loading branch information
himanshugoel2797 committed Nov 19, 2022
1 parent e495d93 commit 6f7359d
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 14 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@
[submodule "Lua"]
path = Lua
url = https://github.com/himanshugoel2797/Lua.git
[submodule "openvr"]
path = openvr
url = https://github.com/ValveSoftware/openvr.git
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"files.associations": {
"ostream": "cpp",
"iostream": "cpp"
}
},
"cmake.configureOnOpen": true
}
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ add_subdirectory(${CMAKE_SOURCE_DIR}/tinygltf)

set_target_properties(ProtoVoxel PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})

add_subdirectory(lua)
#add_subdirectory(lua)

target_compile_options(ProtoVoxel PRIVATE -mavx2 -mbmi)
target_link_directories(ProtoVoxel PRIVATE ${CMAKE_SOURCE_DIR}/glfw/lib-vc2019)
target_link_libraries(ProtoVoxel lua_static glfw glad imgui OpenGL::GL ${CMAKE_DL_LIBS})
target_link_libraries(ProtoVoxel glfw glad imgui OpenGL::GL ${CMAKE_DL_LIBS}) #lua_static
target_compile_definitions(ProtoVoxel PRIVATE DEBUG)
target_compile_definitions(ProtoVoxel PRIVATE _USE_MATH_DEFINES)
target_include_directories(ProtoVoxel PRIVATE ${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/glfw/include ${CMAKE_SOURCE_DIR}/tinygltf ${CMAKE_SOURCE_DIR}/Lua/lua-5.4.3/include)
target_include_directories(ProtoVoxel PRIVATE ${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/glfw/include ${CMAKE_SOURCE_DIR}/tinygltf)# ${CMAKE_SOURCE_DIR}/Lua/lua-5.4.3/include)

set(CPACK_PROJECT_NAME ${PROJECT_NAME})
set(CPACK_PROJECT_VERSION ${PROJECT_VERSION})
Expand Down
1 change: 1 addition & 0 deletions openvr
Submodule openvr added at 4c85ab
14 changes: 7 additions & 7 deletions src/core/scripting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,25 @@
// https://opensource.org/licenses/MIT

#include "scripting.h"
#include "lua.hpp"
//#include "lua.hpp"

namespace PVC = ProtoVoxel::Core;

PVC::Script::Script(){
state = luaL_newstate();
luaL_openlibs(state);
//state = luaL_newstate();
//luaL_openlibs(state);
//load any standard libraries
}

PVC::Script::~Script() {
lua_close(state);
//lua_close(state);
}

void PVC::Script::LoadScript(const char* file) {
luaL_loadfile(state, file);
//luaL_loadfile(state, file);
}

void PVC::Script::Call(const char* func) {
lua_getglobal(state, func);
lua_call(state, 0, 0);
//lua_getglobal(state, func);
//lua_call(state, 0, 0);
}
4 changes: 2 additions & 2 deletions src/core/scripting.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
// https://opensource.org/licenses/MIT

#pragma once
#include "lua.hpp"
//#include "lua.hpp"

namespace ProtoVoxel::Core {
class Script {
private:
lua_State* state;
//lua_State* state;
public:
Script();
~Script();
Expand Down
3 changes: 2 additions & 1 deletion src/core/window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ static void gl_debug_callback(GLenum src, GLenum type, GLuint id,
GLenum severity, GLsizei length,
const GLchar *message, const void *userParam)
{
printf("OpenGL Debug Message: %s\n", message);
if ((type == GL_DEBUG_TYPE_ERROR) | (type == GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR) | (type == GL_DEBUG_TYPE_PERFORMANCE))
printf("OpenGL Debug Message: %s\n", message);
}

static bool glfwInited = false;
Expand Down

0 comments on commit 6f7359d

Please sign in to comment.