Skip to content

Commit

Permalink
Merge pull request #297 from freesig/2018
Browse files Browse the repository at this point in the history
2018
  • Loading branch information
mitchmindtree authored May 1, 2019
2 parents 2a6886b + f752a33 commit 27464de
Show file tree
Hide file tree
Showing 168 changed files with 11,365 additions and 7,536 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ keywords = ["creative", "sketch", "graphics", "audio"]
license = "MIT"
repository = "https://github.com/MindBuffer/nannou.git"
homepage = "https://github.com/MindBuffer/nannou"
edition = "2018"

[dependencies]
approx = "0.1"
Expand Down
68 changes: 25 additions & 43 deletions examples/all_functions.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
extern crate nannou;

use nannou::prelude::*;

fn main() {
Expand Down Expand Up @@ -42,16 +40,19 @@ fn model(app: &App) -> Model {

fn event(_app: &App, _model: &mut Model, event: Event) {
match event {
Event::WindowEvent { id: _, raw: _, simple: _ } => {}
Event::WindowEvent {
id: _,
raw: _,
simple: _,
} => {}
Event::DeviceEvent(_device_id, _event) => {}
Event::Update(_dt) => {}
Event::Awakened => {}
Event::Suspended(_b) => {}
}
}

fn update(_app: &App, _model: &mut Model, _update: Update) {
}
fn update(_app: &App, _model: &mut Model, _update: Update) {}

fn view(_app: &App, _model: &Model, frame: Frame) -> Frame {
frame.clear(DARK_BLUE);
Expand Down Expand Up @@ -81,59 +82,40 @@ fn window_event(_app: &App, _model: &mut Model, event: WindowEvent) {
}
}

fn raw_window_event(_app: &App, _model: &mut Model, _event: nannou::winit::WindowEvent) {
}
fn raw_window_event(_app: &App, _model: &mut Model, _event: nannou::winit::WindowEvent) {}

fn key_pressed(_app: &App, _model: &mut Model, _key: Key) {
}
fn key_pressed(_app: &App, _model: &mut Model, _key: Key) {}

fn key_released(_app: &App, _model: &mut Model, _key: Key) {
}
fn key_released(_app: &App, _model: &mut Model, _key: Key) {}

fn mouse_moved(_app: &App, _model: &mut Model, _pos: Point2) {
}
fn mouse_moved(_app: &App, _model: &mut Model, _pos: Point2) {}

fn mouse_pressed(_app: &App, _model: &mut Model, _button: MouseButton) {
}
fn mouse_pressed(_app: &App, _model: &mut Model, _button: MouseButton) {}

fn mouse_released(_app: &App, _model: &mut Model, _button: MouseButton) {
}
fn mouse_released(_app: &App, _model: &mut Model, _button: MouseButton) {}

fn mouse_wheel(_app: &App, _model: &mut Model, _dt: MouseScrollDelta, _phase: TouchPhase) {
}
fn mouse_wheel(_app: &App, _model: &mut Model, _dt: MouseScrollDelta, _phase: TouchPhase) {}

fn mouse_entered(_app: &App, _model: &mut Model) {
}
fn mouse_entered(_app: &App, _model: &mut Model) {}

fn mouse_exited(_app: &App, _model: &mut Model) {
}
fn mouse_exited(_app: &App, _model: &mut Model) {}

fn touch(_app: &App, _model: &mut Model, _touch: TouchEvent) {
}
fn touch(_app: &App, _model: &mut Model, _touch: TouchEvent) {}

fn touchpad_pressure(_app: &App, _model: &mut Model, _pressure: TouchpadPressure) {
}
fn touchpad_pressure(_app: &App, _model: &mut Model, _pressure: TouchpadPressure) {}

fn window_moved(_app: &App, _model: &mut Model, _pos: Point2) {
}
fn window_moved(_app: &App, _model: &mut Model, _pos: Point2) {}

fn window_resized(_app: &App, _model: &mut Model, _dim: Vector2) {
}
fn window_resized(_app: &App, _model: &mut Model, _dim: Vector2) {}

fn window_focused(_app: &App, _model: &mut Model) {
}
fn window_focused(_app: &App, _model: &mut Model) {}

fn window_unfocused(_app: &App, _model: &mut Model) {
}
fn window_unfocused(_app: &App, _model: &mut Model) {}

fn window_closed(_app: &App, _model: &mut Model) {
}
fn window_closed(_app: &App, _model: &mut Model) {}

fn hovered_file(_app: &App, _model: &mut Model, _path: std::path::PathBuf) {
}
fn hovered_file(_app: &App, _model: &mut Model, _path: std::path::PathBuf) {}

fn hovered_file_cancelled(_app: &App, _model: &mut Model) {
}
fn hovered_file_cancelled(_app: &App, _model: &mut Model) {}

fn dropped_file(_app: &App, _model: &mut Model, _path: std::path::PathBuf) {
}
fn dropped_file(_app: &App, _model: &mut Model, _path: std::path::PathBuf) {}
5 changes: 1 addition & 4 deletions examples/basics/1_nannou_events.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
extern crate nannou;

use nannou::prelude::*;

// Every rust program has to have a main function which gets called when the program is run.
Expand All @@ -20,8 +18,7 @@ fn model(app: &App) -> Model {
}

// Update the state of your application here. By default, this gets called right before `view`.
fn update(_app: &App, _model: &mut Model, _update: Update) {
}
fn update(_app: &App, _model: &mut Model, _update: Update) {}

// We can also update the application based on events received by the window like key presses and
// mouse movement here.
Expand Down
2 changes: 0 additions & 2 deletions examples/basics/2_variables_window_console.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
extern crate nannou;

use nannou::prelude::*;

fn main() {
Expand Down
2 changes: 0 additions & 2 deletions examples/basics/3_variable_scope.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
extern crate nannou;

use nannou::prelude::*;

// This is how you make a global constant value.
Expand Down
2 changes: 0 additions & 2 deletions examples/basics/4_conditionals.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
extern crate nannou;

use nannou::prelude::*;

fn main() {
Expand Down
2 changes: 0 additions & 2 deletions examples/basics/5_loops.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
extern crate nannou;

use nannou::prelude::*;

fn main() {
Expand Down
2 changes: 0 additions & 2 deletions examples/basics/6_functions.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
extern crate nannou;

use nannou::prelude::*;

fn main() {
Expand Down
4 changes: 1 addition & 3 deletions examples/basics/7_modules/7_modules.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
extern crate nannou;

use nannou::prelude::*;

mod ball;
use ball::Ball;
use crate::ball::Ball;

fn main() {
nannou::app(model).update(update).simple_window(view).run();
Expand Down
1 change: 0 additions & 1 deletion examples/basics/7_modules/ball.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
extern crate nannou;
use nannou::prelude::*;

pub struct Ball {
Expand Down
2 changes: 0 additions & 2 deletions examples/generative_design/color/p_1_0_01.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@
* s : save png
*/

extern crate nannou;

use nannou::prelude::*;

fn main() {
Expand Down
3 changes: 2 additions & 1 deletion examples/generative_design/color/p_1_1_01.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
extern crate nannou;



use nannou::prelude::*;

Expand Down
2 changes: 0 additions & 2 deletions examples/generative_design/color/p_1_2_3_01.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
* s : save png
* c : save color palette
*/
extern crate nannou;

use nannou::prelude::*;

fn main() {
Expand Down
1 change: 0 additions & 1 deletion examples/generative_design/color/p_1_2_3_02.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
* s : save png
* c : save color palette
*/
extern crate nannou;
use nannou::prelude::*;

fn main() {
Expand Down
20 changes: 13 additions & 7 deletions examples/laser/laser_frame_stream.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
//! A simple example demonstrating how to use draw various patterns via a laser frame streams.
extern crate nannou;

use nannou::prelude::*;

fn main() {
Expand Down Expand Up @@ -42,14 +40,19 @@ fn model(app: &App) -> Model {
.unwrap();

// Initialise the state that we want to live on the laser thread and spawn the stream.
let laser_model = Laser { test_pattern: TestPattern::Rectangle };
let laser_model = Laser {
test_pattern: TestPattern::Rectangle,
};
let laser_api = lasy::Lasy::new();
let laser_stream = laser_api
.new_frame_stream(laser_model, laser)
.build()
.unwrap();

Model { laser_api, laser_stream }
Model {
laser_api,
laser_stream,
}
}

fn laser(laser: &mut Laser, frame: &mut lasy::Frame) {
Expand Down Expand Up @@ -143,9 +146,12 @@ fn key_pressed(_app: &App, model: &mut Model, key: Key) {
Key::Key6 => TestPattern::Spiral,
_ => return,
};
model.laser_stream.send(|laser| {
laser.test_pattern = new_pattern;
}).unwrap();
model
.laser_stream
.send(|laser| {
laser.test_pattern = new_pattern;
})
.unwrap();
}

fn view(_app: &App, _model: &Model, frame: Frame) -> Frame {
Expand Down
Loading

0 comments on commit 27464de

Please sign in to comment.