WOWCube Docs logo
WOWCube Docs
Mission Control
Section Shortcuts
APIExamplesSourceWOWConnectChangelog
Filters
SDK and language defaults persist in cookies.
SDK version
Navigation Tree
Collapsed by default, focused on the active path.
Made byMcKay Seamons
GitHub
  1. Home
  2. Docs
  3. Examples
  4. cubeapp.rs
Mission NodeSDK 6.3RustbasicsProject Included

cubeapp.rs

Example: cubeapp.rs

Examples / SDK 6.3 / Rust / basics / Getting Started / project / src
cubeapp.rs
RUST
1// This file is generated by WOWCube SDK project wizard
2//
3// Application UUID: 4Q5Ol6v-cL
4//
5
6use wowcube_sdk::application::{AppErr, Application, ApplicationContext, Mappable};
7
8use wowcube_sdk::cubios;
9use wowcube_sdk::cubios::{gfx, topology};
10
11const TEXT_SIZE: u32 = 10;
12
13#[derive(Default)]
14pub struct HelloWOWCube {
15 initialized: bool,
16 app_context: ApplicationContext,
17}
18
19impl HelloWOWCube {
20 pub fn new() -> Self {
21 HelloWOWCube::default()
22 }
23}
24
25impl Mappable for HelloWOWCube {}
26
27impl Application for HelloWOWCube {
28 fn app_context_mut(&mut self) -> &mut ApplicationContext {
29 &mut self.app_context
30 }
31
32 fn on_render(&self) -> Result<(), AppErr> {
33 if !self.initialized {
34 return Ok(());
35 }
36 // iterate through screens
37 self.get_twist();
38 for screen in 0..3 {
39 gfx::set_render_target(screen as u8);
40
41 gfx::clear(0xff000000); // TODO: Colors::Black
42
43 gfx::draw_text(
44 120,
45 100,
46 TEXT_SIZE,
47 0,
48 cubios::TextAlign::Center,
49 0xffffffff as u32,
50 "HELLO",
51 );
52 gfx::draw_text(
53 120,
54 140,
55 TEXT_SIZE,
56 0,
57 cubios::TextAlign::Center,
58 0xffffffff as u32,
59 "WOWCUBE",
60 );
61
62 gfx::render();
63 }
64
65 Ok(())
66 }
67
68 fn on_init(&mut self) -> Result<(), AppErr> {
69 self.initialized = true;
70
71 Ok(())
72 }
73
74 fn on_tick(&mut self) -> Result<(), AppErr> {
75 if !self.initialized {
76 self.on_init()?;
77 }
78
79 Ok(())
80 }
81}
82
Wrapped for easier reading. Turn wrap off to inspect exact line lengths.
Context Rail

Project files

This section gets modified automatically to match the settings of your project
project/Cargo.toml
cubeapp.rs
project/src/cubeapp.rs
main.rs
project/src/main.rs
wowcubeapp-build.json
project/wowcubeapp-build.json
Context Rail

Related nodes

main.rs
Examples / SDK 6.3 / Rust / basics / Getting Started / project / src
Getting Started
Examples / SDK 6.3 / Rust / basics
info.json
Examples / SDK 6.3 / Rust / basics / Getting Started
This section gets modified automatically to match the settings of your project
Examples / SDK 6.3 / Rust / basics / Getting Started / project
Previous Node
This section gets modified automatically to match the settings of your project
Examples / SDK 6.3 / Rust / basics / Getting Started / project
Next Node
main.rs
Examples / SDK 6.3 / Rust / basics / Getting Started / project / src