Git Product home page Git Product logo

cocos2dx-webview's Introduction

DEPRECATED

This WebView merged into cocos2d-x3.3!

Require

  • cocos2d-x ver3.0(or greater
  • android-10(or greater

How to setup

common

  • create libs directory under target project and clone this repository.
cd /path/to/my-project
mkdir libs && cd libs
git clone [email protected]:gin0606/cocos2dx-WebView.git

iOS

  • Add cocos2dx-WebView/common and cocos2dx-WebView/ios to your project.

Android

  • Update project.properties file.
cd /path/to/my-project/libs/cocos2dx-WebView/android/java
android update project -p . -t [android API level]
android update project -p . -l /path/to/my-project/cocos2d/cocos/platform/android/java
cd /path/to/my-project/proj.android
android update project -p . -l /path/to/my-project/libs/cocos2dx-WebView/android/java
  • Update Android.mk file.
open /path/to/my-project/proj.android/jni/Android.mk
-# LOCAL_WHOLE_STATIC_LIBRARIES += cocostudio_static
+LOCAL_WHOLE_STATIC_LIBRARIES += cocostudio_static
+LOCAL_WHOLE_STATIC_LIBRARIES += cocos_webview_plugin_static
-# $(call import-module,editor-support/cocostudio)
+$(call import-module,editor-support/cocostudio)
+$(call import-module,../../libs/cocos2dx-WebView/android)
  • Edit Activity class to handle Cocos2dxWebViewHelper instance.
public class AppActivity extends Cocos2dxActivity {
    private Cocos2dxWebViewHelper mWebViewHelper = null;
    @Override
    protected void onCreate(final Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if(mWebViewHelper == null){
            mWebViewHelper = new Cocos2dxWebViewHelper(mFrameLayout);
        }
    }
}

How to use.

#include "WebView.h"

auto webView = cocos2d::plugin::WebView::create();
webView->setContentSize(cocos2d::Director::getInstance()->getVisibleSize());
webView->setPosition(cocos2d::Director::getInstance()->getVisibleSize() / 2);
webView->loadUrl("http://www.google.co.jp");
this->addChild(webView);

// if set js scheme. call `onJsCallback` when load `hoge-scheme://foo`.
webView->setJavascriptInterfaceScheme("hoge-scheme");

cocos2dx-webview's People

Contributors

gin0606 avatar matsukaz avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.