mirror of
https://github.com/touchHLE/touchHLE.git
synced 2026-01-31 01:25:24 +01:00
Implement stub for [UIFont systemFontOfSize:]
This commit is contained in:
@@ -10,6 +10,7 @@ use crate::export_c_func;
|
||||
pub mod ui_accelerometer;
|
||||
pub mod ui_application;
|
||||
pub mod ui_device;
|
||||
pub mod ui_font;
|
||||
pub mod ui_nib;
|
||||
pub mod ui_responder;
|
||||
pub mod ui_screen;
|
||||
|
||||
33
src/frameworks/uikit/ui_font.rs
Normal file
33
src/frameworks/uikit/ui_font.rs
Normal file
@@ -0,0 +1,33 @@
|
||||
//! `UIFont`.
|
||||
|
||||
use crate::frameworks::core_graphics::CGFloat;
|
||||
use crate::objc::{autorelease, id, objc_classes, ClassExports, HostObject};
|
||||
|
||||
struct UIFontHostObject {
|
||||
_size: CGFloat,
|
||||
}
|
||||
impl HostObject for UIFontHostObject {}
|
||||
|
||||
pub const CLASSES: ClassExports = objc_classes! {
|
||||
|
||||
(env, this, _cmd);
|
||||
|
||||
// For now this is a singleton (the only instance is returned by mainScreen),
|
||||
// so there are hardcoded assumptions related to that.
|
||||
@implementation UIFont: NSObject
|
||||
|
||||
+ (id)systemFontOfSize:(CGFloat)font_size {
|
||||
// TODO: actually load and render fonts
|
||||
let new = env.objc.alloc_object(
|
||||
this,
|
||||
Box::new(UIFontHostObject {
|
||||
_size: font_size,
|
||||
}),
|
||||
&mut env.mem
|
||||
);
|
||||
autorelease(env, new)
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
};
|
||||
@@ -24,6 +24,7 @@ pub const CLASS_LISTS: &[super::ClassExports] = &[
|
||||
opengles::eagl::CLASSES,
|
||||
uikit::ui_accelerometer::CLASSES,
|
||||
uikit::ui_application::CLASSES,
|
||||
uikit::ui_font::CLASSES,
|
||||
uikit::ui_nib::CLASSES,
|
||||
uikit::ui_responder::CLASSES,
|
||||
uikit::ui_screen::CLASSES,
|
||||
|
||||
Reference in New Issue
Block a user