Skip to content

Commit

Permalink
Merge pull request #2 from aleksijuvani/refresh-rate-funcs
Browse files Browse the repository at this point in the history
Add missing functions regarding display refresh rate
  • Loading branch information
LuoZijun authored Jun 5, 2019
2 parents 94cece6 + a2bc6b9 commit a3a9d0f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
6 changes: 5 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,15 @@ objc = "0.2.5"
core-foundation-sys = "0.6.2"
metal = { version = "0.14.0", features = ["private"] }

[dependencies.core-graphics]
version = "0.17.3"
optional = true

[features]
default = [ "display_link", ]
all = [ "display_link", "direct3d", "io_suface", "opengl" ]

display_link = [ "opengl", ]
display_link = [ "opengl", "core-graphics" ]
direct3d = [ ]
io_suface = [ ]
opengl = [ ]
Expand Down
15 changes: 13 additions & 2 deletions src/display_link.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
use crate::core_foundation_sys::base::CFTypeID;
use crate::{
core_foundation_sys::base::CFTypeID,
core_graphics::display::CGDirectDisplayID,
CVReturn, CVTime,
};

#[derive(Debug, Copy, Clone)]
pub enum __CVDisplayLink { }
pub type CVDisplayLinkRef = *mut __CVDisplayLink;

extern "C" {
pub fn CVDisplayLinkGetTypeID() -> CFTypeID;
}
pub fn CVDisplayLinkCreateWithCGDisplay(displayID: CGDirectDisplayID, displayLinkOut: *mut CVDisplayLinkRef) -> CVReturn;
pub fn CVDisplayLinkGetNominalOutputVideoRefreshPeriod(displayLink: CVDisplayLinkRef) -> CVTime;
pub fn CVDisplayLinkRelease(displayLink: CVDisplayLinkRef);
}
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ pub use self::metal_texture_cache::*;

cfg_if! {
if #[cfg(feature = "display_link")] {
extern crate core_graphics;

pub mod host_time;
pub mod display_link;

Expand Down

0 comments on commit a3a9d0f

Please sign in to comment.