Coder Social home page Coder Social logo

vineshchauhan24 / cocos2dxwatchface Goto Github PK

View Code? Open in Web Editor NEW

This project forked from bitristan/cocos2dxwatchface

0.0 0.0 0.0 4.09 MB

Show how to create watch face for android wear with Cocos2dx framework.

License: Apache License 2.0

CMake 2.09% C++ 2.75% Java 94.13% Python 0.58% Makefile 0.44%

cocos2dxwatchface's Introduction

Cocos2dxWatchFace

This is an example of create watch face for android wear using Cocos2dx.

How to do this?

  • First, you must download a version of cocos2dx. My version is 3.6. Unzip it to a dir.

  • Configure environment variables in your ~/.bash_profile

  • Enter your workspace, use the command below to create a new cocos2dx project.
cd $YOUR_WORKSPACE
cocos new -l cpp -p com.awesomego.cocos.watchface Cocos2dxWatchFace

  • Compile and run.
cocos run -s Cocos2dxWatchFace -p android

or enter proj.android dir, and execute the internal script.

cd $YOUR_WORKSPACE/Cocos2dxWatchFace/proj.android
./build_native.py
  • Because the proj.android is just a common android project with eclipse structure. We won't use it. So let's use android studio to create a watch face project for android wear. If you do not know how to do, please refer to Android Training.

  • Now we have a project WatchFaceDemo with MyWatchFace in it. We need copy java files located in cocos2d/cocos/platform/android/java/src/ to our new project and change some of the file contents.

    1. We should change Cocos2dxHelper.java, modify Activity sActivity to Context sActivity and update relevant method.
    2. We should add a method to Cocos2dxHelper.java. Because default can't support Context parameter. For the implemention you can refer to the code. public static void init(final Context activity, Cocos2dxHelperListener listener)
    3. We should change getGLContextAttrs which in Cocos2dxActivity.java from private to public.
    4. We should change inner class Cocos2dxEGLConfigChooser which in Cocos2dxActivity.java to static.

Attention

If you have found any bugs or need some features, please create an issue at Github Issue Tracker.

License

Copyright (C) 2015 Tinker Sun

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

cocos2dxwatchface's People

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.