diff --git a/examples/opengl_underlay/CMakeLists.txt b/examples/opengl_underlay/CMakeLists.txt index f88a5d3093..51c0168b92 100644 --- a/examples/opengl_underlay/CMakeLists.txt +++ b/examples/opengl_underlay/CMakeLists.txt @@ -4,10 +4,10 @@ cmake_minimum_required(VERSION 3.14) project(opengl_cpp_underlay LANGUAGES CXX) -if (NOT TARGET SixtyFPS::SixtyFPS) - find_package(SixtyFPS REQUIRED) +if (NOT TARGET Slint::Slint) + find_package(Slint REQUIRED) endif() add_executable(opengl_underlay main.cpp) -target_link_libraries(opengl_underlay PRIVATE SixtyFPS::SixtyFPS OpenGLES2::OpenGLES2) -sixtyfps_target_60_sources(opengl_underlay scene.60) +target_link_libraries(opengl_underlay PRIVATE Slint::Slint OpenGLES2::OpenGLES2) +slint_target_sources(opengl_underlay scene.slint) diff --git a/examples/opengl_underlay/Cargo.toml b/examples/opengl_underlay/Cargo.toml index e2d3eee43a..d42affcb0a 100644 --- a/examples/opengl_underlay/Cargo.toml +++ b/examples/opengl_underlay/Cargo.toml @@ -15,12 +15,12 @@ path = "main.rs" name = "opengl_underlay" [dependencies] -sixtyfps = { path = "../../api/sixtyfps-rs" } +slint = { path = "../../api/rs/slint" } glow = { version = "0.11" } instant = { version = "0.1", features = [ "now" ] } [build-dependencies] -sixtyfps-build = { path = "../../api/rs/build" } +slint-build = { path = "../../api/rs/build" } # Remove the `#wasm#` to uncomment the wasm build. # This is commented out by default because we don't want to build it as a library by default diff --git a/examples/opengl_underlay/README.md b/examples/opengl_underlay/README.md index 26c869ace4..f0bf6adefa 100644 --- a/examples/opengl_underlay/README.md +++ b/examples/opengl_underlay/README.md @@ -3,8 +3,8 @@ This example application demonstrates how layer two scenes together in a window: 1. First a graphical effect is rendered using low-level OpenGL code (underlay). -2. A scene of SixtyFPS elements is rendered above. +2. A scene of Slint elements is rendered above. -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. +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. -Since the graphical effect is continuous, the code in the callback requests a redraw of the contents by calling `sixtyfps::Window::request_redraw()`. +Since the graphical effect is continuous, the code in the callback requests a redraw of the contents by calling `slint::Window::request_redraw()`. diff --git a/examples/opengl_underlay/build.rs b/examples/opengl_underlay/build.rs index 30b87282cb..09e6cbae6e 100644 --- a/examples/opengl_underlay/build.rs +++ b/examples/opengl_underlay/build.rs @@ -2,5 +2,5 @@ // SPDX-License-Identifier: (GPL-3.0-only OR LicenseRef-SixtyFPS-commercial) fn main() { - sixtyfps_build::compile("scene.60").unwrap(); + slint_build::compile("scene.slint").unwrap(); } diff --git a/examples/opengl_underlay/main.cpp b/examples/opengl_underlay/main.cpp index 6629060aa5..6113b532a3 100644 --- a/examples/opengl_underlay/main.cpp +++ b/examples/opengl_underlay/main.cpp @@ -42,23 +42,23 @@ static GLint compile_shader(GLuint program, GLuint shader_type, const GLchar *co class OpenGLUnderlay { public: - OpenGLUnderlay(sixtyfps::ComponentWeakHandle app) : app_weak(app) { } + OpenGLUnderlay(slint::ComponentWeakHandle app) : app_weak(app) { } - void operator()(sixtyfps::RenderingState state) + void operator()(slint::RenderingState state) { switch (state) { - case sixtyfps::RenderingState::RenderingSetup: + case slint::RenderingState::RenderingSetup: setup(); break; - case sixtyfps::RenderingState::BeforeRendering: + case slint::RenderingState::BeforeRendering: if (auto app = app_weak.lock()) { render((*app)->get_rotation_enabled()); (*app)->window().request_redraw(); } break; - case sixtyfps::RenderingState::AfterRendering: + case slint::RenderingState::AfterRendering: break; - case sixtyfps::RenderingState::RenderingTeardown: + case slint::RenderingState::RenderingTeardown: teardown(); break; } @@ -153,7 +153,7 @@ private: void teardown() { glDeleteProgram(program); } - sixtyfps::ComponentWeakHandle app_weak; + slint::ComponentWeakHandle app_weak; GLuint program = 0; GLuint position_location = 0; GLuint effect_time_location = 0; @@ -167,7 +167,7 @@ int main() auto app = App::create(); if (auto error = app->window().set_rendering_notifier(OpenGLUnderlay(app))) { - if (*error == sixtyfps::SetRenderingNotifierError::Unsupported) { + if (*error == slint::SetRenderingNotifierError::Unsupported) { fprintf(stderr, "This example requires the use of the GL backend. Please run with the " "environment variable SIXTYFPS_BACKEND=GL set.\n"); diff --git a/examples/opengl_underlay/main.rs b/examples/opengl_underlay/main.rs index 2c83b201f5..63ab750712 100644 --- a/examples/opengl_underlay/main.rs +++ b/examples/opengl_underlay/main.rs @@ -4,7 +4,7 @@ #[cfg(target_arch = "wasm32")] use wasm_bindgen::prelude::*; -sixtyfps::include_modules!(); +slint::include_modules!(); use glow::HasContext; @@ -169,14 +169,14 @@ pub fn main() { // eprintln!("rendering state {:#?}", state); match state { - sixtyfps::RenderingState::RenderingSetup => { + slint::RenderingState::RenderingSetup => { let context = match graphics_api { #[cfg(not(target_arch = "wasm32"))] - sixtyfps::GraphicsAPI::NativeOpenGL { get_proc_address } => unsafe { + slint::GraphicsAPI::NativeOpenGL { get_proc_address } => unsafe { glow::Context::from_loader_function(|s| get_proc_address(s)) }, #[cfg(target_arch = "wasm32")] - sixtyfps::GraphicsAPI::WebGL { canvas_element_id, context_type } => { + slint::GraphicsAPI::WebGL { canvas_element_id, context_type } => { use wasm_bindgen::JsCast; let canvas = web_sys::window() @@ -201,21 +201,21 @@ pub fn main() { }; underlay = Some(EGLUnderlay::new(context)) } - sixtyfps::RenderingState::BeforeRendering => { + slint::RenderingState::BeforeRendering => { if let (Some(underlay), Some(app)) = (underlay.as_mut(), app_weak.upgrade()) { underlay.render(app.get_rotation_enabled()); app.window().request_redraw(); } } - sixtyfps::RenderingState::AfterRendering => {} - sixtyfps::RenderingState::RenderingTeardown => { + slint::RenderingState::AfterRendering => {} + slint::RenderingState::RenderingTeardown => { drop(underlay.take()); } _ => {} } }) { match error { - sixtyfps::SetRenderingNotifierError::Unsupported => eprintln!("This example requires the use of the GL backend. Please run with the environment variable SIXTYFPS_BACKEND=GL set."), + slint::SetRenderingNotifierError::Unsupported => eprintln!("This example requires the use of the GL backend. Please run with the environment variable SLINT_BACKEND=GL set."), _ => unreachable!() } std::process::exit(1); diff --git a/examples/opengl_underlay/scene.60 b/examples/opengl_underlay/scene.slint similarity index 76% rename from examples/opengl_underlay/scene.60 rename to examples/opengl_underlay/scene.slint index c38fe028d7..4cab35384a 100644 --- a/examples/opengl_underlay/scene.60 +++ b/examples/opengl_underlay/scene.slint @@ -2,13 +2,13 @@ // SPDX-License-Identifier: (GPL-3.0-only OR LicenseRef-SixtyFPS-commercial) import { ScrollView, Button, CheckBox, SpinBox, Slider, GroupBox, LineEdit, StandardListView, - ComboBox, HorizontalBox, VerticalBox, GridBox, TabWidget, TextEdit, AboutSixtyFPS } from "sixtyfps_widgets.60"; + ComboBox, HorizontalBox, VerticalBox, GridBox, TabWidget, TextEdit, AboutSixtyFPS } from "std-widgets.slint"; App := Window { preferred-width: 500px; preferred-height: 600px; - title: "SixtyFPS OpenGL Underlay Example"; - icon: @image-url("../../vscode_extension/extension-logo.png"); + title: "Slnt OpenGL Underlay Example"; + icon: @image-url("../../logo/slint-logo-square-light-128x128.png"); property rotation-enabled <=> apply-rotation.checked; @@ -17,7 +17,7 @@ App := Window { background: #ffffff92; HorizontalBox { Text { - text: "This text is rendered using SixtyFPS. The animation below is rendered using OpenGL code."; + text: "This text is rendered using Slint. The animation below is rendered using OpenGL code."; wrap: word-wrap; }