Skip to content

Commit 0c4140d

Browse files
authored
Merge pull request #9 from enlightware/master
Updated dependencies and fixed cargo clippy warnings
2 parents ac44c5a + 02aa614 commit 0c4140d

86 files changed

Lines changed: 1218 additions & 1230 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Generated by Cargo
22
# will have compiled files and executables
3-
/target/
3+
/target
44
/examples/target/
55
/serialize_test/
66
.vscode

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ exclude = [
1919
[dependencies]
2020
bitflags = "2.2.1"
2121
serde = {version = "1.0.163", features = ["derive"], optional = true}
22-
strum = {version = "0.24.1", optional = true}
23-
strum_macros = {version ="0.24.3", optional = true}
22+
strum = {version = "0.27.2", optional = true}
23+
strum_macros = {version ="0.27.2", optional = true}
2424

2525
[features]
2626
serde_support = ["serde", "strum", "strum_macros"]

examples/testbed/main_loop.rs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ pub struct System {
3131
pub imgui: Context,
3232
pub platform: WinitPlatform,
3333
pub renderer: Renderer,
34-
pub font_size: f32,
34+
// pub font_size: f32,
3535
pub(crate) s_settings: Settings,
3636
}
3737

@@ -102,7 +102,7 @@ pub fn init(title: &str) -> System {
102102
imgui,
103103
platform,
104104
renderer,
105-
font_size,
105+
// font_size,
106106
s_settings,
107107
}
108108
}
@@ -174,16 +174,16 @@ impl System {
174174
target.clear_color(0.2, 0.2, 0.2, 1.0);
175175
platform.prepare_render(&ui, gl_window.window());
176176

177-
if g_debug_draw.borrow().m_show_ui
178-
{
177+
if g_debug_draw.borrow().m_show_ui
178+
{
179179
s_test.borrow().get_base().borrow_mut().draw_title(
180180
&ui,
181181
&format!(
182182
"{0} : {1}",
183183
g_test_entries[s_settings.m_test_index as usize].category,
184184
g_test_entries[s_settings.m_test_index as usize].name
185185
),
186-
);
186+
);
187187
}
188188

189189
s_test.borrow_mut().step(
@@ -245,7 +245,7 @@ impl System {
245245
device_id: _,
246246
is_synthetic: _,
247247
} => {
248-
if input.state == ElementState::Pressed
248+
if input.state == ElementState::Pressed
249249
{
250250
match input.virtual_keycode {
251251
Some(VirtualKeyCode::Escape) => {
@@ -329,8 +329,8 @@ impl System {
329329
Some(VirtualKeyCode::P) => {
330330
s_settings.m_pause = !s_settings.m_pause;
331331
},
332-
Some(VirtualKeyCode::LBracket) => {
333-
// Switch to previous test
332+
Some(VirtualKeyCode::LBracket) => {
333+
// Switch to previous test
334334
if s_settings.m_test_index==0 {
335335
s_settings.m_test_index = g_test_entries.len()-1;
336336
}else{
@@ -359,9 +359,9 @@ impl System {
359359
d.m_show_ui = !d.m_show_ui;
360360
},
361361
_ => {},
362-
}
363-
}
364-
s_test.borrow_mut().keyboard(input);
362+
}
363+
}
364+
s_test.borrow_mut().keyboard(input);
365365
}
366366
WindowEvent::CloseRequested => *control_flow = ControlFlow::Exit,
367367
_ => (),
@@ -394,7 +394,7 @@ impl System {
394394
s_test: TestPtr<D, F>,
395395
cursor_position: PhysicalPosition<f64>,
396396
g_camera: &mut Camera,
397-
button: &MouseButton,
397+
button: &MouseButton,
398398
action: &ElementState,
399399
mods: &ModifiersState,
400400
s_right_mouse_down: &mut bool,
@@ -419,7 +419,7 @@ impl System {
419419
s_test.borrow_mut().mouse_down(pw);
420420
}
421421
}
422-
422+
423423
if *action == ElementState::Released
424424
{
425425
s_test.borrow_mut().mouse_up(pw);
@@ -428,7 +428,7 @@ impl System {
428428
else if *button == MouseButton::Right
429429
{
430430
if *action == ElementState::Pressed
431-
{
431+
{
432432
*s_click_point_ws = g_camera.convert_screen_to_world(ps);
433433
*s_right_mouse_down = true;
434434
}
@@ -440,7 +440,7 @@ impl System {
440440
}
441441
}
442442

443-
fn mouse_motion_callback<'a, D: UserDataType, F: Facade>(s_test: TestPtr<D, F>,
443+
fn mouse_motion_callback<'a, D: UserDataType, F: Facade>(s_test: TestPtr<D, F>,
444444
g_camera: &mut Camera, position: &PhysicalPosition<f64>,
445445
s_right_mouse_down: &mut bool,
446446
s_click_point_ws: &mut B2vec2)
@@ -449,7 +449,7 @@ impl System {
449449

450450
let pw: B2vec2 = g_camera.convert_screen_to_world(ps);
451451
s_test.borrow_mut().mouse_move(pw);
452-
452+
453453
if *s_right_mouse_down
454454
{
455455
let diff: B2vec2 = pw - *s_click_point_ws;
@@ -501,7 +501,7 @@ impl System {
501501
ui.slider_config("Vel Iters", 0, 50)
502502
.display_format("%d")
503503
.build(&mut s_settings.m_velocity_iterations);
504-
504+
505505
ui.slider_config("Pos Iter", 0, 50)
506506
.display_format("%d")
507507
.build(&mut s_settings.m_position_iterations);
@@ -516,7 +516,7 @@ impl System {
516516
ui.checkbox("Warm Starting", &mut s_settings.m_enable_warm_starting);
517517
ui.checkbox("Time of Impact", &mut s_settings.m_enable_continuous);
518518
ui.checkbox("Sub-Stepping", &mut s_settings.m_enable_sub_stepping);
519-
519+
520520
ui.separator();
521521

522522
ui.checkbox("Shapes", &mut s_settings.m_draw_shapes);

examples/testbed/test.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ pub(crate) fn random_float_range(lo: f32, hi: f32) -> f32 {
3838
// This is called when a joint in the world is implicitly destroyed
3939
// because an attached body is destroyed. This gives us a chance to
4040
// nullify the mouse joint.
41-
pub(crate)struct B2testDestructionListenerDefault<D: UserDataType>
41+
pub(crate)struct B2testDestructionListenerDefault<D: UserDataType>
4242
{
4343
pub(crate) base: TestBasePtrWeak<D>,
4444
}
@@ -80,10 +80,10 @@ pub(crate) struct ContactPoint<D: UserDataType> {
8080
pub(crate) state: B2pointState,
8181
pub(crate) normal_impulse: f32,
8282
pub(crate) tangent_impulse: f32,
83-
pub(crate) separation: f32,
83+
// pub(crate) separation: f32,
8484
}
8585

86-
pub(crate)struct B2testContactListenerDefault<D: UserDataType>
86+
pub(crate)struct B2testContactListenerDefault<D: UserDataType>
8787
{
8888
pub(crate) base: TestBasePtrWeak<D>,
8989
}
@@ -108,7 +108,7 @@ pub(crate) type TestPtr<D,F> = Rc<RefCell<dyn TestDyn<D,F>>>;
108108
pub(crate) trait TestDyn<D: UserDataType, F:Facade>
109109
{
110110
fn get_base(&self) -> TestBasePtr<D>;
111-
111+
112112
fn step(&mut self, ui: &imgui::Ui, display: &F, target: &mut glium::Frame, settings: &mut Settings, camera: &mut Camera);
113113
fn update_ui(&mut self, _ui: &imgui::Ui) {}
114114
fn keyboard(&mut self, key: &KeyboardInput) {
@@ -129,17 +129,22 @@ pub(crate) trait TestDyn<D: UserDataType, F:Facade>
129129
fn launch_bomb_rand(&mut self) {
130130
private::launch_bomb_rand(&mut self.get_base().borrow_mut());
131131
}
132+
133+
#[allow(dead_code)]
132134
fn launch_bomb(&mut self, position: B2vec2, velocity: B2vec2) {
133135
private::launch_bomb(&mut self.get_base().borrow_mut(), position, velocity);
134136
}
137+
#[allow(dead_code)]
135138
fn spawn_bomb(&mut self, world_pt: B2vec2) {
136139
private::spawn_bomb(&mut self.get_base().borrow_mut(), world_pt);
137140
}
141+
#[allow(dead_code)]
138142
fn complete_bomb_spawn(&mut self, p: B2vec2) {
139143
private::complete_bomb_spawn(&mut self.get_base().borrow_mut(), p);
140144
}
141145

142146
// Let derived tests know that a joint was destroyed.
147+
#[allow(dead_code)]
143148
fn joint_destroyed(&mut self, joint: B2jointPtr<D>) {
144149
b2_not_used(joint);
145150
}

examples/testbed/test_private.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ pub(crate) fn pre_solve<D: UserDataType>(
6363
state: state2[i],
6464
normal_impulse: manifold.points[i].normal_impulse,
6565
tangent_impulse: manifold.points[i].tangent_impulse,
66-
separation: world_manifold.separations[i],
66+
// separation: world_manifold.separations[i],
6767
});
6868
}
6969
}
@@ -117,7 +117,7 @@ pub(crate) fn mouse_down<D: UserDataType>(self_: &mut Test<D>, p: B2vec2) {
117117
{
118118
let frequency_hz: f32 = 5.0;
119119
let damping_ratio: f32 = 0.7;
120-
120+
121121
jd = B2mouseJointDef {
122122
base: B2jointDef {
123123
jtype: B2jointType::EMouseJoint,

examples/testbed/tests/rope.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ impl<D: UserDataType, F: Facade> TestDyn<D, F> for Rope<D> {
139139
.build(|| {
140140
ui.separator();
141141
//TODO_humman sys::igGetWindowWidth()
142-
let width_token = ui.push_item_width(200.0 * 0.5);
142+
let _width_token = ui.push_item_width(200.0 * 0.5);
143143

144144
let bend_models = ["Spring", "PBD Ang", "XPBD Ang", "PBD Dist", "PBD Height", "PBD Triangle"];
145145
let stretch_models = ["PBD", "XPBD"];
@@ -171,7 +171,7 @@ impl<D: UserDataType, F: Facade> TestDyn<D, F> for Rope<D> {
171171
}
172172
_ => {}
173173
}
174-
}
174+
}
175175
}
176176

177177
ui.slider_config("Damping##B1", 0.0, 4.0)
@@ -255,7 +255,7 @@ impl<D: UserDataType, F: Facade> TestDyn<D, F> for Rope<D> {
255255
*bend_model2 = B2bendingModel::B2PbdHeightBendingModel;
256256
}
257257
_ => {}
258-
}
258+
}
259259
}
260260
}
261261
ui.slider_config("Damping##B2", 0.0, 4.0)
@@ -268,7 +268,7 @@ impl<D: UserDataType, F: Facade> TestDyn<D, F> for Rope<D> {
268268

269269
ui.slider_config("Stiffness##B2", 0.0, 1.0)
270270
.display_format("%.1f")
271-
.build(&mut self.m_tuning2.bend_stiffness);
271+
.build(&mut self.m_tuning2.bend_stiffness);
272272

273273
ui.checkbox(
274274
"Isometric##2",
@@ -287,7 +287,7 @@ impl<D: UserDataType, F: Facade> TestDyn<D, F> for Rope<D> {
287287
let stretch_model2 = &mut self.m_tuning2.stretching_model;
288288
let mut stretch_model2_selected: usize = *stretch_model2 as usize;
289289
if ui.combo_simple_string("Stretch Model##2", &mut stretch_model2_selected, &stretch_models) {
290-
290+
291291
match stretch_model2_selected {
292292
0 => {
293293
*stretch_model2 = B2stretchingModel::B2PbdStretchingModel;
@@ -297,7 +297,7 @@ impl<D: UserDataType, F: Facade> TestDyn<D, F> for Rope<D> {
297297
}
298298
_ => {}
299299
}
300-
300+
301301

302302
}
303303
}
@@ -330,11 +330,11 @@ impl<D: UserDataType, F: Facade> TestDyn<D, F> for Rope<D> {
330330
self.m_rope1.reset(self.m_position1);
331331
self.m_rope2.reset(self.m_position2);
332332
}
333-
333+
334334
//TODO_humman fix
335335
//width_token.pop(ui);
336-
});
337-
336+
});
337+
338338
}
339339
fn keyboard(&mut self, key: &KeyboardInput) {
340340
match key.virtual_keycode {

0 commit comments

Comments
 (0)