Skip to content

Commit

Permalink
Update 1
Browse files Browse the repository at this point in the history
  • Loading branch information
TotoTota committed Oct 31, 2023
1 parent c92ee90 commit 1a501f1
Show file tree
Hide file tree
Showing 182 changed files with 171,639 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
cmake-build-debug/
cmake-build-debug-mingw/

.idea/
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "glfw"]
path = vendor/glfw
url = https://github.com/glfw/glfw
23 changes: 23 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
cmake_minimum_required(VERSION 3.5)

project(TestGlfw)

set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "GLFW lib only")
set(GLFW_BUILD_TESTS OFF CACHE BOOL "GLFW lib only")
set(GLFW_BUILD_DOCS OFF CACHE BOOL "GLFW lib only")
set(GLFW_BUILD_INSTALL OFF CACHE BOOL "GLFW lib only")
add_subdirectory(vendor/glfw)

set(CPP_FILES vendor/imgui/imgui.cpp
vendor/imgui/imgui_impl_glfw.cpp
vendor/imgui/imgui_impl_opengl3.cpp
vendor/imgui/imgui.cpp
vendor/imgui/imgui_tables.cpp
vendor/imgui/imgui_widgets.cpp
vendor/imgui/imgui_demo.cpp
vendor/imgui/imgui_draw.cpp
)

add_executable(${PROJECT_NAME} main.cpp ${CPP_FILES})

target_link_libraries(${PROJECT_NAME} glfw opengl32 ${OPENGL_LIBRARIES} ${GLFW_LIBRARIES})
70 changes: 70 additions & 0 deletions main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
#include <iostream>
#include <GLFW/glfw3.h>
#include <cmath>
#include "vendor/imgui/imgui.h"
#include "vendor/imgui/imgui_impl_glfw.h"
#include "vendor/imgui/imgui_impl_opengl3.h"

void MySaveFunction() {
ImGui::Text("Saved !");
}

int main(void)
{
GLFWwindow* window;

/* Initialize the library */
if (!glfwInit())
return -1;

/* Create a windowed mode window and its OpenGL context */
window = glfwCreateWindow(640, 480, "Hello World", NULL, NULL);
if (!window)
{
glfwTerminate();
return -1;
}

/* Make the window's context current */
glfwMakeContextCurrent(window);

IMGUI_CHECKVERSION();
ImGui::CreateContext();
ImGuiIO& io = ImGui::GetIO(); (void)io;
ImGui::StyleColorsDark();
ImGui_ImplGlfw_InitForOpenGL(window, true);
ImGui_ImplOpenGL3_Init("#version 330");

/* Loop until the user closes the window */
while (!glfwWindowShouldClose(window))
{
/* Render here */
glClear(GL_COLOR_BUFFER_BIT);

ImGui_ImplOpenGL3_NewFrame();
ImGui_ImplGlfw_NewFrame();
ImGui::NewFrame();

glBegin(GL_TRIANGLES);
glVertex2f(-0.5, -0.5);
glVertex2f(0.0, 0.5);
glVertex2f(0.5, -0.5);
glEnd();

ImGui::Render();
ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());

/* Swap front and back buffers */
glfwSwapBuffers(window);

/* Poll for and process events */
glfwPollEvents();
}

ImGui_ImplOpenGL3_Shutdown();
ImGui_ImplGlfw_Shutdown();
ImGui::DestroyContext();

glfwTerminate();
return 0;
}
Binary file added main.exe
Binary file not shown.
47 changes: 47 additions & 0 deletions vendor/glfw/.appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
image:
- Visual Studio 2015
branches:
only:
- ci
- master
- latest
- 3.3-stable
skip_tags: true
environment:
matrix:
- GENERATOR: MinGW Makefiles
BUILD_SHARED_LIBS: ON
CFLAGS: -Werror
- GENERATOR: MinGW Makefiles
BUILD_SHARED_LIBS: OFF
CFLAGS: -Werror
- GENERATOR: Visual Studio 10 2010
BUILD_SHARED_LIBS: ON
CFLAGS: /WX
- GENERATOR: Visual Studio 10 2010
BUILD_SHARED_LIBS: OFF
CFLAGS: /WX
matrix:
fast_finish: true
for:
-
matrix:
only:
- GENERATOR: MinGW Makefiles
build_script:
- set PATH=%PATH:C:\Program Files\Git\usr\bin=C:\MinGW\bin%
- cmake -S . -B build -G "%GENERATOR%" -DBUILD_SHARED_LIBS=%BUILD_SHARED_LIBS%
- cmake --build build
-
matrix:
only:
- GENERATOR: Visual Studio 10 2010
build_script:
- cmake -S . -B build -G "%GENERATOR%" -DBUILD_SHARED_LIBS=%BUILD_SHARED_LIBS%
- cmake --build build --target glfw
notifications:
- provider: Email
to:
- [email protected]
on_build_failure: true
on_build_success: false
5 changes: 5 additions & 0 deletions vendor/glfw/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*.m linguist-language=Objective-C
.gitignore export-ignore
.gitattributes export-ignore
.travis.yml export-ignore
.appveyor.yml export-ignore
10 changes: 10 additions & 0 deletions vendor/glfw/.github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

* @elmindreda

src/wl_* @linkmauve

docs/*.css @glfw/webdev
docs/*.scss @glfw/webdev
docs/*.html @glfw/webdev
docs/*.xml @glfw/webdev

94 changes: 94 additions & 0 deletions vendor/glfw/.github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
name: Build
on:
pull_request:
push:
branches: [ ci, master, latest, 3.3-stable ]
workflow_dispatch:
permissions:
statuses: write
contents: read

jobs:
build-linux-x11-clang:
name: X11 (Linux, Clang)
runs-on: ubuntu-latest
env:
CC: clang
CFLAGS: -Werror
steps:
- uses: actions/checkout@v3
- name: Install dependencies
run: |
sudo apt update
sudo apt install libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libxext-dev
- name: Configure static library
run: cmake -S . -B build-static
- name: Build static library
run: cmake --build build-static --parallel

- name: Configure shared library
run: cmake -S . -B build-shared -D BUILD_SHARED_LIBS=ON
- name: Build shared library
run: cmake --build build-shared --parallel

build-linux-full-clang:
name: X11+Wayland (Linux, Clang)
runs-on: ubuntu-latest
env:
CC: clang
CFLAGS: -Werror
steps:
- uses: actions/checkout@v3
- name: Install dependencies
run: |
sudo apt update
sudo apt install libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libxext-dev wayland-protocols libwayland-dev libxkbcommon-dev
- name: Configure static library
run: cmake -S . -B build-static -D GLFW_BUILD_WAYLAND=ON
- name: Build static library
run: cmake --build build-static --parallel

- name: Configure shared library
run: cmake -S . -B build-shared -D GLFW_BUILD_WAYLAND=ON -D BUILD_SHARED_LIBS=ON
- name: Build shared library
run: cmake --build build-shared --parallel

build-macos-cocoa-clang:
name: Cocoa (macOS, Clang)
runs-on: macos-latest
env:
CFLAGS: -Werror
MACOSX_DEPLOYMENT_TARGET: 10.8
steps:
- uses: actions/checkout@v3

- name: Configure static library
run: cmake -S . -B build-static
- name: Build static library
run: cmake --build build-static --parallel

- name: Configure shared library
run: cmake -S . -B build-shared -D BUILD_SHARED_LIBS=ON
- name: Build shared library
run: cmake --build build-shared --parallel

build-windows-win32-vs2022:
name: Win32 (Windows, VS2022)
runs-on: windows-latest
env:
CFLAGS: /WX
steps:
- uses: actions/checkout@v3

- name: Configure static library
run: cmake -S . -B build-static -G "Visual Studio 17 2022"
- name: Build static library
run: cmake --build build-static --parallel

- name: Configure shared library
run: cmake -S . -B build-shared -G "Visual Studio 17 2022" -D BUILD_SHARED_LIBS=ON
- name: Build shared library
run: cmake --build build-shared --parallel

103 changes: 103 additions & 0 deletions vendor/glfw/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
# The canonical out-of-tree build subdirectory
build

# Visual Studio clutter
_ReSharper*
*.sdf
*.suo
*.dir
*.vcxproj*
*.sln
.vs
CMakeSettings.json
Win32
x64
Debug
Release
MinSizeRel
RelWithDebInfo
*.opensdf

# Xcode clutter
GLFW.build
GLFW.xcodeproj

# macOS clutter
.DS_Store

# Makefile generator clutter
Makefile

# Ninja generator clutter
build.ninja
rules.ninja
.ninja_deps
.ninja_log

# CMake clutter
CMakeCache.txt
CMakeFiles
CMakeScripts
CMakeDoxyfile.in
CMakeDoxygenDefaults.cmake
cmake_install.cmake
cmake_uninstall.cmake

# Generated files
docs/Doxyfile
docs/html
docs/warnings.txt
docs/doxygen_sqlite3.db
src/glfw_config.h
src/glfw3.pc
src/glfw3Config.cmake
src/glfw3ConfigVersion.cmake

# Compiled binaries
src/libglfw.so
src/libglfw.so.3
src/libglfw.so.3.4
src/libglfw.dylib
src/libglfw.dylib
src/libglfw.3.dylib
src/libglfw.3.4.dylib
src/libglfw3.a
src/glfw3.lib
src/glfw3.dll
src/glfw3dll.lib
src/libglfw3dll.a
examples/*.app
examples/*.exe
examples/boing
examples/gears
examples/heightmap
examples/offscreen
examples/particles
examples/splitview
examples/sharing
examples/triangle-opengl
examples/wave
examples/windows
tests/*.app
tests/*.exe
tests/clipboard
tests/cursor
tests/empty
tests/events
tests/gamma
tests/glfwinfo
tests/icon
tests/iconify
tests/inputlag
tests/joysticks
tests/monitors
tests/msaa
tests/reopen
tests/tearing
tests/threads
tests/timeout
tests/title
tests/triangle-vulkan
tests/window
tests/windows

10 changes: 10 additions & 0 deletions vendor/glfw/.mailmap
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Camilla Löwy <[email protected]> <[email protected]>
Camilla Löwy <[email protected]> <[email protected]>
Camilla Löwy <[email protected]>

Emmanuel Gil Peyrot <[email protected]>

Marcus Geelnard <[email protected]> <[email protected]>
Marcus Geelnard <[email protected]> <marcus@geelnards-pc.(none)>
Marcus Geelnard <[email protected]>

Loading

0 comments on commit 1a501f1

Please sign in to comment.