Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added auto resize function for html5 version #398

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions CocosBuilder/Resources/publishTemplates/index-html5.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=320,user-scalable=no"/>
<title>CocosBuilder Generated HTML5</title>
</head>
<body style="text-align: center;background: #f2f6f8;">

<div style="display:inline-block;width:auto; margin: 0 auto; background: black; position:relative; border:5px solid black; border-radius: 10px; box-shadow: 0 5px 50px #333">
<canvas id="gameCanvas" width="<#WIDTH#>" height="<#HEIGHT#>"></canvas>
</div>
<body style="text-align: center;background: #333;">
<canvas id="gameCanvas" width="320" height="480"></canvas>
<script src="boot-html5.js"></script>
</body>
</html>
2 changes: 2 additions & 0 deletions CocosBuilder/Resources/publishTemplates/main-html5.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ var cocos2dApp = cc.Application.extend({
// initialize director
var director = cc.Director.getInstance();

cc.EGLView.getInstance().setDesignResolutionSize(320,480,cc.RESOLUTION_POLICY.SHOW_ALL);

// enable High Resource Mode(2x, such as iphone4) and maintains low resource on other devices.
// director->enableRetinaDisplay(true);

Expand Down