Skip to content

Commit 717344c

Browse files
committed
Merged to master.
2 parents c44e935 + 2c66763 commit 717344c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+945
-86
lines changed
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# build the Frame code on linux and run the test
2+
# copy from https://github.com/actions/starter-workflows/blob/main/ci/cmake-single-platform.yml
3+
name: CMake on multiple platforms
4+
5+
on:
6+
push:
7+
8+
jobs:
9+
build:
10+
runs-on: ${{ matrix.os }}
11+
12+
strategy:
13+
# Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable.
14+
fail-fast: true
15+
# Matrix not used, missing windows knowledge to do build it
16+
# clang compiler not working with ubuntu because issue with std lib and clang (tested with clang15)
17+
matrix:
18+
os: [ubuntu-latest]
19+
build_type: [Release]
20+
c_compiler: [gcc]
21+
cpp_compiler: [g++]
22+
triplet: [x64-linux-release]
23+
include:
24+
- os: ubuntu-latest
25+
c_compiler: gcc
26+
cpp_compiler: g++
27+
triplet: x64-linux-release
28+
29+
steps:
30+
- name: Checkout code
31+
uses: actions/checkout@v4
32+
with:
33+
lfs: true
34+
submodules: true
35+
- name: Set reusable strings
36+
# Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file.
37+
id: strings
38+
shell: bash
39+
run: |
40+
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
41+
- name: apt install
42+
if: ${{ matrix.os == 'ubuntu-latest' }}
43+
run: |
44+
sudo apt update
45+
sudo apt install -y libxmu-dev libxi-dev libgl-dev libglx-dev libgles-dev \
46+
build-essential libx11-xcb-dev libegl1-mesa-dev libopengl-dev \
47+
libxkbcommon-dev libwayland-dev libxrandr-dev mesa-vulkan-drivers libglu1-mesa-dev libdrm-dev libegl-dev libglm-dev
48+
# the dependency list is too big but at least it works
49+
# https://packages.ubuntu.com/search
50+
- name: vcpkg build
51+
id: vcpkg
52+
uses: johnwason/vcpkg-action@v6 #cache build so improve the build time a lot
53+
with:
54+
manifest-dir: ${{ github.workspace }} # Set to directory containing vcpkg.json
55+
triplet: "${{ matrix.triplet }}"
56+
token: ${{ github.token }}
57+
github-binarycache: true
58+
cache-key: "${{ matrix.triplet }}" # TODO must use sha1 of vcpkg.json and triplet
59+
- name: Configure CMake
60+
run: >
61+
cmake -B ${{ steps.strings.outputs.build-output-dir }}
62+
-DBUILD_SKIP_CLIENT=ON
63+
${{ steps.vcpkg.outputs.vcpkg-cmake-config }}
64+
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
65+
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
66+
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
67+
-S ${{ github.workspace }} ;
68+
- name: Build
69+
# Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
70+
run: >
71+
CC="${{ matrix.c_compiler }}" CXX="${{ matrix.cpp_compiler }}" cmake
72+
--build ${{ steps.strings.outputs.build-output-dir }} --verbose -j 4
73+
- name: Show files after
74+
run: ls -ltrR ${{ github.workspace }}
75+
- name: Run tests
76+
working-directory: ${{ steps.strings.outputs.build-output-dir }}
77+
run: xvfb-run ctest --build-config ${{ matrix.build_type }}

.github/workflows/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ jobs:
2525
run: |
2626
git clone https://github.com/microsoft/vcpkg.git
2727
cd vcpkg
28+
git checkout tags/2024.02.14
2829
./bootstrap-vcpkg.bat
2930
./vcpkg integrate install
3031

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
1111
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
1212

1313
# C++ standard version.
14-
set(CMAKE_CXX_STANDARD 17)
14+
set(CMAKE_CXX_STANDARD 23)
1515
set(CMAKE_CXX_STANDARD_REQUIRED ON)
1616

1717
# Adding subfolder property.

examples/02-scene_simple/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
add_executable(02_SceneSimple
44
WIN32
55
main.cpp
6+
modal_info.h
67
${CMAKE_CURRENT_SOURCE_DIR}/../../asset/json/scene_simple.json
78
)
89

examples/02-scene_simple/main.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@
1313
#include "frame/file/file_system.h"
1414
#include "frame/file/image_stb.h"
1515
#include "frame/gui/draw_gui_factory.h"
16+
#include "frame/gui/window_logger.h"
1617
#include "frame/gui/window_resolution.h"
1718
#include "frame/window_factory.h"
19+
#include "modal_info.h"
1820

1921
// From: https://sourceforge.net/p/predef/wiki/OperatingSystems/
2022
#if defined(_WIN32) || defined(_WIN64)
@@ -39,11 +41,16 @@ try
3941
frame::RenderingAPIEnum::OPENGL,
4042
size);
4143
auto& device = win->GetDevice();
42-
auto gui_window = frame::gui::CreateDrawGui(*win.get());
44+
auto gui_window = frame::gui::CreateDrawGui(*win.get(), {}, 20.0f);
4345
auto gui_resolution = std::make_unique<frame::gui::WindowResolution>(
4446
"Resolution", size, win->GetDesktopSize(), win->GetPixelPerInch());
4547
ptr_window_resolution = gui_resolution.get();
4648
gui_window->AddWindow(std::move(gui_resolution));
49+
gui_window->AddWindow(std::make_unique<frame::gui::WindowLogger>("Logger"));
50+
// Set the main window in full.
51+
// gui_window->SetVisible(false);
52+
gui_window->AddModalWindow(
53+
std::make_unique<ModalInfo>("Info", "This is a test modal window."));
4754
win->GetDevice().AddPlugin(std::move(gui_window));
4855
frame::common::Application app(std::move(win));
4956
do

examples/02-scene_simple/modal_info.h

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#pragma once
2+
3+
#include "frame/gui/gui_window_interface.h"
4+
#include <imgui.h>
5+
6+
class ModalInfo : public frame::gui::GuiWindowInterface
7+
{
8+
public:
9+
ModalInfo(const std::string& name, const std::string& text) :
10+
name_(name), text_(text)
11+
{
12+
}
13+
bool DrawCallback() override
14+
{
15+
ImGui::TextUnformatted(text_.c_str());
16+
if (ImGui::Button("Ok"))
17+
{
18+
end_ = true;
19+
}
20+
return true;
21+
}
22+
bool End() const override
23+
{
24+
return end_;
25+
}
26+
std::string GetName() const override
27+
{
28+
return name_;
29+
}
30+
void SetName(const std::string& name) override
31+
{
32+
name_ = name;
33+
}
34+
35+
private:
36+
bool end_ = false;
37+
std::string name_;
38+
std::string text_;
39+
};

examples/04-point_cloud/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ try
5252
frame::gui::WindowResolution* ptr_window_resolution = nullptr;
5353
frame::gui::WindowCamera* ptr_window_camera = nullptr;
5454
frame::gui::WindowCubemap* ptr_window_cubemap = nullptr;
55-
auto gui_window = frame::gui::CreateDrawGui(*win.get());
55+
auto gui_window = frame::gui::CreateDrawGui(*win.get(), {}, 20.0f);
5656
{
5757
auto gui_resolution = std::make_unique<frame::gui::WindowResolution>(
5858
"Resolution", size, win->GetDesktopSize(), win->GetPixelPerInch());

include/frame/buffer_interface.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#pragma once
22

33
#include <vector>
4+
#include <cstdint>
45

56
#include "frame/name_interface.h"
67

include/frame/camera.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#pragma once
22

33
#include <array>
4+
#define GLM_ENABLE_EXPERIMENTAL
45
#include <glm/glm.hpp>
56

67
namespace frame

include/frame/common/application.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,12 @@ class Application
2222
* @param window: The unique pointer to the window (should have been
2323
* created prior).
2424
*/
25-
Application(std::unique_ptr<frame::WindowInterface>&& window);
25+
Application(std::unique_ptr<frame::WindowInterface> window);
26+
/**
27+
* @brief Get the Window object.
28+
* @return The window.
29+
*/
30+
frame::WindowInterface& GetWindow();
2631
/**
2732
* @brief Startup this will initialized the inner level of the window
2833
* according to a path.
@@ -34,7 +39,7 @@ class Application
3439
* @brief Same as previously but this use a level.
3540
* @param level: A unique pointer to a level.
3641
*/
37-
void Startup(std::unique_ptr<frame::LevelInterface>&& level);
42+
void Startup(std::unique_ptr<frame::LevelInterface> level);
3843
/**
3944
* @brief A helper function that call the inner resize of the window.
4045
* @param size: The new size of the window.

0 commit comments

Comments
 (0)