本文整理汇总了Java中org.robovm.apple.coregraphics.CGSize.width方法的典型用法代码示例。如果您正苦于以下问题:Java CGSize.width方法的具体用法?Java CGSize.width怎么用?Java CGSize.width使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.robovm.apple.coregraphics.CGSize
的用法示例。
在下文中一共展示了CGSize.width方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: showAds
import org.robovm.apple.coregraphics.CGSize; //导入方法依赖的package包/类
public void showAds() {
initializeAds();
final CGSize screenSize = UIScreen.getMainScreen().getBounds().size();
double screenWidth = screenSize.height();
double screenHeight = screenSize.width();
final CGSize adSize = adview.getBounds().size();
double adWidth = adSize.width();
double adHeight = adSize.height();
log.debug(String.format("Hidding ad. size[%s, %s]", adWidth, adHeight));
float bannerWidth = (float) screenWidth;
float bannerHeight = (float) (bannerWidth / adWidth * adHeight);
log.debug(String.format("%s, %s, %s", screenWidth, screenHeight, bannerHeight));
adview.setFrame(new CGRect(0,
screenHeight - bannerHeight,
bannerWidth, bannerHeight));
}
示例2: hideAds
import org.robovm.apple.coregraphics.CGSize; //导入方法依赖的package包/类
@Override
public void hideAds() {
initializeAds();
final CGSize screenSize = UIScreen.getMainScreen().getBounds().size();
double screenWidth = screenSize.width();
final CGSize adSize = adview.getBounds().size();
double adWidth = adSize.width();
double adHeight = adSize.height();
float bannerWidth = (float) screenWidth;
float bannerHeight = (float) (bannerWidth / adWidth * adHeight);
adview.setFrame(
new CGRect(0, -bannerHeight, bannerWidth, bannerHeight));
}
示例3: show
import org.robovm.apple.coregraphics.CGSize; //导入方法依赖的package包/类
@Override
public void show() {
initializeAds();
final CGSize screenSize = UIScreen.getMainScreen().getBounds().size();
double screenWidth = screenSize.width();
final CGSize adSize = adview.getBounds().size();
double adWidth = adSize.width();
double adHeight = adSize.height();
float bannerWidth = (float) screenWidth;
float bannerHeight = (float) (bannerWidth / adWidth * adHeight);
adview.setFrame(new CGRect((screenWidth / 2) - adWidth / 2, 0,
bannerWidth, bannerHeight));
}
示例4: showAds
import org.robovm.apple.coregraphics.CGSize; //导入方法依赖的package包/类
@Override
public void showAds() {
initializeAds();
final CGSize screenSize = UIScreen.getMainScreen().getBounds().size();
double screenWidth = screenSize.width();
final CGSize adSize = adview.getBounds().size();
double adWidth = adSize.width();
double adHeight = adSize.height();
float bannerWidth = (float) screenWidth;
float bannerHeight = (float) (bannerWidth / adWidth * adHeight);
adview.setFrame(new CGRect((screenWidth / 2) - adWidth / 2, 0,
bannerWidth, bannerHeight));
}
示例5: didRotate
import org.robovm.apple.coregraphics.CGSize; //导入方法依赖的package包/类
@Override
public void didRotate (UIInterfaceOrientation orientation) {
super.didRotate(orientation);
// get the view size and update graphics
// FIXME: supporting BOTH (landscape+portrait at same time) is
// currently not working correctly (needs fix)
// FIXME screen orientation needs to be stored for
// Input#getNativeOrientation
CGSize bounds = app.getBounds(this);
graphics.width = (int)bounds.width();
graphics.height = (int)bounds.height();
graphics.makeCurrent();
app.listener.resize(graphics.width, graphics.height);
}
示例6: getBounds
import org.robovm.apple.coregraphics.CGSize; //导入方法依赖的package包/类
/** Returns our real display dimension based on screen orientation.
*
* @param viewController The view controller.
* @return Or real display dimension. */
CGSize getBounds (UIViewController viewController) {
// or screen size (always portrait)
CGSize bounds = UIScreen.getMainScreen().getApplicationFrame().size();
// determine orientation and resulting width + height
UIInterfaceOrientation orientation;
if (viewController != null) {
orientation = viewController.getInterfaceOrientation();
} else if (config.orientationLandscape == config.orientationPortrait) {
/*
* if the app has orientation in any side then we can only check status bar orientation
*/
orientation = uiApp.getStatusBarOrientation();
} else if (config.orientationLandscape) {// is landscape true and portrait false
orientation = UIInterfaceOrientation.LandscapeRight;
} else {// is portrait true and landscape false
orientation = UIInterfaceOrientation.Portrait;
}
int width;
int height;
switch (orientation) {
case LandscapeLeft:
case LandscapeRight:
height = (int)bounds.width();
width = (int)bounds.height();
if (width < height) {
width = (int)bounds.width();
height = (int)bounds.height();
}
break;
default:
// assume portrait
width = (int)bounds.width();
height = (int)bounds.height();
}
Gdx.app.debug("IOSApplication", "Unscaled View: " + orientation.toString() + " " + width + "x" + height);
// update width/height depending on display scaling selected
width *= displayScaleFactor;
height *= displayScaleFactor;
// log screen dimensions
Gdx.app.debug("IOSApplication", "View: " + orientation.toString() + " " + width + "x" + height);
// return resulting view size (based on orientation)
return new CGSize(width, height);
}