mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-13 09:35:23 -04:00
ios: autosize servers, WIP landscape orientation support
This commit is contained in:
parent
9965ea5c4e
commit
9d81f4a175
@ -180,7 +180,7 @@ static void LScreen_DrawBackground(struct LScreen* s, struct Bitmap* bmp) {
|
|||||||
|
|
||||||
Launcher_DrawBackgroundAll(bmp);
|
Launcher_DrawBackgroundAll(bmp);
|
||||||
DrawTextArgs_Make(&args, &title_fore, &Launcher_LogoFont, false);
|
DrawTextArgs_Make(&args, &title_fore, &Launcher_LogoFont, false);
|
||||||
x = WindowInfo.Width / 2 - Drawer2D_TextWidth(&args) / 2;
|
x = bmp->width / 2 - Drawer2D_TextWidth(&args) / 2;
|
||||||
|
|
||||||
args.text = title_back;
|
args.text = title_back;
|
||||||
Drawer2D_DrawText(bmp, &args, x + Display_ScaleX(4), Display_ScaleY(4));
|
Drawer2D_DrawText(bmp, &args, x + Display_ScaleX(4), Display_ScaleY(4));
|
||||||
|
@ -53,6 +53,13 @@ static void RemoveTouch(UITouch* t) {
|
|||||||
Input_RemoveTouch((long)t, loc.x, loc.y);
|
Input_RemoveTouch((long)t, loc.x, loc.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static cc_bool landscape_locked;
|
||||||
|
static UIInterfaceOrientationMask SupportedOrientations(void) {
|
||||||
|
if (landscape_locked)
|
||||||
|
return UIInterfaceOrientationMaskLandscape;
|
||||||
|
return UIInterfaceOrientationMaskAll;
|
||||||
|
}
|
||||||
|
|
||||||
@implementation CCWindow
|
@implementation CCWindow
|
||||||
|
|
||||||
//- (void)drawRect:(CGRect)dirty { DoDrawFramebuffer(dirty); }
|
//- (void)drawRect:(CGRect)dirty { DoDrawFramebuffer(dirty); }
|
||||||
@ -76,12 +83,14 @@ static void RemoveTouch(UITouch* t) {
|
|||||||
- (BOOL)isOpaque { return YES; }
|
- (BOOL)isOpaque { return YES; }
|
||||||
@end
|
@end
|
||||||
|
|
||||||
static cc_bool landscape_locked;
|
|
||||||
@implementation CCViewController
|
@implementation CCViewController
|
||||||
- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
|
- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
|
||||||
if (landscape_locked)
|
return SupportedOrientations();
|
||||||
return UIInterfaceOrientationMaskLandscape;
|
}
|
||||||
return [super supportedInterfaceOrientations];
|
|
||||||
|
- (BOOL)shouldAutorotate {
|
||||||
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*- (BOOL)prefersStatusBarHidden {
|
/*- (BOOL)prefersStatusBarHidden {
|
||||||
@ -134,6 +143,10 @@ static cc_bool landscape_locked;
|
|||||||
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
|
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
|
||||||
// TODO implement somehow, prob need a variable in Program.c
|
// TODO implement somehow, prob need a variable in Program.c
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (UIInterfaceOrientationMask)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window {
|
||||||
|
return SupportedOrientations();
|
||||||
|
}
|
||||||
@end
|
@end
|
||||||
|
|
||||||
int main(int argc, char * argv[]) {
|
int main(int argc, char * argv[]) {
|
||||||
@ -300,7 +313,7 @@ void Window_DrawFramebuffer(Rect2D r) {
|
|||||||
rect.origin.y = WindowInfo.Height - r.Y - r.Height;
|
rect.origin.y = WindowInfo.Height - r.Y - r.Height;
|
||||||
rect.size.width = r.Width;
|
rect.size.width = r.Width;
|
||||||
rect.size.height = r.Height;
|
rect.size.height = r.Height;
|
||||||
win_handle.layer.contents = CFBridgingRelease(CGBitmapContextCreateImage(win_ctx));
|
view_handle.layer.contents = CFBridgingRelease(CGBitmapContextCreateImage(win_ctx));
|
||||||
// TODO always redraws entire launcher which is quite terrible performance wise
|
// TODO always redraws entire launcher which is quite terrible performance wise
|
||||||
//[win_handle setNeedsDisplayInRect:rect];
|
//[win_handle setNeedsDisplayInRect:rect];
|
||||||
}
|
}
|
||||||
@ -824,10 +837,15 @@ void LBackend_SliderDraw(struct LSlider* w) {
|
|||||||
*#########################################################################################################################*/
|
*#########################################################################################################################*/
|
||||||
void LBackend_TableInit(struct LTable* w) {
|
void LBackend_TableInit(struct LTable* w) {
|
||||||
UITableView* tbl = [[UITableView alloc] init];
|
UITableView* tbl = [[UITableView alloc] init];
|
||||||
tbl.frame = CGRectMake(0, 50, 350, 570);
|
//tbl.frame = CGRectMake(0, 50, 350, 570);
|
||||||
tbl.delegate = ui_controller;
|
tbl.delegate = ui_controller;
|
||||||
tbl.dataSource = ui_controller;
|
tbl.dataSource = ui_controller;
|
||||||
|
|
||||||
|
//[tbl registerClass:UITableViewCell.class forCellReuseIdentifier:cellID];
|
||||||
|
|
||||||
|
CGRect total = [view_handle frame];
|
||||||
|
tbl.frame = CGRectMake(0, 0, total.size.width - 10, total.size.height - 50 - 50);
|
||||||
|
|
||||||
AssignView(w, tbl);
|
AssignView(w, tbl);
|
||||||
UpdateWidgetDimensions(w);
|
UpdateWidgetDimensions(w);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user