:evil:
This commit is contained in:
parent
d0b13cd459
commit
e38b603eb7
3 changed files with 89 additions and 80 deletions
|
@ -1,4 +1,4 @@
|
||||||
cmake_minimum_required(VERSION 3.12)
|
cmake_minimum_required(VERSION 3.7)
|
||||||
project(sockscape)
|
project(sockscape)
|
||||||
|
|
||||||
string(COMPARE EQUAL ${CMAKE_BUILD_TYPE} Debug _CMP)
|
string(COMPARE EQUAL ${CMAKE_BUILD_TYPE} Debug _CMP)
|
||||||
|
@ -8,17 +8,18 @@ if(_CMP)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 11)
|
set(CMAKE_CXX_STANDARD 11)
|
||||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake")
|
#set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake")
|
||||||
if(CMAKE_COMPILER_IS_GNUCXX)
|
#if(CMAKE_COMPILER_IS_GNUCXX)
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -s USE_SDL=2")
|
||||||
endif()
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s USE_SDL_IMAGE=2 -s SDL2_IMAGE_FORMATS='[\"bmp\"]'")
|
||||||
|
#endif()
|
||||||
|
|
||||||
## CLIENT BUILD ##
|
## CLIENT BUILD ##
|
||||||
|
|
||||||
find_package(OpenGL REQUIRED)
|
#find_package(OpenGL REQUIRED)
|
||||||
find_package(GLEW REQUIRED)
|
#find_package(GLEW REQUIRED)
|
||||||
find_package(SDL2 REQUIRED)
|
#find_package(SDL2 REQUIRED)
|
||||||
find_package(SDL2_image REQUIRED)
|
#find_package(SDL2_image REQUIRED)
|
||||||
|
|
||||||
file(GLOB_RECURSE client_src
|
file(GLOB_RECURSE client_src
|
||||||
"src/common/*.hpp"
|
"src/common/*.hpp"
|
||||||
|
@ -28,47 +29,48 @@ file(GLOB_RECURSE client_src
|
||||||
)
|
)
|
||||||
|
|
||||||
add_executable(client ${client_src})
|
add_executable(client ${client_src})
|
||||||
|
|
||||||
target_include_directories(client
|
target_include_directories(client
|
||||||
PRIVATE ${PROJECT_SOURCE_DIR}/src/common
|
PRIVATE ${PROJECT_SOURCE_DIR}/src/common
|
||||||
PRIVATE ${PROJECT_SOURCE_DIR}/src/client
|
PRIVATE ${PROJECT_SOURCE_DIR}/src/client
|
||||||
PRIVATE ${PROJECT_SOURCE_DIR}/include/client
|
PRIVATE ${PROJECT_SOURCE_DIR}/include/client)
|
||||||
PRIVATE ${OPENGL_INCLUDE_DIR}
|
#PRIVATE ${OPENGL_INCLUDE_DIR}
|
||||||
PRIVATE ${GLEW_INCLUDE_DIR}
|
#PRIVATE ${GLEW_INCLUDE_DIR}
|
||||||
PRIVATE ${SDL2_INCLUDE_DIR}
|
#PRIVATE ${SDL2_INCLUDE_DIR}
|
||||||
PRIVATE ${SDL2_IMAGE_INCLUDE_DIR})
|
#PRIVATE ${SDL2_IMAGE_INCLUDE_DIR})
|
||||||
target_link_libraries(client
|
#target_link_libraries(client
|
||||||
${OPENGL_LIBRARIES}
|
# ${OPENGL_LIBRARIES}
|
||||||
${GLEW_LIBRARY}
|
# ${GLEW_LIBRARY}
|
||||||
${SDL2_LIBRARY}
|
# ${SDL2_LIBRARY}
|
||||||
${SDL2_IMAGE_LIBRARIES})
|
# ${SDL2_IMAGE_LIBRARIES})
|
||||||
install(TARGETS client RUNTIME DESTINATION bin/client)
|
install(TARGETS client RUNTIME DESTINATION bin/client)
|
||||||
|
|
||||||
## SERVER BUILD ##
|
## SERVER BUILD ##
|
||||||
|
|
||||||
file(GLOB_RECURSE server_src
|
#file(GLOB_RECURSE server_src
|
||||||
"src/common/*.hpp"
|
# "src/common/*.hpp"
|
||||||
"src/common/*.cpp"
|
# "src/common/*.cpp"
|
||||||
"src/server/*.hpp"
|
# "src/server/*.hpp"
|
||||||
"src/server/*.cpp"
|
# "src/server/*.cpp"
|
||||||
"src/server/*.c"
|
# "src/server/*.c"
|
||||||
"src/server/*.h"
|
# "src/server/*.h"
|
||||||
)
|
#)
|
||||||
|
|
||||||
add_executable(server ${server_src})
|
#add_executable(server ${server_src})
|
||||||
target_include_directories(server
|
#target_include_directories(server
|
||||||
PRIVATE ${PROJECT_SOURCE_DIR}/src/common
|
# PRIVATE ${PROJECT_SOURCE_DIR}/src/common
|
||||||
PRIVATE ${PROJECT_SOURCE_DIR}/src/server)
|
# PRIVATE ${PROJECT_SOURCE_DIR}/src/server)
|
||||||
install(TARGETS server RUNTIME DESTINATION bin/server)
|
#install(TARGETS server RUNTIME DESTINATION bin/server)
|
||||||
|
|
||||||
## COMMON LIBRARIES ##
|
## COMMON LIBRARIES ##
|
||||||
|
|
||||||
if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
#if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
||||||
target_link_libraries(server wsock32 ws2_32)
|
# target_link_libraries(server wsock32 ws2_32)
|
||||||
target_link_libraries(client wsock32 ws2_32)
|
# target_link_libraries(client wsock32 ws2_32)
|
||||||
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
#elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
||||||
target_link_libraries(server dl pthread nsl resolv)
|
# target_link_libraries(server dl pthread nsl resolv)
|
||||||
target_link_libraries(client dl pthread nsl resolv)
|
# target_link_libraries(client dl pthread nsl resolv)
|
||||||
else()
|
#else()
|
||||||
target_link_libraries(server dl pthread socket nsl resolv)
|
# target_link_libraries(server dl pthread socket nsl resolv)
|
||||||
target_link_libraries(client dl pthread socket nsl resolv)
|
# target_link_libraries(client dl pthread socket nsl resolv)
|
||||||
endif()
|
#endif()
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
#include <SDL.h>
|
#include <SDL.h>
|
||||||
#include <glm/glm.hpp>
|
#include <GLM/glm.hpp>
|
||||||
#include <glm/gtc/matrix_transform.hpp>
|
#include <GLM/gtc/matrix_transform.hpp>
|
||||||
#define GLEW_STATIC
|
|
||||||
#include <GL/glew.h>
|
#include <GL/glew.h>
|
||||||
|
#include <emscripten.h>
|
||||||
|
|
||||||
#include "ui/font.hpp"
|
#include "ui/font.hpp"
|
||||||
#include "shaders/test.hpp"
|
#include "shaders/test.hpp"
|
||||||
|
@ -17,6 +17,11 @@ void setupOrthoMode() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void draw();
|
||||||
|
|
||||||
|
sosc::ui::Text text;
|
||||||
|
SDL_Window* window;
|
||||||
|
|
||||||
int main(int argc, char* argv[]) {
|
int main(int argc, char* argv[]) {
|
||||||
using namespace sosc;
|
using namespace sosc;
|
||||||
|
|
||||||
|
@ -26,7 +31,7 @@ int main(int argc, char* argv[]) {
|
||||||
}
|
}
|
||||||
atexit(SDL_Quit);
|
atexit(SDL_Quit);
|
||||||
|
|
||||||
auto window = SDL_CreateWindow(
|
window = SDL_CreateWindow(
|
||||||
"SockScape Client",
|
"SockScape Client",
|
||||||
SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
|
SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
|
||||||
640, 480,
|
640, 480,
|
||||||
|
@ -61,14 +66,23 @@ int main(int argc, char* argv[]) {
|
||||||
);
|
);
|
||||||
ui::font_set_default(&scapeFont);
|
ui::font_set_default(&scapeFont);
|
||||||
|
|
||||||
ui::Text text(75, glm::vec4(1, 0, 0, 1),
|
text = ui::Text(75, glm::vec4(1, 0, 0, 1), "test", 100, 100, 400);
|
||||||
"test", 100, 100, 400);
|
|
||||||
|
|
||||||
glDisable(GL_CULL_FACE);
|
glDisable(GL_CULL_FACE);
|
||||||
glDisable(GL_DEPTH_TEST);
|
glDisable(GL_DEPTH_TEST);
|
||||||
|
|
||||||
bool running = true;
|
emscripten_set_main_loop(draw, 30, 1);
|
||||||
while(running) {
|
|
||||||
|
/*ui::font_deinit_subsystem();
|
||||||
|
SDL_GL_DeleteContext(ctx);
|
||||||
|
SDL_DestroyWindow(window);*/
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void draw() {
|
||||||
|
using namespace sosc;
|
||||||
|
|
||||||
glClear(GL_COLOR_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
glClearColor(.25, .25, .25, 1);
|
glClearColor(.25, .25, .25, 1);
|
||||||
|
|
||||||
|
@ -78,8 +92,8 @@ int main(int argc, char* argv[]) {
|
||||||
|
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
while(SDL_PollEvent(&event)) {
|
while(SDL_PollEvent(&event)) {
|
||||||
if(event.type == SDL_QUIT)
|
/*if(event.type == SDL_QUIT)
|
||||||
running = false;
|
running = false;*/
|
||||||
|
|
||||||
if(event.type == SDL_WINDOWEVENT &&
|
if(event.type == SDL_WINDOWEVENT &&
|
||||||
event.window.event == SDL_WINDOWEVENT_SIZE_CHANGED)
|
event.window.event == SDL_WINDOWEVENT_SIZE_CHANGED)
|
||||||
|
@ -90,19 +104,12 @@ int main(int argc, char* argv[]) {
|
||||||
|
|
||||||
if(event.type == SDL_KEYDOWN) {
|
if(event.type == SDL_KEYDOWN) {
|
||||||
switch(event.key.keysym.sym) {
|
switch(event.key.keysym.sym) {
|
||||||
case SDLK_ESCAPE:
|
/*case SDLK_ESCAPE:
|
||||||
running = false;
|
running = false;
|
||||||
break;
|
break;*/
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
ui::font_deinit_subsystem();
|
|
||||||
SDL_GL_DeleteContext(ctx);
|
|
||||||
SDL_DestroyWindow(window);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
|
@ -2,8 +2,8 @@
|
||||||
#define SOSC_SHADER_TEST_H
|
#define SOSC_SHADER_TEST_H
|
||||||
|
|
||||||
#include <SDL.h>
|
#include <SDL.h>
|
||||||
#include <glm/glm.hpp>
|
#include <GLM/glm.hpp>
|
||||||
#include <glm/gtc/type_ptr.hpp>
|
#include <GLM/gtc/type_ptr.hpp>
|
||||||
#include "common.hpp"
|
#include "common.hpp"
|
||||||
#include "_shader.hpp"
|
#include "_shader.hpp"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue