当前位置: 首页>>代码示例>>Java>>正文


Java DebugDraw.e_dynamicTreeBit方法代码示例

本文整理汇总了Java中org.jbox2d.callbacks.DebugDraw.e_dynamicTreeBit方法的典型用法代码示例。如果您正苦于以下问题:Java DebugDraw.e_dynamicTreeBit方法的具体用法?Java DebugDraw.e_dynamicTreeBit怎么用?Java DebugDraw.e_dynamicTreeBit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jbox2d.callbacks.DebugDraw的用法示例。


在下文中一共展示了DebugDraw.e_dynamicTreeBit方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: render

import org.jbox2d.callbacks.DebugDraw; //导入方法依赖的package包/类
public void render(ShowcaseSettings settings) {
  m_textLine = 15;
  int flags = 0;
  flags += settings.drawShapes? DebugDraw.e_shapeBit : 0;
  flags += settings.drawJoints? DebugDraw.e_jointBit: 0;
  flags += settings.drawAABBs? DebugDraw.e_aabbBit: 0;
  flags += settings.drawPairs? DebugDraw.e_pairBit: 0;
  flags += settings.drawCOMs?  DebugDraw.e_centerOfMassBit: 0;
  flags += settings.drawDynamicTree? DebugDraw.e_dynamicTreeBit: 0;
  m_debugDraw.setFlags(flags);
  
  m_world.drawDebugData();
  
  
  if(settings.drawStats){
    Vec2.watchCreations = true;
    m_debugDraw.drawString(5, m_textLine, "Engine Info", color4);
    m_textLine += 15;
    m_debugDraw.drawString(5, m_textLine, "Framerate: " + "TODO", Color3f.WHITE);
    //TODO display framerate
    //m_debugDraw.drawString(5, m_textLine, "Framerate: "+ panel.getCalculatedFrameRate(), Color3f.WHITE);
    m_textLine += 15;
    m_debugDraw.drawString(5, m_textLine,"bodies/contacts/joints/proxies = "+m_world.getBodyCount()+"/"+m_world.getContactCount()+"/"+m_world.getJointCount()+"/"+m_world.getProxyCount(), Color3f.WHITE);
    m_textLine += 20;
    m_debugDraw.drawString(5, m_textLine, "Pooling Info", color4);
    m_textLine += 15;
    m_debugDraw.drawString(5, m_textLine, "Vec2 creations: "+ Vec2.creationCount, Color3f.WHITE);
    m_textLine += 15;
    m_debugDraw.drawString(5, m_textLine, "Contact pooled/active: "+ Contact.contactPoolCount+"/"+Contact.activeContacts, Color3f.WHITE);
    m_textLine += 20;

    Vec2.creationCount = 0;
  }else{
    Vec2.watchCreations = false;
  }
  
  if(!textList.isEmpty()){
    for(String s : textList){
      m_debugDraw.drawString(5, m_textLine, s, Color3f.WHITE);
      m_textLine+=15;
    }
    textList.clear();
  }
  
  if(m_mouseJoint != null){
    m_mouseJoint.getAnchorB(p1);
    Vec2 p2 = m_mouseJoint.getTarget();
    
    m_debugDraw.drawSegment(p1, p2, mouseColor);
  }
  
  if(bombSpawning){
    m_debugDraw.drawSegment(bombSpawnPoint, m_mouseWorld, Color3f.WHITE);
  }
  
  if(settings.drawContactPoints){
    final float axisScale = .3f;
    
    for(int i=0; i<m_pointCount; i++){
      
      ContactPoint point = points[i];
      
      if(point.state == PointState.ADD_STATE){
        m_debugDraw.drawPoint(point.position, 10f, color1);
      }
      else if(point.state == PointState.PERSIST_STATE){
        m_debugDraw.drawPoint(point.position, 5f, color2);
      }
      
      if(settings.drawContactNormals){
        p1.set(point.position);
        p2.set(point.normal).mulLocal(axisScale).addLocal(p1);
        m_debugDraw.drawSegment(p1, p2, color3);
      }
    }
  }
}
 
开发者ID:dragome,项目名称:dragome-examples,代码行数:78,代码来源:BaseExample.java


注:本文中的org.jbox2d.callbacks.DebugDraw.e_dynamicTreeBit方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。