Skip to content

Commit 1314aa9

Browse files
committed
Apply the renaming also to the new opengl_underlay example pulled from master
1 parent 125b90a commit 1314aa9

File tree

7 files changed

+30
-30
lines changed

7 files changed

+30
-30
lines changed

examples/opengl_underlay/CMakeLists.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
cmake_minimum_required(VERSION 3.14)
55
project(opengl_cpp_underlay LANGUAGES CXX)
66

7-
if (NOT TARGET SixtyFPS::SixtyFPS)
8-
find_package(SixtyFPS REQUIRED)
7+
if (NOT TARGET Slint::Slint)
8+
find_package(Slint REQUIRED)
99
endif()
1010

1111
add_executable(opengl_underlay main.cpp)
12-
target_link_libraries(opengl_underlay PRIVATE SixtyFPS::SixtyFPS OpenGLES2::OpenGLES2)
13-
sixtyfps_target_60_sources(opengl_underlay scene.60)
12+
target_link_libraries(opengl_underlay PRIVATE Slint::Slint OpenGLES2::OpenGLES2)
13+
slint_target_sources(opengl_underlay scene.slint)

examples/opengl_underlay/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ path = "main.rs"
1515
name = "opengl_underlay"
1616

1717
[dependencies]
18-
sixtyfps = { path = "../../api/sixtyfps-rs" }
18+
slint = { path = "../../api/rs/slint" }
1919
glow = { version = "0.11" }
2020
instant = { version = "0.1", features = [ "now" ] }
2121

2222
[build-dependencies]
23-
sixtyfps-build = { path = "../../api/rs/build" }
23+
slint-build = { path = "../../api/rs/build" }
2424

2525
# Remove the `#wasm#` to uncomment the wasm build.
2626
# This is commented out by default because we don't want to build it as a library by default

examples/opengl_underlay/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
This example application demonstrates how layer two scenes together in a window:
44

55
1. First a graphical effect is rendered using low-level OpenGL code (underlay).
6-
2. A scene of SixtyFPS elements is rendered above.
6+
2. A scene of Slint elements is rendered above.
77

8-
This is implemented using the `set_rendering_notifier` function on the `sixtyfps::Window` type. It takes a callback as a parameter and that is invoked during different phases of the rendering. In this example the invocation during the setup phase is used to prepare the pipeline for OpenGL rendering later. Then the `BeforeRendering` phase is used to render the graphical effect with OpenGL. Afterwards, SixtyFPS will render the scene of elements into the same back-buffer as the previous OpenGL code rendered into.
8+
This is implemented using the `set_rendering_notifier` function on the `slint::Window` type. It takes a callback as a parameter and that is invoked during different phases of the rendering. In this example the invocation during the setup phase is used to prepare the pipeline for OpenGL rendering later. Then the `BeforeRendering` phase is used to render the graphical effect with OpenGL. Afterwards, Slint will render the scene of elements into the same back-buffer as the previous OpenGL code rendered into.
99

10-
Since the graphical effect is continuous, the code in the callback requests a redraw of the contents by calling `sixtyfps::Window::request_redraw()`.
10+
Since the graphical effect is continuous, the code in the callback requests a redraw of the contents by calling `slint::Window::request_redraw()`.

examples/opengl_underlay/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
// SPDX-License-Identifier: (GPL-3.0-only OR LicenseRef-SixtyFPS-commercial)
33

44
fn main() {
5-
sixtyfps_build::compile("scene.60").unwrap();
5+
slint_build::compile("scene.slint").unwrap();
66
}

examples/opengl_underlay/main.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,23 +42,23 @@ static GLint compile_shader(GLuint program, GLuint shader_type, const GLchar *co
4242
class OpenGLUnderlay
4343
{
4444
public:
45-
OpenGLUnderlay(sixtyfps::ComponentWeakHandle<App> app) : app_weak(app) { }
45+
OpenGLUnderlay(slint::ComponentWeakHandle<App> app) : app_weak(app) { }
4646

47-
void operator()(sixtyfps::RenderingState state)
47+
void operator()(slint::RenderingState state)
4848
{
4949
switch (state) {
50-
case sixtyfps::RenderingState::RenderingSetup:
50+
case slint::RenderingState::RenderingSetup:
5151
setup();
5252
break;
53-
case sixtyfps::RenderingState::BeforeRendering:
53+
case slint::RenderingState::BeforeRendering:
5454
if (auto app = app_weak.lock()) {
5555
render((*app)->get_rotation_enabled());
5656
(*app)->window().request_redraw();
5757
}
5858
break;
59-
case sixtyfps::RenderingState::AfterRendering:
59+
case slint::RenderingState::AfterRendering:
6060
break;
61-
case sixtyfps::RenderingState::RenderingTeardown:
61+
case slint::RenderingState::RenderingTeardown:
6262
teardown();
6363
break;
6464
}
@@ -153,7 +153,7 @@ class OpenGLUnderlay
153153

154154
void teardown() { glDeleteProgram(program); }
155155

156-
sixtyfps::ComponentWeakHandle<App> app_weak;
156+
slint::ComponentWeakHandle<App> app_weak;
157157
GLuint program = 0;
158158
GLuint position_location = 0;
159159
GLuint effect_time_location = 0;
@@ -167,7 +167,7 @@ int main()
167167
auto app = App::create();
168168

169169
if (auto error = app->window().set_rendering_notifier(OpenGLUnderlay(app))) {
170-
if (*error == sixtyfps::SetRenderingNotifierError::Unsupported) {
170+
if (*error == slint::SetRenderingNotifierError::Unsupported) {
171171
fprintf(stderr,
172172
"This example requires the use of the GL backend. Please run with the "
173173
"environment variable SIXTYFPS_BACKEND=GL set.\n");

examples/opengl_underlay/main.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#[cfg(target_arch = "wasm32")]
55
use wasm_bindgen::prelude::*;
66

7-
sixtyfps::include_modules!();
7+
slint::include_modules!();
88

99
use glow::HasContext;
1010

@@ -169,14 +169,14 @@ pub fn main() {
169169
// eprintln!("rendering state {:#?}", state);
170170

171171
match state {
172-
sixtyfps::RenderingState::RenderingSetup => {
172+
slint::RenderingState::RenderingSetup => {
173173
let context = match graphics_api {
174174
#[cfg(not(target_arch = "wasm32"))]
175-
sixtyfps::GraphicsAPI::NativeOpenGL { get_proc_address } => unsafe {
175+
slint::GraphicsAPI::NativeOpenGL { get_proc_address } => unsafe {
176176
glow::Context::from_loader_function(|s| get_proc_address(s))
177177
},
178178
#[cfg(target_arch = "wasm32")]
179-
sixtyfps::GraphicsAPI::WebGL { canvas_element_id, context_type } => {
179+
slint::GraphicsAPI::WebGL { canvas_element_id, context_type } => {
180180
use wasm_bindgen::JsCast;
181181

182182
let canvas = web_sys::window()
@@ -201,21 +201,21 @@ pub fn main() {
201201
};
202202
underlay = Some(EGLUnderlay::new(context))
203203
}
204-
sixtyfps::RenderingState::BeforeRendering => {
204+
slint::RenderingState::BeforeRendering => {
205205
if let (Some(underlay), Some(app)) = (underlay.as_mut(), app_weak.upgrade()) {
206206
underlay.render(app.get_rotation_enabled());
207207
app.window().request_redraw();
208208
}
209209
}
210-
sixtyfps::RenderingState::AfterRendering => {}
211-
sixtyfps::RenderingState::RenderingTeardown => {
210+
slint::RenderingState::AfterRendering => {}
211+
slint::RenderingState::RenderingTeardown => {
212212
drop(underlay.take());
213213
}
214214
_ => {}
215215
}
216216
}) {
217217
match error {
218-
sixtyfps::SetRenderingNotifierError::Unsupported => eprintln!("This example requires the use of the GL backend. Please run with the environment variable SIXTYFPS_BACKEND=GL set."),
218+
slint::SetRenderingNotifierError::Unsupported => eprintln!("This example requires the use of the GL backend. Please run with the environment variable SLINT_BACKEND=GL set."),
219219
_ => unreachable!()
220220
}
221221
std::process::exit(1);

examples/opengl_underlay/scene.60 renamed to examples/opengl_underlay/scene.slint

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
// SPDX-License-Identifier: (GPL-3.0-only OR LicenseRef-SixtyFPS-commercial)
33

44
import { ScrollView, Button, CheckBox, SpinBox, Slider, GroupBox, LineEdit, StandardListView,
5-
ComboBox, HorizontalBox, VerticalBox, GridBox, TabWidget, TextEdit, AboutSixtyFPS } from "sixtyfps_widgets.60";
5+
ComboBox, HorizontalBox, VerticalBox, GridBox, TabWidget, TextEdit, AboutSixtyFPS } from "std-widgets.slint";
66

77
App := Window {
88
preferred-width: 500px;
99
preferred-height: 600px;
10-
title: "SixtyFPS OpenGL Underlay Example";
11-
icon: @image-url("../../vscode_extension/extension-logo.png");
10+
title: "Slnt OpenGL Underlay Example";
11+
icon: @image-url("../../logo/slint-logo-square-light-128x128.png");
1212

1313
property <bool> rotation-enabled <=> apply-rotation.checked;
1414

@@ -17,7 +17,7 @@ App := Window {
1717
background: #ffffff92;
1818
HorizontalBox {
1919
Text {
20-
text: "This text is rendered using SixtyFPS. The animation below is rendered using OpenGL code.";
20+
text: "This text is rendered using Slint. The animation below is rendered using OpenGL code.";
2121
wrap: word-wrap;
2222
}
2323

0 commit comments

Comments
 (0)