@@ -70,16 +70,35 @@ MCOrientation get_orientation(UIInterfaceOrientation p_orientation)
7070 }
7171}
7272
73- MCOrientationSet get_orientation_set (uint32_t p_orientations)
73+ uint32_t get_orientation_set (uint32_t p_orientations)
7474{
75- // UNIMPLEMENTED
76- return ORIENTATION_UNKNOWN_BIT ;
75+ uint32_t t_orientations = 0 ;
76+
77+ if (p_orientations & (1 << UIInterfaceOrientationPortrait))
78+ t_orientations |= ORIENTATION_PORTRAIT_BIT ;
79+ if (p_orientations & (1 << UIInterfaceOrientationPortraitUpsideDown))
80+ t_orientations |= ORIENTATION_PORTRAIT_UPSIDE_DOWN_BIT ;
81+ if (p_orientations & (1 << kMCDisplayOrientationLandscapeRight ))
82+ t_orientations |= ORIENTATION_LANDSCAPE_RIGHT_BIT ;
83+ if (p_orientations & (1 << kMCDisplayOrientationLandscapeLeft ))
84+ t_orientations |= ORIENTATION_LANDSCAPE_LEFT_BIT ;
85+
86+ return t_orientations;
7787}
7888
79- uint32_t get_iphone_orientation (MCOrientationSet p_orientations)
89+ uint32_t get_iphone_orientations ( uint32_t p_orientations)
8090{
81- // UNIMPLEMENTED
82- return 0 ;
91+ uint32_t t_orientations = 0 ;
92+ if (p_orientations & (1 << ORIENTATION_PORTRAIT_BIT ))
93+ t_orientations |= UIInterfaceOrientationPortrait;
94+ if (p_orientations & (1 << ORIENTATION_PORTRAIT_UPSIDE_DOWN_BIT ))
95+ t_orientations |= UIInterfaceOrientationPortraitUpsideDown;
96+ if (p_orientations & (1 << ORIENTATION_LANDSCAPE_RIGHT_BIT ))
97+ t_orientations |= UIInterfaceOrientationLandscapeRight;
98+ if (p_orientations & (1 << ORIENTATION_LANDSCAPE_LEFT_BIT ))
99+ t_orientations |= UIInterfaceOrientationLandscapeLeft;
100+
101+ return t_orientations;
83102}
84103
85104void MCSystemGetDeviceOrientation (MCOrientation& r_orientation)
@@ -92,14 +111,14 @@ void MCSystemGetOrientation(MCOrientation& r_orientation)
92111 r_orientation = get_orientation (MCIPhoneGetOrientation ());
93112}
94113
95- void MCSystemGetAllowedOrientations (MCOrientationSet & r_orientations)
114+ void MCSystemGetAllowedOrientations (uint32_t & r_orientations)
96115{
97116 r_orientations = get_orientation_set ([MCIPhoneGetApplication () allowedOrientations ]);
98117}
99118
100- void MCSystemSetAllowedOrientations (MCOrientationSet p_orientations)
119+ void MCSystemSetAllowedOrientations (uint32_t p_orientations)
101120{
102- [MCIPhoneGetApplication () setAllowedOrientations: get_iphone_orientation (p_orientations)];
121+ [MCIPhoneGetApplication () setAllowedOrientations: get_iphone_orientations (p_orientations)];
103122}
104123
105124void MCSystemGetOrientationLocked (bool & r_locked)
0 commit comments