Giter VIP home page Giter VIP logo

android-map-game's Introduction

Android_Map_Game

本工程主要介绍了 高德地图Android SDK 3D版本 在基于地图的游戏方面的应用。

##前述:

##效果图如下:

  • Screenshot

##使用方法:

1.搭建高德地图 AndroidSDK 工程方法见 地图SDK使用方法

2.OPENGL接口回调以及缩放比例

地图SDK使用OPENGL实现,可通过AMap.setCustomRenderer(CustomRenderer render)获取OPENGL渲染时的回调接口。
  • 初始化AMap对象及获取OPENGL绘制回调
     /**
      * 初始化AMap对象
      */
     private void init() {
         if (aMap == null) {
             aMap = mapView.getMap();
    
             //关闭文字
             aMap.showMapText(false);
             //关闭3d楼块
             aMap.showBuildings(false);
             //注1:设置opengl Renderer
             aMap.setCustomRenderer(new MapRenderer(aMap));
         }
     }
  • 地图开放每桢回调及坐标转换
    class MapRenderer implements CustomRenderer{
        TigerModel tiger;
        AMap aMap;
        ...
        @Override
        public void onDrawFrame(GL10 gl) {
            // 地图开放每帧Render 回调
            // 绘制模型
            tiger.draw();
        }
        
        @Override
        public void OnMapReferencechanged() {
             // 地图放到到一定级别 重新计算缩放比例
             // 开放屏幕、经纬度和OPENGL坐标互转
             aMap.getProjection().fromScreenLocation(screenPos);//屏幕坐标转经纬度
             aMap.getProjection().toScreenLocation(mapLatlng);//经纬度转屏幕坐标
             aMap.getProjection().toOpenGLLocation(mapLatlng);//经纬度转OPENGL坐标
             aMap.getProjection().toOpenGLWidth(screenWidth);//幕宽度转OPENGL宽度
        } 
    }

##扫一扫安装

  • Screenshot

android-map-game's People

Contributors

asmot avatar

Watchers

James Cloos 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.