Games at Bolton Simple Directmedia Layer Andrew Williams 01204-903839.

Slides:



Advertisements
Similar presentations
A Natural Interactive Game By Zak Wilson. Background This project was my second year group project at University and I have chosen it to present as it.
Advertisements

Intro to Game Development An introduction to Swing, Java2D, JOGL, and game design Created by: Dennis Lawter and Dustin Scott.
Concepts of Version Control A Technology-Independent View.
Copyright © 2002 Bolton Institute The AWSprite Library Andrew Williams
Games at Bolton Games Hardware, Architecture and Peripherals Andrew Williams
Games at Bolton Joysticks Andrew Williams
Copyright © 2002 Bolton Institute Sound in SDL Andrew Williams
Copyright © 2002 Bolton Institute Fonts Andrew Williams
Games at Bolton Sound in SDL Andrew Williams adw1.
Copyright © 2002 Bolton Institute Simple Directmedia Layer (SDL) Andrew Williams
Introduction to DirectX Programming Dongho Kim February 12, 2002 Dongho Kim February 12, 2002.
Software and Multimedia
 Recording Programs  Fraps  HyperCam  Editing Programs  Windows Movie Maker  Adobe After Effects  Conclusion.
A Games Class Using XNA Game Studio Express Art Gittleman California State University Long Beach
Week 4-5 Java Programming. Loops What is a loop? Loop is code that repeats itself a certain number of times There are two types of loops: For loop Used.
C++ / G4MICE Course Session 3 Introduction to Classes Pointers and References Makefiles Standard Template Library.
Introduction to Silverlight. Slide 2 What is Silverlight? It’s part of a Microsoft Web platform called Rich Internet Applications (RIA) There is a service.
SDL Programming Introduction. Initialization 2  The first thing you must do is initialize SDL  int SDL_Init( SDL_INIT_EVERYTHING )  This will return.
CHAPTER 4 Images XNA Game Studio 4.0. Objectives Find out how the Content Manager lets you add pictures to Microsoft XNA games. Discover how pictures.
3D Visualisation of Simulation Data. Informal Seminar 08/03/2004. By Chris Sweet.
Lecture 02: Intro to SDL Topics: Downloading / Installing SDL Linking (in general and for SDL) SDL basics References:
Tim Madden ODG/XSD.  Graphics Processing Unit  Graphics card on your PC.  “Hardware accelerated graphics”  Video game industry is main driver.  More.
Tennis for Two, 1958, by William Higinbotham, Brookhaven National Lab CSE 380 – Computer Game Programming Graphics Device Management.
11 A First Game Program Session Session Overview  Begin the creation of an arcade game  Learn software design techniques that apply to any form.
OpenGL Shading Language (Advanced Computer Graphics) Ernest Tatum.
C O M P U T E R G R A P H I C S Jie chen Computer graphic -- OpenGL Howto.
Tim Madden ODG/XSD.  Graphics Processing Unit  Graphics card on your PC.  “Hardware accelerated graphics”  Video game industry is main driver.  More.
Comp371 Computer Graphics Lecturer : Dr. Adam Krzyzak Mehdi Saeidian-manesh
The Graphics Rendering Pipeline 3D SCENE Collection of 3D primitives IMAGE Array of pixels Primitives: Basic geometric structures (points, lines, triangles,
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.
Introduction to the Windows API n API - Application Programming Interface n an API is the software interface for things such as the OS n an API is the.
MAEK GAEM III: SDL ● Simple DirectMedia Layer ● Input/Graphics/Audio using OpenGL ● Not nearly as difficult as OpenGL ● Cross Platform and Open Sauce ●
Sound DirectMusic & DirectSound. DirectShow Video Formats DirectShow is an open architecture, it can support any format as long as there are filters to.
11 Making a Sprite Session 4.2. Session Overview  Describe the principle of a game sprite, and see how to create a sprite in an XNA game  Learn more.
Making Python Pretty!. How to Use This Presentation… Download a copy of this presentation to your ‘Computing’ folder. Follow the code examples, and put.
Ahmed Saker Indie Game Developer
CSE 380 – Computer Game Programming GUIs for Games.
Tim Madden ODG/XSD.  Graphics Processing Unit  Graphics card on your PC.  “Hardware accelerated graphics”  Video game industry is main driver.  More.
Programming games Problems. Schedule Various examples. Homework: rps, bo (don't go back to do this), cannonball, Video or Audio should be complete. Now.
CHAPTER 3 (P.49-53) Importing modules + pygame intro.
Rujchai Ung-arunyawee Department of Computer Engineering Khon Kaen University.
C++ LANGUAGE TUTORIAL LESSON 1 –WRITING YOUR FIRST PROGRAM.
Computer Graphics 3 Lecture 6: Other Hardware-Based Extensions Benjamin Mora 1 University of Wales Swansea Dr. Benjamin Mora.
Computer Science I Programming in Java (programming using Processing IN Java, using IntelliJ IDE) Classwork/Homework: copy your Processing projects over.
GAM666 – Introduction To Game Programming ● Programmer's perspective of Game Industry ● Introduction to Windows Programming ● 2D animation using DirectX.
Lecture 01a: C++ review Topics: Setting up projects, main program Memory Diagrams Variables / Types (some of) the many-types-of-const's Input / Output.
GAM666 – Introduction To Game Programming ● Textures are simply 2D images which are spread over the triangles of a 3D shape ● Each vertex has texture coordinates.
Input Zhaohui Ning Aaron Cardwell Boonthanome Nouanesengsy.
Learning Aim B.  In this section, you will consider the resources necessary for designing your website.  You will also think about any constraints that.
Discovery Education PresentedBy Tracey Coles Tracey Coles.
OpenGL: The Open Graphics Language Technology and Historical Overview By Ricardo Veguilla.
Review Scene Management (Scene, Layer, Director) Sounds Menus Sprites & Actions.
●Cross-platform multimedia devlopment library for games (thats what we talk about), demos, MPEG players.... anything multimedia you can think of. ●SDL.
What is DirectX? DirectX is built by Microsoft as a collection of API’s (Application Programming Interfaces) for the purpose of multimedia processing.
Computer Engg, IIT(BHU)
Pixels, Colors and Shapes
Computer Software Digital Literacy.
PYGAME.
Testing and Debugging.
Customizing your StickyFish Slot Machine
A lap around DirectX game development tools
Managed DirectX Joe Gavin.
Introduction to Silverlight
Lecturer: Mukhtar Mohamed Ali “Hakaale”
Importing modules + pygame intro
Handling Arrays Completion of ideas needed for a general and complete program Final concepts needed for Final.
HW for Computer Graphics
Handling Arrays Completion of ideas needed for a general and complete program Final concepts needed for Final.
Player preferences, Loading Scenes, Activating and Enabling
Handling Arrays Completion of ideas needed for a general and complete program Final concepts needed for Final.
Presentation transcript:

Games at Bolton Simple Directmedia Layer Andrew Williams

Games at Bolton What is SDL?  SDL is a library (a standardized set of functions) for doing: –Games –Multimedia type applications  It is rather lightweight –Nothing like as much functionality as BlitzBasic, for example You might create something like BlitzBasic with SDL

Games at Bolton SDL History  Created by Sam Lantinga  Used by Loki Games in their short-lived attempt to port various games to Linux  Licensed under the LGPL: – –Our use of the library falls within the LGPL

Games at Bolton SDL Resources  SDL Homepage: – You can download SDL from the SDL homepage – A documentation project for SDL – A (rather good) series of tutorials

Games at Bolton SDL vs DirectX  SDL –Simple –Started on Linux Now cross-platform –Patchy documentation –Development is ad hoc Some talented people working part-time –Something of a hobby  DirectX –Very sophisticated –Standard on Windows Windows only –Superb documentation –Development is very well organized Very bright people –Strategic product for Microsoft

Games at Bolton SDL vs DirectX  Not really a like-for-like comparison –On Windows, SDL sits on top of DirectX to get the very best acceleration out of modern graphics hardware  DirectX is highly integrated –Direct3D –DirectSound  SDL uses –OpenGL –SDL_mixer

Games at Bolton SDL components  SDL –The basic library  SDL_mixer –Dynamic audio mixing and streaming  SDL_image –Loading image files (apart from BMP)  We'll use other stuff as we find it

Games at Bolton SDL Basics  Initializing the SDL system SDL_Init(Uint32 flags); Uint32 means 32-bit unsigned integer flags is the parameter to the function We have to create a number to tell SDL which parts we want to initialize. We have several possibilities: –SDL_INIT_TIMER –SDL_INIT_VIDEO –SDL_INIT_AUDIO –SDL_INIT_JOYSTICK –etc

Games at Bolton SDL Basics  In the first tutorial, we initialize the video and the audio  We combine the numbers with a bit-wise OR operation (don't worry if you don't understand that): SDL_Init(INIT_VIDEO | INIT_AUDIO);

Games at Bolton SDL Basics  In practice, it's not a good idea to assume that the function succeeded. We should really test it: if( SDL_Init(SDL_INIT_VIDEO|SDL_INIT_AUDIO) < 0 ) { printf("Unable to init SDL: %s\n", SDL_GetError()); return 1; }

Games at Bolton SDL Basics  Creating a surface to draw on 1.Declare a variable 2.Call the function 3.Check for error SDL_Surface *screen; screen = SDL_SetVideoMode(640, 480, 32, SDL_HWSURFACE|SDL_DOUBLEBUF); if ( screen == NULL ) { printf("Unable to set 640x480 video: %s\n", SDL_GetError()); return 1; }

Games at Bolton Drawing the Scene void DrawScene(SDL_Surface *screen) { Slock(screen); for(int x=0;x<640;x++) { for(int y=0;y<480;y++) { DrawPixel(screen,x,y,y/2,y/3,x/3); } Sulock(screen); SDL_Flip(screen); }

Games at Bolton Drawing the Scene void DrawScene(SDL_Surface *screen) { Slock(screen); for(int x=0;x<640;x++) { for(int y=0;y<480;y++) { DrawPixel(screen,x,y,y/2,y/3,x/3); } Sulock(screen); SDL_Flip(screen); } Question: What do the parameters to DrawPixel represent?

Games at Bolton Drawing the Scene void DrawScene(SDL_Surface *screen) { Slock(screen); for(int x=0;x<640;x++) { for(int y=0;y<480;y++) { DrawPixel(screen,x,y,y/2,y/3,x/3); } Sulock(screen); SDL_Flip(screen); } Question: What do Slock and Sulock do?

Games at Bolton Exercises  Questions –What does atexit(SDL_QUIT); do? –What is the error condition for SDL_Init(...) ?  Tasks –Alter DrawScene(...) so that the calls to DrawPixel(..) use constant values (eg 50 or 100 ) instead of y/2, y/2 and x/3 What happens?