Open basic window
This commit is contained in:
commit
fa569fad52
11 changed files with 234 additions and 0 deletions
4
.clang-format
Normal file
4
.clang-format
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
BasedOnStyle: LLVM
|
||||||
|
BreakBeforeBraces: Allman
|
||||||
|
AccessModifierOffset: -4
|
||||||
|
IndentWidth: 4
|
35
.gitignore
vendored
Normal file
35
.gitignore
vendored
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
build/
|
||||||
|
.cache
|
||||||
|
|
||||||
|
# Prerequisites
|
||||||
|
*.d
|
||||||
|
|
||||||
|
# Compiled Object files
|
||||||
|
*.slo
|
||||||
|
*.lo
|
||||||
|
*.o
|
||||||
|
*.obj
|
||||||
|
|
||||||
|
# Precompiled Headers
|
||||||
|
*.gch
|
||||||
|
*.pch
|
||||||
|
|
||||||
|
# Compiled Dynamic libraries
|
||||||
|
*.so
|
||||||
|
*.dylib
|
||||||
|
*.dll
|
||||||
|
|
||||||
|
# Fortran module files
|
||||||
|
*.mod
|
||||||
|
*.smod
|
||||||
|
|
||||||
|
# Compiled Static libraries
|
||||||
|
*.lai
|
||||||
|
*.la
|
||||||
|
*.a
|
||||||
|
*.lib
|
||||||
|
|
||||||
|
# Executables
|
||||||
|
*.exe
|
||||||
|
*.out
|
||||||
|
*.app
|
22
CMakeLists.txt
Normal file
22
CMakeLists.txt
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
cmake_minimum_required(VERSION 3.22.0)
|
||||||
|
|
||||||
|
set(PROJECT_NAME cool_project)
|
||||||
|
|
||||||
|
project(${PROJECT_NAME})
|
||||||
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||||
|
|
||||||
|
string(APPEND resources_dir "${CMAKE_CURRENT_SOURCE_DIR}/data@data")
|
||||||
|
|
||||||
|
if (EMSCRIPTEN)
|
||||||
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Oz -s USE_GLFW=3 -s ASSERTIONS=1 -s WASM=1 -s ASYNCIFY --preload-file ${resources_dir} --shell-file=\"${CMAKE_CURRENT_SOURCE_DIR}/shell.html\"")
|
||||||
|
set(CMAKE_EXECUTABLE_SUFFIX ".html")
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
file(GLOB_RECURSE PROJECT_SRC src/*.cpp src/*.hpp src/*.h)
|
||||||
|
|
||||||
|
find_package(raylib)
|
||||||
|
#find_package(spdlog)
|
||||||
|
find_package(nlohmann_json)
|
||||||
|
|
||||||
|
add_executable(${PROJECT_NAME} ${PROJECT_SRC})
|
||||||
|
target_link_libraries(${PROJECT_NAME} raylib nlohmann_json::nlohmann_json)
|
9
CMakeUserPresets.json
Normal file
9
CMakeUserPresets.json
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
{
|
||||||
|
"version": 4,
|
||||||
|
"vendor": {
|
||||||
|
"conan": {}
|
||||||
|
},
|
||||||
|
"include": [
|
||||||
|
"build\\Debug\\generators\\CMakePresets.json"
|
||||||
|
]
|
||||||
|
}
|
18
clang_profile
Normal file
18
clang_profile
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
[settings]
|
||||||
|
os=Windows
|
||||||
|
arch=x86_64
|
||||||
|
build_type=Debug
|
||||||
|
compiler=clang
|
||||||
|
compiler.version=19
|
||||||
|
compiler.cppstd=gnu17
|
||||||
|
compiler.runtime=static
|
||||||
|
compiler.runtime_type=Debug
|
||||||
|
compiler.runtime_version=v143
|
||||||
|
|
||||||
|
[buildenv]
|
||||||
|
CC=clang
|
||||||
|
CXX=clang
|
||||||
|
RC=clang
|
||||||
|
|
||||||
|
[conf]
|
||||||
|
tools.cmake.cmaketoolchain:generator=Ninja
|
21
clang_wasm
Normal file
21
clang_wasm
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
[settings]
|
||||||
|
os=Emscripten
|
||||||
|
arch=wasm
|
||||||
|
build_type=Debug
|
||||||
|
compiler=clang
|
||||||
|
compiler.version=19
|
||||||
|
compiler.cppstd=gnu17
|
||||||
|
compiler.runtime=static
|
||||||
|
compiler.runtime_type=Debug
|
||||||
|
compiler.runtime_version=v143
|
||||||
|
|
||||||
|
[buildenv]
|
||||||
|
CC=clang
|
||||||
|
CXX=clang
|
||||||
|
RC=clang
|
||||||
|
|
||||||
|
[tool_requires]
|
||||||
|
emsdk/3.1.73
|
||||||
|
|
||||||
|
[conf]
|
||||||
|
tools.cmake.cmaketoolchain:generator=Ninja
|
20
conanfile.txt
Normal file
20
conanfile.txt
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
#Anything can be here. Look for more libraries via conan search -r=all library_name
|
||||||
|
#Also you can check libs via https://conan.io/center
|
||||||
|
[requires]
|
||||||
|
raylib/5.5
|
||||||
|
#spdlog/1.15.0
|
||||||
|
nlohmann_json/3.11.3
|
||||||
|
#glm/cci.20230113
|
||||||
|
#glfw/3.4
|
||||||
|
#glew/2.2.0
|
||||||
|
#stb/cci.20240531
|
||||||
|
|
||||||
|
[options]
|
||||||
|
#blah:some_foo=True
|
||||||
|
|
||||||
|
[generators]
|
||||||
|
CMakeDeps
|
||||||
|
CMakeToolchain
|
||||||
|
|
||||||
|
[layout]
|
||||||
|
cmake_layout
|
0
data/empty
Normal file
0
data/empty
Normal file
BIN
data/img.jpg
Normal file
BIN
data/img.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 48 KiB |
85
shell.html
Normal file
85
shell.html
Normal file
|
@ -0,0 +1,85 @@
|
||||||
|
<!doctype html>
|
||||||
|
<html lang="EN-us">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
|
|
||||||
|
<title>raylib web game</title>
|
||||||
|
|
||||||
|
<meta name="title" content="raylib web game">
|
||||||
|
<meta name="description" content="New raylib web videogame, developed using raylib videogames library">
|
||||||
|
<meta name="keywords" content="raylib, programming, examples, html5, C, C++, library, learn, games, videogames">
|
||||||
|
<meta name="viewport" content="width=device-width">
|
||||||
|
|
||||||
|
<!-- Open Graph metatags for sharing -->
|
||||||
|
<meta property="og:type" content="website" />
|
||||||
|
<meta property="og:title" content="raylib web game">
|
||||||
|
<meta property="og:image:type" content="image/png">
|
||||||
|
<meta property="og:image" content="https://www.raylib.com/common/raylib_logo.png">
|
||||||
|
<meta property="og:image:alt" content="New raylib web videogame, developed using raylib videogames library" />
|
||||||
|
<meta property="og:site_name" content="raylib - example">
|
||||||
|
<meta property="og:url" content="https://www.raylib.com/games.html">
|
||||||
|
<meta property="og:description" content="New raylib web videogame, developed using raylib videogames library">
|
||||||
|
|
||||||
|
<!-- Twitter metatags for sharing -->
|
||||||
|
<meta name="twitter:card" content="summary_large_image">
|
||||||
|
<meta name="twitter:site" content="@raysan5">
|
||||||
|
<meta name="twitter:title" content="raylib web game">
|
||||||
|
<meta name="twitter:image" content="https://www.raylib.com/common/raylib_logo.png">
|
||||||
|
<meta name="twitter:image:alt" content="New raylib web videogame, developed using raylib videogames library">
|
||||||
|
<meta name="twitter:url" content="https://www.raylib.com/games.html">
|
||||||
|
<meta name="twitter:description" content="New raylib web videogame, developed using raylib videogames library">
|
||||||
|
|
||||||
|
<!-- Favicon -->
|
||||||
|
<link rel="shortcut icon" href="https://www.raylib.com/favicon.ico">
|
||||||
|
|
||||||
|
<style>
|
||||||
|
body { margin: 0px; overflow: hidden; background-color: black; }
|
||||||
|
canvas.emscripten { border: 0px none; background-color: black; }
|
||||||
|
</style>
|
||||||
|
<script type='text/javascript' src="https://cdn.jsdelivr.net/gh/eligrey/FileSaver.js/dist/FileSaver.min.js"> </script>
|
||||||
|
<script type='text/javascript'>
|
||||||
|
function saveFileFromMEMFSToDisk(memoryFSname, localFSname) // This can be called by C/C++ code
|
||||||
|
{
|
||||||
|
var isSafari = false; // Not supported, navigator.userAgent access is being restricted
|
||||||
|
//var isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
|
||||||
|
var data = FS.readFile(memoryFSname);
|
||||||
|
var blob;
|
||||||
|
|
||||||
|
if (isSafari) blob = new Blob([data.buffer], { type: "application/octet-stream" });
|
||||||
|
else blob = new Blob([data.buffer], { type: "application/octet-binary" });
|
||||||
|
|
||||||
|
// NOTE: SaveAsDialog is a browser setting. For example, in Google Chrome,
|
||||||
|
// in Settings/Advanced/Downloads section you have a setting:
|
||||||
|
// 'Ask where to save each file before downloading' - which you can set true/false.
|
||||||
|
// If you enable this setting it would always ask you and bring the SaveAsDialog
|
||||||
|
saveAs(blob, localFSname);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<canvas class=emscripten id=canvas oncontextmenu=event.preventDefault() tabindex=-1></canvas>
|
||||||
|
<p id="output" />
|
||||||
|
<script>
|
||||||
|
var Module = {
|
||||||
|
print: (function() {
|
||||||
|
var element = document.getElementById('output');
|
||||||
|
if (element) element.value = ''; // clear browser cache
|
||||||
|
return function(text) {
|
||||||
|
if (arguments.length > 1) text = Array.prototype.slice.call(arguments).join(' ');
|
||||||
|
console.log(text);
|
||||||
|
if (element) {
|
||||||
|
element.value += text + "\n";
|
||||||
|
element.scrollTop = element.scrollHeight; // focus on bottom
|
||||||
|
}
|
||||||
|
};
|
||||||
|
})(),
|
||||||
|
canvas: (function() {
|
||||||
|
var canvas = document.getElementById('canvas');
|
||||||
|
return canvas;
|
||||||
|
})()
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
{{{ SCRIPT }}}
|
||||||
|
</body>
|
||||||
|
</html>
|
20
src/main.cpp
Normal file
20
src/main.cpp
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
#include <raylib.h>
|
||||||
|
|
||||||
|
int main (int argc, char *argv[])
|
||||||
|
{
|
||||||
|
auto img = LoadImage("data/img.jpg");
|
||||||
|
|
||||||
|
InitWindow(img.width, img.height, "");
|
||||||
|
SetTargetFPS(60);
|
||||||
|
|
||||||
|
while (!WindowShouldClose())
|
||||||
|
{
|
||||||
|
BeginDrawing();
|
||||||
|
ClearBackground(WHITE);
|
||||||
|
EndDrawing();
|
||||||
|
}
|
||||||
|
|
||||||
|
CloseWindow();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in a new issue