Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed examples configs to lower the CPU consumption on MacOS #473

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions examples/blobs.rs
Original file line number Diff line number Diff line change
@@ -158,6 +158,8 @@ fn main() {
} else {
conf::AppleGfxApi::OpenGl
};
// mitigating high CPU consumption
conf.platform.blocking_event_loop = true;

miniquad::start(conf, move || Box::new(Stage::new()));
}
2 changes: 2 additions & 0 deletions examples/instancing.rs
Original file line number Diff line number Diff line change
@@ -179,6 +179,8 @@ fn main() {
} else {
conf::AppleGfxApi::OpenGl
};
// mitigating high CPU consumption
conf.platform.blocking_event_loop = true;

miniquad::start(conf, move || Box::new(Stage::new()));
}
2 changes: 2 additions & 0 deletions examples/offscreen.rs
Original file line number Diff line number Diff line change
@@ -221,6 +221,8 @@ fn main() {
} else {
conf::AppleGfxApi::OpenGl
};
// mitigating high CPU consumption
conf.platform.blocking_event_loop = true;

miniquad::start(conf, move || Box::new(Stage::new()));
}
2 changes: 2 additions & 0 deletions examples/quad.rs
Original file line number Diff line number Diff line change
@@ -124,6 +124,8 @@ fn main() {
conf::AppleGfxApi::OpenGl
};
conf.platform.webgl_version = conf::WebGLVersion::WebGL2;
// mitigating high CPU consumption
conf.platform.blocking_event_loop = true;

miniquad::start(conf, move || Box::new(Stage::new()));
}
2 changes: 2 additions & 0 deletions examples/triangle.rs
Original file line number Diff line number Diff line change
@@ -97,6 +97,8 @@ fn main() {
} else {
conf::AppleGfxApi::OpenGl
};
// mitigating high CPU consumption
conf.platform.blocking_event_loop = true;

miniquad::start(conf, move || Box::new(Stage::new()));
}
3 changes: 3 additions & 0 deletions examples/triangle_color4b.rs
Original file line number Diff line number Diff line change
@@ -100,6 +100,9 @@ fn main() {
} else {
conf::AppleGfxApi::OpenGl
};
// mitigating high CPU consumption
conf.platform.blocking_event_loop = true;

miniquad::start(conf, move || Box::new(Stage::new()));
}


Unchanged files with check annotations Beta

let d = native_display().lock().unwrap();
d.view
}
#[cfg(target_ios = "ios")]

Check warning on line 312 in src/lib.rs

GitHub Actions / Build (macos-latest, x86_64-apple-ios)

unexpected `cfg` condition name: `target_ios`

Check warning on line 312 in src/lib.rs

GitHub Actions / Build (macos-latest, x86_64-apple-darwin)

unexpected `cfg` condition name: `target_ios`

Check warning on line 312 in src/lib.rs

GitHub Actions / Build (macos-latest, aarch64-apple-ios)

unexpected `cfg` condition name: `target_ios`

Check warning on line 312 in src/lib.rs

GitHub Actions / Build (ubuntu-latest, x86_64-unknown-linux-gnu)

unexpected `cfg` condition name: `target_ios`

Check warning on line 312 in src/lib.rs

GitHub Actions / Build (ubuntu-latest, aarch64-unknown-linux-gnu)

unexpected `cfg` condition name: `target_ios`

Check warning on line 312 in src/lib.rs

GitHub Actions / Build (ubuntu-latest, wasm32-unknown-unknown)

unexpected `cfg` condition name: `target_ios`

Check warning on line 312 in src/lib.rs

GitHub Actions / Build (ubuntu-latest, armv7-unknown-linux-gnueabihf)

unexpected `cfg` condition name: `target_ios`

Check warning on line 312 in src/lib.rs

GitHub Actions / Build (windows-latest, x86_64-pc-windows-msvc)

unexpected `cfg` condition name: `target_ios`

Check warning on line 312 in src/lib.rs

GitHub Actions / Build (ubuntu-latest, x86_64-pc-windows-gnu)

unexpected `cfg` condition name: `target_ios`
pub fn apple_view_ctrl() -> crate::native::apple::frameworks::ObjcId {
let d = native_display().lock().unwrap();
d.view_ctrl
unsafe {
#[cfg(target_arch = "x86_64")]
SetWindowLongPtrA(self.wnd, GWL_STYLE, win_style as _);
#[cfg(target_arch = "i686")]

Check warning on line 163 in src/native/windows.rs

GitHub Actions / Build (windows-latest, x86_64-pc-windows-msvc)

unexpected `cfg` condition value: `i686`

Check warning on line 163 in src/native/windows.rs

GitHub Actions / Build (ubuntu-latest, x86_64-pc-windows-gnu)

unexpected `cfg` condition value: `i686`
SetWindowLong(self.wnd, GWL_STYLE, win_style as _);
if self.fullscreen {
fn process_request(&mut self, request: Request) {
use Request::*;
unsafe {

Check warning on line 826 in src/native/windows.rs

GitHub Actions / Build (windows-latest, x86_64-pc-windows-msvc)

unnecessary `unsafe` block

Check warning on line 826 in src/native/windows.rs

GitHub Actions / Build (ubuntu-latest, x86_64-pc-windows-gnu)

unnecessary `unsafe` block
match request {
ScheduleUpdate => {
self.update_requested = true;
} => self.set_window_size(new_width as _, new_height as _),
SetWindowPosition { new_x, new_y } => self.set_window_position(new_x, new_y),
SetFullscreen(fullscreen) => self.set_fullscreen(fullscreen),
ShowKeyboard(show) => {

Check warning on line 840 in src/native/windows.rs

GitHub Actions / Build (windows-latest, x86_64-pc-windows-msvc)

unused variable: `show`

Check warning on line 840 in src/native/windows.rs

GitHub Actions / Build (ubuntu-latest, x86_64-pc-windows-gnu)

unused variable: `show`
eprintln!("Not implemented for windows")
}
}
#[cfg(target_arch = "x86_64")]
SetWindowLongPtrA(wnd, GWLP_USERDATA, &mut display as *mut _ as isize);
#[cfg(target_arch = "i686")]

Check warning on line 919 in src/native/windows.rs

GitHub Actions / Build (windows-latest, x86_64-pc-windows-msvc)

unexpected `cfg` condition value: `i686`

Check warning on line 919 in src/native/windows.rs

GitHub Actions / Build (ubuntu-latest, x86_64-pc-windows-gnu)

unexpected `cfg` condition value: `i686`
SetWindowLong(wnd, GWLP_USERDATA, &mut display as *mut _ as isize);
let mut done = false;