Skip to content

Commit

Permalink
[General] macos bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
yummydev committed Aug 1, 2020
1 parent 2e3c24a commit e8bac8b
Show file tree
Hide file tree
Showing 8 changed files with 8,913 additions and 7,568 deletions.
16,444 changes: 8,884 additions & 7,560 deletions raylib-sys/bindings_osx.rs

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion raylib-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,10 @@ fn gen_bindings() {
fn gen_rgui() {
// Compile the code and link with cc crate
cc::Build::new()
.file("rgui_wrapper.cpp")
.file("rgui_wrapper.c")
.include(".")
.warnings(false)
// .flag("-std=c99")
.extra_warnings(false)
.compile("rgui");
}
Expand Down
11 changes: 11 additions & 0 deletions raylib-sys/rgui_wrapper.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#include "raylib.h"
#define RLIGHTS_IMPLEMENTATION
#define RICONS_IMPLEMENTATION
#define RAYGUI_IMPLEMENTATION
#define RAYGUI_SUPPORT_ICONS
#define RLGL_IMPLEMENTATION
#define RLGL_SUPPORT_TRACELOG
// #include "rlgl.h" // Don't include rlgl since it's in raylib
#include "raygui.h"
#undef RAYGUI_IMPLEMENTATION
#include "rlights.h"
4 changes: 3 additions & 1 deletion raylib-sys/rgui_wrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
#define RAYGUI_SUPPORT_ICONS
#define RLGL_IMPLEMENTATION
#define RLGL_SUPPORT_TRACELOG
#include "rlgl.h"
#ifndef __APPLE__
#include "rlgl.h"
#endif
#include "raygui.h"
#include "rlights.h"
3 changes: 3 additions & 0 deletions raylib-sys/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
include!(concat!(env!("OUT_DIR"), "/bindings.rs"));

#[cfg(target_os = "macos")]
pub const MAX_MATERIAL_MAPS: u32 = 12;
10 changes: 6 additions & 4 deletions showcase/src/example/controls_test_suite/controls_test_suite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ use std::ffi::CString;
pub fn run(rl: &mut RaylibHandle, thread: &RaylibThread) {
// Initialization
//---------------------------------------------------------------------------------------
let screenWidth = 690;
let screenHeight = 560;

rl.set_window_size(screenWidth, screenHeight);
#[cfg(not(target_os = "macos"))] { // Macos has issues with high DPI
let screenWidth = 690;
let screenHeight = 560;

rl.set_window_size(screenWidth, screenHeight);
}

// GUI controls initialization
//----------------------------------------------------------------------------------
Expand Down
2 changes: 2 additions & 0 deletions showcase/src/example/others/mod.rs
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
#[cfg(not(target_os = "macos"))]
pub mod rlgl_standalone;

4 changes: 2 additions & 2 deletions showcase/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ fn main() {

rl.set_exit_key(None);
// example::others::rlgl_standalone::run(&mut rl, &thread);
// example::controls_test_suite::controls_test_suite::run(&mut rl, &thread);
example::models::models_material_pbr::run(&mut rl, &thread);
example::controls_test_suite::controls_test_suite::run(&mut rl, &thread);
// example::models::models_material_pbr::run(&mut rl, &thread);

// let samples = &[example::core::core_2d_camera::run];
// let mut sample = None;
Expand Down

0 comments on commit e8bac8b

Please sign in to comment.