Skip to main content

By clicking Submit, you agree to the developerWorks terms of use.

The first time you sign into developerWorks, a profile is created for you. Select information in your developerWorks profile is displayed to the public, but you may edit the information at any time. Your first name, last name (unless you choose to hide them), and display name will accompany the content that you post.

All information submitted is secure.

  • Close [x]

The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerworks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

By clicking Submit, you agree to the developerWorks terms of use.

All information submitted is secure.

  • Close [x]

Create an Eclipse game plug-in, Part 2: Building and firing a BB gun

How to build fun plug-ins for Eclipse using the SWT, OpenGL, and the LWJGL

Tyler Anderson (tyleranderson5@yahoo.com), Freelance Writer, Stexar Corp.
Tyler Anderson graduated with a degree in computer science from Brigham Young University in 2004 and graduated with a master's degree in computer engineering in December 2005, also from Brigham Young University. He is currently an engineer for Stexar Corp., based in Beaverton, Ore.

Summary:  Although most users think of Eclipse as an integrated development environment for building Java™ technology applications, it is really something much more basic. Eclipse is a framework for building plug-ins, allowing you to extend its functionality to solve nearly any problem -- just by leveraging a set of APIs and readily available libraries. In this four-part "Create an Eclipse game plug-in" tutorial series, you will solve a pressing problem most programmers encounter daily: how to break away to play a quick video game without switching applications and making it obvious. You'll develop a simple game that will read the bugs entered on the a view and blast them to bits. The game will run inside Eclipse as a plug-in, that will demonstrate how to write to the Eclipse API, while using the Standard Widget Toolkit, the Open Graphics Library, and the Lightweight Java Games Library.

View more content in this series

Date:  28 Mar 2006
Level:  Intermediate PDF:  A4 and Letter (448 KB | 33 pages)Get Adobe® Reader®

Activity:  13007 views
Comments:  

Before you start

This tutorial, Part 2 of a four-part series, goes beyond what was accomplished in Part 1 by creating the BB gun, the bugs, and the BBs using Open Graphics Library (OpenGL). Upon completing this tutorial, we'll watch the BBs you fire whiz across the screen!

About this series

In this series, you'll be introduced to the basic techniques, tools, and libraries used to create a full-featured Eclipse plug-in that uses the Standard Widget Toolkit (SWT) and OpenGL libraries for providing graphics. Part 1 looks at building the framework for a simple video game that can be launched and played inside Eclipse by creating a plug-in. Part 2 takes the basic framework created in Part 1 and starts adding the actual visual elements using OpenGL. Part 3 adds the actual game elements, enabling the user to interact with the graphics created in Part 2. Part 4 takes everything created in the previous three parts and makes sure it all works.


About this tutorial

This tutorial continues where you left off in Part 1 by adding OpenGL and the SWT to the mix. You'll do the following:

  • Create shapes based on the number of tasks in the task list that will be known as bugs
  • Create a shape for the BB gun and add color and texture
  • Add text to the works for when bugs get blown up
  • Create BBs that zip across the screen
  • Learn how to place all the objects on the same canvas using translations

Prerequisites

This tutorial assumes you have the basic knowledge of Java syntax and coding, and about Eclipse plug-in programming, as shown in Part 1 of this series. Graphics programming knowledge is a plus, but not required. Knowledge of OpenGL is not required.


System requirements

You need the following:

Eclipse
Eclipse is the framework for creating the plug-in in Part 1. Now you'll continue leveraging Eclipse in building the gaming plug-in. Download Eclipse V3.2 M3 or higher from Eclipse.org.
Eclipse SWT
The SWT is the Eclipse widgets package for window-making, donated to Eclipse by IBM. Download the SWT development version, 3.2 M3 or higher.
Eclipse OpenGL
The OpenGL libraries is needed for creating shapes and more. Download the experimental org.eclipse.opengl binding, version 0.5 for SWT 3.2.
Eclipse Example Plug-in using OpenGL
Download the Example plug-in with a view that uses OpenGL. You'll use the source code in this plug-in as a framework for building your own custom OpenGL scene.
Java technology
Eclipse and all its plug-ins need Java. Download Java technology from Sun or IBM.

1 of 11 | Next

Comments



Help: Update or add to My dW interests

What's this?

This little timesaver lets you update your My developerWorks profile with just one click! The general subject of this content (AIX and UNIX, Information Management, Lotus, Rational, Tivoli, WebSphere, Java, Linux, Open source, SOA and Web services, Web development, or XML) will be added to the interests section of your profile, if it's not there already. You only need to be logged in to My developerWorks.

And what's the point of adding your interests to your profile? That's how you find other users with the same interests as yours, and see what they're reading and contributing to the community. Your interests also help us recommend relevant developerWorks content to you.

View your My developerWorks profile

Return from help

Help: Remove from My dW interests

What's this?

Removing this interest does not alter your profile, but rather removes this piece of content from a list of all content for which you've indicated interest. In a future enhancement to My developerWorks, you'll be able to see a record of that content.

View your My developerWorks profile

Return from help

static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Open source
ArticleID=106482
TutorialTitle=Create an Eclipse game plug-in, Part 2: Building and firing a BB gun
publish-date=03282006
author1-email=tyleranderson5@yahoo.com
author1-email-cc=troy@backstopmedia.com

Tags

Help
Use the search field to find all types of content in My developerWorks with that tag.

Use the slider bar to see more or fewer tags.

Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere).

My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Use the search field to find all types of content in My developerWorks with that tag. Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere). My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Try IBM PureSystems. No charge.