WEB开发网
开发学院软件开发Java 创建一个 Eclipse 游戏插件,第 2 部分: 构建和发... 阅读

创建一个 Eclipse 游戏插件,第 2 部分: 构建和发射 BB 枪

 2009-12-14 00:00:00 来源:WEB开发网   
核心提示: 清单 1. 把视图捆绑到 OpenGL 代码publicclassShootoutViewextendsViewPart{publicstaticTableViewerviewer;privatebooleansceneRunning;privateActionaction1;...gridDa


清单 1. 把视图捆绑到 OpenGL 代码
public class ShootoutView extends ViewPart { 
  public static TableViewer viewer; 
  private boolean sceneRunning; 
  private Action action1; 
... 
    gridData.horizontalAlignment = SWT.FILL; 
     
    viewer = new TableViewer(parent, SWT.MULTI | 
                 SWT.H_SCROLL | SWT.V_SCROLL); 
    viewer.setContentProvider(new ViewContentProvider()); 
    viewer.setLabelProvider(new ViewLabelProvider()); 
... 
    startGameButton.setText("Start Game"); 
    startGameButton.addSelectionListener(new SelectionAdapter() { 
      public void widgetSelected(SelectionEvent event) { 
        try { 
          if(!ShootoutView.this.sceneRunning){ 
            ShootoutView.this.scene = 
              new GameScene(ShootoutView.this.parent); 
            new Refresher(ShootoutView.this.scene).run(); 
            ShootoutView.this.sceneRunning = true; 
          } 
        } 
        catch (Exception e) { 
          showMessage("startGameButton.widgetSelected()"+ 
                ":exception. " + e.getMessage()); 
          e.printStackTrace(); 
        } 
      } 
    }); 

上一页  1 2 3 4 5 6 7 8 9  下一页

Tags:创建 一个 Eclipse

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接