Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upAndroid support #70
Comments
icefoxen
added
enhancement
*GOOD FIRST ISSUE*
labels
May 9, 2017
This comment has been minimized.
This comment has been minimized.
|
Reference for how to make it go, maybe: https://github.com/tanis2000/minigame-rust |
This comment has been minimized.
This comment has been minimized.
|
Apparently getting glium to work on Android is not actually that hard: https://twitter.com/ozkriff/status/889014729884172289 |
icefoxen
added
*HARD*
and removed
*GOOD FIRST ISSUE*
labels
Jul 31, 2017
This comment has been minimized.
This comment has been minimized.
TatriX
commented
Oct 9, 2017
|
I'm trying to build a |
This comment has been minimized.
This comment has been minimized.
|
Good luck! Let me know if you get it to work! I will help with anything I can but I really know nothing about Android programming. Trying out the glium fork of 0.3.3 might be worth a go. |
This comment has been minimized.
This comment has been minimized.
TatriX
commented
Oct 9, 2017
|
I compiled the code. Sigh. Current error:
|
This comment has been minimized.
This comment has been minimized.
TatriX
commented
Oct 9, 2017
|
It seems that
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Copied from the above app-dirs-rs issue:
Basically, Android has its own thoughts about where data should be stored and supporting that looks like it might take adding another I predict the next error will be sound initialization, since Thennnnnnn... maybe it will work? |
This comment has been minimized.
This comment has been minimized.
TatriX
commented
Oct 9, 2017
|
I hacked the code, a bit, and managed to bypass filesystem module. |
This comment has been minimized.
This comment has been minimized.
|
Don't go insane, we need your brain intact! It does occur to me that this would be easier if ggez had a more modular structure like Love2D does, where you can enable or disable individual modules. Then you could just start with everything disabled, get that working, and turn things on one piece at a time as you make them work. That sort of structure wouldn't be HARD to do but would require extra indirection and error-checking, which is why I didn't do it in the first place. Hmmmm. |
This comment has been minimized.
This comment has been minimized.
TatriX
commented
Oct 10, 2017
|
Current state of the art: Currently I'm trying to figure out how can I break decency cycle. |
This comment has been minimized.
This comment has been minimized.
TatriX
commented
Oct 10, 2017
|
Basically now I need a |
This comment has been minimized.
This comment has been minimized.
|
Woohoo! What do you need the latest sdl2 for? I am not aware of any huge changes in it for mobile support. Maybe there are though? We're on the latest published version of So. If you need |
This comment has been minimized.
This comment has been minimized.
TatriX
commented
Oct 10, 2017
|
To make sdl work on android I have to use
It's the only way now. |
This comment has been minimized.
This comment has been minimized.
tanis2000
commented
Oct 10, 2017
|
@TatriX I haven't yet had a chance of looking at the code of ggez, but if you're not using the TextureCreator to manage textures you don't need the Even the code of my minigame would work without that now as I'm loading the textures in memory through What's ggez using to manage textures? Would you ever need to keep a copy of the textures in memory instead of spooling them off to the GPU? |
This comment has been minimized.
This comment has been minimized.
TatriX
commented
Oct 10, 2017
|
I think I've tried stripped version of the minigame without actual code, just sdl init, and it also failed with sdl_image not beeing resolved. Probably I should try again. |
This comment has been minimized.
This comment has been minimized.
|
ggez doesn't use SDL for drawing or image loading, so you should be able to cut those out if possible. |
This comment has been minimized.
This comment has been minimized.
TatriX
commented
Oct 10, 2017
|
@tanis2000 could you please take a simple example like this and try to run it on your mobile? |
This comment has been minimized.
This comment has been minimized.
tanis2000
commented
Oct 10, 2017
|
@icefoxen @TatriX what's the plan for mobile support? Would you like to have ggez do all the packaging or would you prefer to let the game project take care of that? They're two completely different approaches, both with pro and cons and I guess it's better to have a clear idea before attempting to do anything. |
This comment has been minimized.
This comment has been minimized.
TatriX
commented
Oct 10, 2017
|
I'm okay with minigame approach. Call required stuff like |
This comment has been minimized.
This comment has been minimized.
|
@tanis2000 I honestly have no idea because I don't know what the pros and cons of each are. :-/ My reflex is to make the game project take care of that so that we have to include a minimum of platform-specific scaffolding in ggez itself, and then have very good documentation/demo projects for people to use to get started.
Sorry, I missed this question. ggez manages textures via letting gfx-rs's OpenGL backend manage them, which basically means they end up as an |
This comment has been minimized.
This comment has been minimized.
TatriX
commented
Oct 20, 2017
|
Ok, so I
pub struct GlBackendSpec {
#[default = r#"2"#]
major: u8,
#[default = r#"0"#]
minor: u8,
}
use std::ffi::CString;
fn log(msg: &str) {
let message = CString::new(msg).unwrap();
unsafe {
SDL_Log(message.into_raw());
};
}
#[no_mangle]
#[allow(non_snake_case)]
pub extern "C" fn SDL_main() -> i32 {
log("rust start");
use std::panic;
panic::set_hook(Box::new(|pi| {
log(&format!("Custom panic hook {:?}", pi.location()));
}));
let result = panic::catch_unwind(|| ggez_test::run());
if let Err(e) = result {
let ref msg = if let Some(e) = e.downcast_ref::<&'static str>() {
format!("Got an error: {}", e)
} else if let Some(e) = e.downcast_ref::<String>() {
format!("Got an error: {}", e)
} else {
format!("Got an unknown error: {:?}", e)
};
log(msg);
} else {
log("rust clear exit")
}
0
}
#[cfg(target_os="android")]
extern "C" {
fn SDL_Log(fmt: *const ::std::os::raw::c_char, ...);
}and now my error is:
|
This comment has been minimized.
This comment has been minimized.
TatriX
commented
Oct 20, 2017
|
Aslo my device reports that is supports |
This comment has been minimized.
This comment has been minimized.
|
OpenGL and OpenGL ES are entirely separate beasts, as far as the spec and driver is concerned; the version numbers don't even line up nicely with each other, IIRC ES 2.0 is about equivalent to OpenGL 3.0, and ES 3.0 is most similar to OpenGL 4.2 or something. It's stupid. You are going to have to tell SDL to request OpenGL ES specifically, try changing the IIRC, ES 2.0 also doesn't support instancing, which will probably break pretty much all the rendering and shaders now that drawing a single object is basically implemented as drawing a single-item |
This comment has been minimized.
This comment has been minimized.
TatriX
commented
Oct 20, 2017
•
|
Using
|
This comment has been minimized.
This comment has been minimized.
TatriX
commented
Oct 20, 2017
|
Maybe it's somehow related to https://github.com/Rust-SDL2/rust-sdl2/tree/unsafe-textures-feature |
This comment has been minimized.
This comment has been minimized.
seivan
commented
Oct 2, 2018
|
I guess a lot of things has changed since switching to winit? |
This comment has been minimized.
This comment has been minimized.
|
@seivan I know literally nothing about iOS but I'm actually working with someone who does on this off and on. Does indeed look like there's some resource-y things that need ironing out. |
This comment has been minimized.
This comment has been minimized.
|
...wait, that's you. Derp. It really just depends on what iOS's limitations are. If we have access to specific directories via normal file system calls, we need to make sure ggez tries to read/write to only those directories. If we need to use a particular filesystem API to access things, we need to make it do that. (I THINK this is what Android does.) If things actually do need to be part of the same .exe file, then we need to implement the functionality to handle that, probably doing something along the lines of what #469 describes. I don't know enough about iOS to say more. I should man up and do some research. :/ |
This comment has been minimized.
This comment has been minimized.
|
Using |
This comment has been minimized.
This comment has been minimized.
|
A typical experience, like the third one this week:
|
This comment has been minimized.
This comment has been minimized.
|
On iOS, this appears to be a blocking bug: RustAudio/cpal#224 There may be others, though. |
This comment has been minimized.
This comment has been minimized.
tanis2000
commented
Jan 17, 2019
|
@icefoxen yes, if you're using CPAL, you have to wait until they actually support iOS. They added macOS support and probably forgot that iOS is a completely different beast. |
icefoxen commentedMay 9, 2017
Should happen eventually!