Skip to content

Commit e5df2a8

Browse files
committed
feat: add samples for the frontend demonstration
1 parent 930d617 commit e5df2a8

File tree

13 files changed

+498
-1
lines changed

13 files changed

+498
-1
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#////////////////////////////////////////////////////////////////////////////////////////////////////
2+
#// Copyright (c) 2025 RacoonStudios
3+
#//
4+
#// Permission is hereby granted, free of charge, to any person obtaining a copy of this
5+
#// software and associated documentation files (the "Software"), to deal in the Software
6+
#// without restriction, including without limitation the rights to use, copy, modify, merge,
7+
#// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
8+
#// to whom the Software is furnished to do so, subject to the following conditions:
9+
#//
10+
#// The above copyright notice and this permission notice shall be included in all copies or
11+
#// substantial portions of the Software.
12+
#//
13+
#// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
14+
#// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
15+
#// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
16+
#// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
17+
#// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
18+
#// DEALINGS IN THE SOFTWARE.
19+
#////////////////////////////////////////////////////////////////////////////////////////////////////
20+
21+
22+
##################################################
23+
## Project
24+
##################################################
25+
re_add_target(
26+
NAME 10_frontend EXECUTABLE
27+
NAMESPACE RE
28+
FILES_CMAKE
29+
${CMAKE_CURRENT_SOURCE_DIR}/frontend_files.cmake
30+
PLATFORM_INCLUDE_FILES
31+
${CMAKE_CURRENT_SOURCE_DIR}/frontend_${PAL_PLATFORM_NAME_LOWERCASE}.cmake
32+
INCLUDE_DIRECTORIES
33+
PUBLIC
34+
${ME_CONFIG_FILE_LOCATION}
35+
${CMAKE_CURRENT_SOURCE_DIR}/public
36+
${CMAKE_CURRENT_SOURCE_DIR}/private
37+
BUILD_DEPENDENCIES
38+
PUBLIC
39+
core
40+
COMPILE_DEFINITIONS
41+
PUBLIC
42+
${${PAL_PLATFORM_NAME_UPPERCASE}_COMPILE_DEFS}
43+
${PAL_PLATFORM_NAME_UPPERCASE}
44+
TARGET_PROPERTIES
45+
-fPIC
46+
)
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#////////////////////////////////////////////////////////////////////////////////////////////////////
2+
#// Copyright (c) 2025 RacoonStudios
3+
#//
4+
#// Permission is hereby granted, free of charge, to any person obtaining a copy of this
5+
#// software and associated documentation files (the "Software"), to deal in the Software
6+
#// without restriction, including without limitation the rights to use, copy, modify, merge,
7+
#// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
8+
#// to whom the Software is furnished to do so, subject to the following conditions:
9+
#//
10+
#// The above copyright notice and this permission notice shall be included in all copies or
11+
#// substantial portions of the Software.
12+
#//
13+
#// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
14+
#// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
15+
#// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
16+
#// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
17+
#// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
18+
#// DEALINGS IN THE SOFTWARE.
19+
#////////////////////////////////////////////////////////////////////////////////////////////////////
20+
21+
22+
set(FILES
23+
private/main.cpp
24+
private/application.cpp
25+
)
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#////////////////////////////////////////////////////////////////////////////////////////////////////
2+
#// Copyright (c) 2025 RacoonStudios
3+
#//
4+
#// Permission is hereby granted, free of charge, to any person obtaining a copy of this
5+
#// software and associated documentation files (the "Software"), to deal in the Software
6+
#// without restriction, including without limitation the rights to use, copy, modify, merge,
7+
#// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
8+
#// to whom the Software is furnished to do so, subject to the following conditions:
9+
#//
10+
#// The above copyright notice and this permission notice shall be included in all copies or
11+
#// substantial portions of the Software.
12+
#//
13+
#// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
14+
#// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
15+
#// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
16+
#// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
17+
#// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
18+
#// DEALINGS IN THE SOFTWARE.
19+
#////////////////////////////////////////////////////////////////////////////////////////////////////
20+
21+
22+
set(RE_BUILD_DEPENDENCIES
23+
# PUBLIC
24+
pthread
25+
dl
26+
atomic
27+
ncurses
28+
${LINUX_X11_LIBS}
29+
${DBUS_LIBRARIES}
30+
stdc++fs
31+
)
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
////////////////////////////////////////////////////////////////////////////////////////////////////
2+
// Copyright (c) 2025 RacoonStudios
3+
//
4+
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
5+
// software and associated documentation files (the "Software"), to deal in the Software
6+
// without restriction, including without limitation the rights to use, copy, modify, merge,
7+
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
8+
// to whom the Software is furnished to do so, subject to the following conditions:
9+
//
10+
// The above copyright notice and this permission notice shall be included in all copies or
11+
// substantial portions of the Software.
12+
//
13+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
14+
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
15+
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
16+
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
17+
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
18+
// DEALINGS IN THE SOFTWARE.
19+
////////////////////////////////////////////////////////////////////////////////////////////////////
20+
21+
22+
//[-------------------------------------------------------]
23+
//[ Includes ]
24+
//[-------------------------------------------------------]
25+
#include "application.h"
26+
#include <core/frontend/cursor_device.h>
27+
#include <core/frontend/window_device.h>
28+
29+
30+
//[-------------------------------------------------------]
31+
//[ Classes ]
32+
//[-------------------------------------------------------]
33+
Application::Application() {
34+
35+
}
36+
37+
Application::~Application() {
38+
39+
}
40+
41+
void Application::main() {
42+
printf("Hello Frontend\n");
43+
44+
printf("Creating a new window now\n");
45+
core::WindowCreateDesc windowCreateDesc;
46+
windowCreateDesc.title = "Some window";
47+
windowCreateDesc.shape = core::Recti(100, 100, 800, 600);
48+
windowCreateDesc.windowStyle = core::EWindowStyle::WindowStyle_NoBorder;
49+
50+
auto window = get_window_device()->create_window(windowCreateDesc);
51+
52+
while (window && get_window_device()->get_num_windows() > 0) {
53+
core::FrontendApplication::on_update();
54+
}
55+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
////////////////////////////////////////////////////////////////////////////////////////////////////
2+
// Copyright (c) 2025 RacoonStudios
3+
//
4+
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
5+
// software and associated documentation files (the "Software"), to deal in the Software
6+
// without restriction, including without limitation the rights to use, copy, modify, merge,
7+
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
8+
// to whom the Software is furnished to do so, subject to the following conditions:
9+
//
10+
// The above copyright notice and this permission notice shall be included in all copies or
11+
// substantial portions of the Software.
12+
//
13+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
14+
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
15+
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
16+
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
17+
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
18+
// DEALINGS IN THE SOFTWARE.
19+
////////////////////////////////////////////////////////////////////////////////////////////////////
20+
21+
22+
//[-------------------------------------------------------]
23+
//[ Includes ]
24+
//[-------------------------------------------------------]
25+
#include <core/main.h>
26+
#include "application.h"
27+
28+
29+
//[-------------------------------------------------------]
30+
//[ Program entry point ]
31+
//[-------------------------------------------------------]
32+
// This is the real entry point for any RacoonEngine executable. You must define this function if you
33+
// include <PLCore/Main.h> in your project. The parameters passed by the engine into this function
34+
// are self-explanatory.
35+
int be_main(const core::String &sExecutableFilename, const core::Vector<core::String> &lstArguments) {
36+
// We just create an instance of our very basic application class and run it. This will result
37+
// in the engine being initialized into usable state and the above Application::Main method
38+
// being called. Note that only the very essential engine systems are initialized, such as log
39+
// and plugin system. We will explore the initialization of more advanced systems (such as renderer)
40+
// in future exercise.
41+
Application cApplication;
42+
return cApplication.run(sExecutableFilename, lstArguments);
43+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
////////////////////////////////////////////////////////////////////////////////////////////////////
2+
// Copyright (c) 2025 RacoonStudios
3+
//
4+
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
5+
// software and associated documentation files (the "Software"), to deal in the Software
6+
// without restriction, including without limitation the rights to use, copy, modify, merge,
7+
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
8+
// to whom the Software is furnished to do so, subject to the following conditions:
9+
//
10+
// The above copyright notice and this permission notice shall be included in all copies or
11+
// substantial portions of the Software.
12+
//
13+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
14+
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
15+
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
16+
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
17+
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
18+
// DEALINGS IN THE SOFTWARE.
19+
////////////////////////////////////////////////////////////////////////////////////////////////////
20+
21+
22+
//[-------------------------------------------------------]
23+
//[ Header guard ]
24+
//[-------------------------------------------------------]
25+
#pragma once
26+
27+
28+
//[-------------------------------------------------------]
29+
//[ Includes ]
30+
//[-------------------------------------------------------]
31+
#include <core/frontend/frontend_application.h>
32+
33+
34+
//[-------------------------------------------------------]
35+
//[ Classes ]
36+
//[-------------------------------------------------------]
37+
class Application : public core::FrontendApplication {
38+
public:
39+
40+
Application();
41+
42+
~Application() override;
43+
44+
public:
45+
46+
void main() override;
47+
};
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#////////////////////////////////////////////////////////////////////////////////////////////////////
2+
#// Copyright (c) 2025 RacoonStudios
3+
#//
4+
#// Permission is hereby granted, free of charge, to any person obtaining a copy of this
5+
#// software and associated documentation files (the "Software"), to deal in the Software
6+
#// without restriction, including without limitation the rights to use, copy, modify, merge,
7+
#// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
8+
#// to whom the Software is furnished to do so, subject to the following conditions:
9+
#//
10+
#// The above copyright notice and this permission notice shall be included in all copies or
11+
#// substantial portions of the Software.
12+
#//
13+
#// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
14+
#// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
15+
#// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
16+
#// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
17+
#// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
18+
#// DEALINGS IN THE SOFTWARE.
19+
#////////////////////////////////////////////////////////////////////////////////////////////////////
20+
21+
22+
##################################################
23+
## Project
24+
##################################################
25+
re_add_target(
26+
NAME 11_frontend_multiwindow EXECUTABLE
27+
NAMESPACE RE
28+
FILES_CMAKE
29+
${CMAKE_CURRENT_SOURCE_DIR}/frontend_files.cmake
30+
PLATFORM_INCLUDE_FILES
31+
${CMAKE_CURRENT_SOURCE_DIR}/frontend_${PAL_PLATFORM_NAME_LOWERCASE}.cmake
32+
INCLUDE_DIRECTORIES
33+
PUBLIC
34+
${ME_CONFIG_FILE_LOCATION}
35+
${CMAKE_CURRENT_SOURCE_DIR}/public
36+
${CMAKE_CURRENT_SOURCE_DIR}/private
37+
BUILD_DEPENDENCIES
38+
PUBLIC
39+
core
40+
COMPILE_DEFINITIONS
41+
PUBLIC
42+
${${PAL_PLATFORM_NAME_UPPERCASE}_COMPILE_DEFS}
43+
${PAL_PLATFORM_NAME_UPPERCASE}
44+
TARGET_PROPERTIES
45+
-fPIC
46+
)
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#////////////////////////////////////////////////////////////////////////////////////////////////////
2+
#// Copyright (c) 2025 RacoonStudios
3+
#//
4+
#// Permission is hereby granted, free of charge, to any person obtaining a copy of this
5+
#// software and associated documentation files (the "Software"), to deal in the Software
6+
#// without restriction, including without limitation the rights to use, copy, modify, merge,
7+
#// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
8+
#// to whom the Software is furnished to do so, subject to the following conditions:
9+
#//
10+
#// The above copyright notice and this permission notice shall be included in all copies or
11+
#// substantial portions of the Software.
12+
#//
13+
#// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
14+
#// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
15+
#// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
16+
#// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
17+
#// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
18+
#// DEALINGS IN THE SOFTWARE.
19+
#////////////////////////////////////////////////////////////////////////////////////////////////////
20+
21+
22+
set(FILES
23+
private/main.cpp
24+
private/application.cpp
25+
)
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#////////////////////////////////////////////////////////////////////////////////////////////////////
2+
#// Copyright (c) 2025 RacoonStudios
3+
#//
4+
#// Permission is hereby granted, free of charge, to any person obtaining a copy of this
5+
#// software and associated documentation files (the "Software"), to deal in the Software
6+
#// without restriction, including without limitation the rights to use, copy, modify, merge,
7+
#// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
8+
#// to whom the Software is furnished to do so, subject to the following conditions:
9+
#//
10+
#// The above copyright notice and this permission notice shall be included in all copies or
11+
#// substantial portions of the Software.
12+
#//
13+
#// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
14+
#// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
15+
#// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
16+
#// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
17+
#// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
18+
#// DEALINGS IN THE SOFTWARE.
19+
#////////////////////////////////////////////////////////////////////////////////////////////////////
20+
21+
22+
set(RE_BUILD_DEPENDENCIES
23+
# PUBLIC
24+
pthread
25+
dl
26+
atomic
27+
ncurses
28+
${LINUX_X11_LIBS}
29+
${DBUS_LIBRARIES}
30+
stdc++fs
31+
)

0 commit comments

Comments
 (0)