mirror of https://github.com/mode777/rayjs.git
more problems with magnum
This commit is contained in:
parent
c42b87ddfc
commit
026277236b
|
@ -11,7 +11,7 @@ add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/corrade EXCLUDE_FROM_ALL
|
|||
message("=== Configure Magnum ===")
|
||||
# Add Magnum as a subproject, enable Sdl2Application
|
||||
set(MAGNUM_BUILD_STATIC ON CACHE BOOL "" FORCE)
|
||||
set(MAGNUM_WITH_SDL2APPLICATION ON CACHE BOOL "" FORCE)
|
||||
set(MAGNUM_WITH_WGLCONTEXT ON CACHE BOOL "" FORCE)
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/magnum EXCLUDE_FROM_ALL)
|
||||
|
||||
message("=== Configure QuickJS ===")
|
||||
|
@ -41,8 +41,8 @@ target_include_directories(quickjs
|
|||
)
|
||||
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
file(GLOB files src/main.cpp)
|
||||
file(GLOB files src/*.cpp)
|
||||
add_executable(${CMAKE_PROJECT_NAME} ${files})
|
||||
target_include_directories(${CMAKE_PROJECT_NAME} PRIVATE include)
|
||||
target_include_directories(${CMAKE_PROJECT_NAME} PRIVATE src)
|
||||
target_link_libraries(${CMAKE_PROJECT_NAME} SDL2::SDL2-static Magnum::Sdl2Application Magnum::Magnum Magnum::GL quickjs)
|
||||
target_link_libraries(${CMAKE_PROJECT_NAME} SDL2::SDL2-static Magnum::Magnum Magnum::GL Magnum::WglContext quickjs)
|
BIN
my-game.exe
BIN
my-game.exe
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
41
src/main.cpp
41
src/main.cpp
|
@ -1,28 +1,27 @@
|
|||
#include <Magnum/GL/DefaultFramebuffer.h>
|
||||
#include <Magnum/Platform/Sdl2Application.h>
|
||||
#include <Magnum/GL/Context.h>
|
||||
#include <Magnum/Platform/GLContext.h>
|
||||
#include "common.h"
|
||||
//#include "shaders.h"
|
||||
|
||||
using namespace Magnum;
|
||||
|
||||
class MyApplication: public Platform::Application {
|
||||
public:
|
||||
explicit MyApplication(const Arguments& arguments);
|
||||
App_Config app_config = { 640, 480 };
|
||||
App_State app_state = { NULL, 0 };
|
||||
|
||||
private:
|
||||
void drawEvent() override;
|
||||
};
|
||||
int main(int argc, char *argv[]) {
|
||||
|
||||
app_init_quickjs(argc, argv);
|
||||
app_init_sdl();
|
||||
Platform::GLContext context;
|
||||
|
||||
MyApplication::MyApplication(const Arguments& arguments):
|
||||
Platform::Application{arguments}
|
||||
{
|
||||
// TODO: Add your initialization code here
|
||||
}
|
||||
// Main loop
|
||||
while (!app_state.quit) {
|
||||
app_update_sdl();
|
||||
app_update_quickjs();
|
||||
}
|
||||
|
||||
void MyApplication::drawEvent() {
|
||||
GL::defaultFramebuffer.clear(GL::FramebufferClear::Color);
|
||||
|
||||
// TODO: Add your drawing code here
|
||||
|
||||
swapBuffers();
|
||||
}
|
||||
|
||||
MAGNUM_APPLICATION_MAIN(MyApplication)
|
||||
app_dispose_sdl();
|
||||
app_dispose_quickjs();
|
||||
return 0;
|
||||
}
|
|
@ -25,6 +25,12 @@ int app_init_sdl(){
|
|||
}
|
||||
is_window_created = true;
|
||||
|
||||
SDL_GLContext context = SDL_GL_CreateContext(app_state.window);
|
||||
if (context == nullptr) {
|
||||
// handle error
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue