Introducing your Game Engine Part 1 Games Fundamentals © by Jarek Francik Kingston University, London February 2008.

Slides:



Advertisements
Similar presentations
Software Engineering Implementation Lecture 3 ASPI8-4 Anders P. Ravn, Feb 2004.
Advertisements

INHERITANCE BASICS Reusability is achieved by INHERITANCE
Client Side Programming Using Java Applet Outcomes: You will be expected to know: – Java Applets and HTML file; –bytecode and platform independent programs;
1 Recitation 11. Applet Applets. An applet is a Java program that is started by a browser (e.g. netscape or internet explorer) when an html file has a.
Unit 111 Java GUI Components and Events  Learning Outcomes oDistinguish between GUI components and containers. oIdentify and distinguish top-level containers.
Chapter 3 - Introduction to Java Applets Outline 3.1Introduction 3.2Thinking About Objects 3.4A Simple Java Applet: Drawing a String 3.5Two More Simple.
Lecture 17: Animation Yoni Fridman 7/27/01 7/27/01.
1 CS1007: Object Oriented Design and Programming in Java Lecture #23 April 13 Shlomo Hershkop
Programming Task: Task 1 Controlled Assessment Practice.
Io package as Java’s basic I/O system continue’d.
MIT AITI 2002 Abstract Classes, Interfaces. Abstract Classes What is an abstract class? An abstract class is a class in which one or more methods is declared,
1 Object-Oriented Software Engineering CS Interfaces Interfaces are contracts Contracts between software groups Defines how software interacts with.
JAPPLET.
Learn about the types of Graphics that are available Develop a basic Graphics applet Develop a basic Graphics application Review the Java API and use.
CSCE 2013L: Lab 1 Overview  Java Basics The JVM Anatomy of a Java Program  Object-Oriented Programming Overview  Example: Payroll.java JDK Tools and.
GUI programming Graphical user interface-based programming.
POS 406 Java Technology And Beginning Java Code
Quiz 1 What is this? (explain the use of the reserved word “this” in a class method). Answer each question briefly. – What is a Constructor? –Under what.
How to Create a Videogame By: Connor McCann. Java Java is one of many programming languages Java is used to run web browsers and most PC video games I.
Java Applets. Topics What is an applet? To convert GUI applications to Applets Hello World applet example!! Applets life cycle examples Invoking applets.
Omer Boyaci. Resources  
Interfaces. –An interface describes a set of methods: no constructors no instance variables –The interface must be implemented by some class. 646 java.
Chapter 2: Java Fundamentals
1 Computer Science 340 Software Design & Testing Inheritance.
School of Computer Science & Information Technology G6DICP - Lecture 17 GUI (Graphical User Interface) Programming.
1 Block1 – unit 2 (The Case study in Budd 5-6).  create a small application that uses the Abstract Windowing Toolkit (AWT)  Swing packages to simulate.
Intro to Applets August 19, 2008 Mrs. C. Furman. Java Applets vs. Java Applications Java Applet: a program that is intended for use on the web. Java Applet:
1 CSC111H Graphical User Interfaces (GUIs) Introduction GUIs in Java Understanding Events A Simple Application The Containment Hierarchy Layout Managers.
CSC 205 – Java Programming II Applet. Types of Java Programs Applets Applications Console applications Graphics applications Applications are stand-alone.
Java development environment and Review of Java. Eclipse TM Intergrated Development Environment (IDE) Running Eclipse: Warning: Never check the “Use this.
1 University of Utah – School of Computing Computer Science 1021 "Applets and Applications"
Object Oriented Programming Examples: C++, Java Advantages: 1. reusibility of code 2. ability to adapt (extend) previously written code.
BEGINNING PROGRAMMING.  Literally – giving instructions to a computer so that it does what you want  Practically – using a programming language (such.
Intro to Applets. Applet Applets run within the Web browser environment Applets bring dynamic interaction and live animation to an otherwise static HTML.
Creating Applets. What is an applet? What is an applet? A Java program that runs in a web browser. A Java program that runs in a web browser. An applet.
1 GUI programming Graphical user interface-based programming Chapter G1 (pages )
Iteration 1 Looping Structures. Iteration 2 The Plan While not everyone understands: 1.Motivate loops 2.For loops 3.While loops 4.Do-while loops 5.Equivalence.
Java Applets and other things. Applets Very like usual classes Use init() method instead of main Applets provide 4 methods init() start() stop() destroy()
Java the UML Way version Only to be used in connection with the book "Java the UML Way", by Else Lervik and.
1 Applets. 2 Design of Applets 3 Sun wrote Java to be executable within a hosting application browser The applications are applets. An applet is downloaded.
Java and C++ Transitioning. A simple example public class HelloWorldApp { public static void main(String[] args) { //Display the string. System.out.println("Hello.
Applets Java code is compiled into byte code instead of machine language –Languages like C, C++, Pascal and others are compiled into machine language so.
Chapter 2 Creating a Java Application and Applet.
Interfaces and Polymorphism CS 162 (Summer 2009).
CompSci Video Game Package Design Design of the Video Game Package.
Client-Server applications Introduction to Java Applets Client-server architectures Why do Applets exist? What can an Applet do?
StarBuzz Coffee Recipe Boil some water Brew coffee in boiling water Pour coffee in cup Add sugar and milk Tea Recipe Boil some water Steep tea in boiling.
1 Java and AWT CPS 470 Spring 1998 Laura Campbell.
Graphical User Interface (GUI)
Agenda For Feb PowerPoint Presentation on Java Methods. 3. Finish Happy Face Assignment (Due by the.
Java Threads 1 1 Threading and Concurrent Programming in Java Threads and Swing D.W. Denbo.
Chapter 11: Threaded Programs Situations where the program is following multiple execution paths (how to stop one?) Thread: a line of execution Thread.
Processing == Java + Extra Utilities Processing Adds: – Drawing functions – Text and font manipulations – Image and video – 3D transformations – Keyboard.
1 Applets Programming. Introduction Java programs are divided into two main categories, applets and applications. An application is an ordinary Java program.
Programming in Java Transitioning from Alice. Becomes not myFirstMethod but …. public static void main (String[] arg) { // code for testing classes goes.
 It is a pure oops language and a high level language.  It was developed at sun microsystems by James Gosling.
Modern Programming Tools And Techniques-I
Reference: Object Oriented Design and Programming (Horstmann)
Multithreaded applets
Contacts: Intro to game programming in Java (with almost-drawingpanel)
30 Java Applets.
null, true, and false are also reserved.
LRobot Game.
CNT 4007C Project 2 Good morning, everyone. In this class, we will have a brief look at the project 2. Project 2 is basically the same with project 1.
Java applets 1/3/2019.
class PrintOnetoTen { public static void main(String args[]) {
Sampath Kumar S Assistant Professor, SECE
A Methodical Approach to Methods
មជ្ឈមណ្ឌលកូរ៉េ សហ្វវែរ អេច អ ឌី
Presentation transcript:

Introducing your Game Engine Part 1 Games Fundamentals © by Jarek Francik Kingston University, London February 2008

KU Games Fundamental Classes A skeleton for: –a windowed application –full-screen application –applet Organising your animation loop –drawing your screen –updating your screen Providing Sprites

KU GFC Library Structure Package: kingston.gamefx –class: Game –class: GamePanel –class: GameWinApp –class: GameApplet –class: GameGraphics Package: kingston.sprite –class: Sprite subclasses: RectSprite, CircleSprite, BitmapSprite –class: SpriteList

Structure of a Windowed Game Game GameWinApp GamePanel

Structure of a Windowed Game GameWinApp – creates Game Window you just need to create an instance GamePanel – displays and controls the game a game panel is created automatically and you'll rarely use this class directly Game – the Game Engine that's what's you're going to do: develop a Game-derived class to implement your very own class

A Windowed Game – what to do? Develop your Game Class Add your main function to: –Create an instance of your Game Class –Create an instance of GameWinApp –Start your game

A Windowed Game – what to do? public static void main(String[] args) { Game game = new MazeGame(800, 600); GameWinApp app = new GameWinApp(); app.openWindow("Crazy Maze", game); }

Full Screen Games GameWinApp objects can run them, too! to open a windowed game: app.openWindow("Crazy Maze", game) to open a full-screen game: app.openFullScreen(game)

Full Screen Games final static boolean bFullScreen = false; public static void main(String[] args) { Game game = new MazeGame(800, 600); GameWinApp app = new GameWinApp(); if (bFullScreen) app.openFullScreen(game); else app.openWindow("Crazy Maze", game); }

Applets GameApplet class derived from JApplet, standard java applet class Every applet class must be initialised 1.Create a GameApplet derived class 2.Write a simple init() method

Applets public final class Maze extends GameApplet { // mandatory... private static final long serialVersionUID = 1; // Applet Initialisation goes here... public void init() { setGame(new MazeGame(800, 600)); super.init(); }

Universal Games Combine them both: –create a regular Applet class –add the main method for the windowed game

package kingston.games.maze; import kingston.gamefx.Game; import kingston.gamefx.GameApplet; import kingston.gamefx.GameWinApp; public final class Maze extends GameApplet { private static final long serialVersionUID = 1; final static boolean bFullScreen = false; // Applet Initialisation goes here... public void init() { setGame(new MazeGame(800, 600)); super.init(); } public static void main(String[] args) { Game game = new MazeGame(800, 600); GameWinApp app = new GameWinApp(); if (bFullScreen) app.openFullScreen(game); else app.openWindow("Crazy Maze", game); }