Chapter 16 GPDUMB Engine Part II. 2 GPDUMB2 Engine.

Slides:



Advertisements
Similar presentations
Chapter 18 Building the user interface. This chapter discusses n Javas graphical user interface. n Swing: an enhancement of a library called the Abstract.
Advertisements

Standard Input Devices section 2a This lesson includes the following sections: · The Keyboard · The Mouse · Variants of the Mouse.
1 Interaction Devices CIS 487/587 Bruce R. Maxim UM-Dearborn.
1 After completing this lesson, you will be able to: Insert a table. Navigate and select cells within a table. Merge table cells. Insert and delete columns.
1. Objective 1 Overview of the Linux Desktop  X Server  Controls Graphical Interface  Manages Input Devices  Transmits Input actions to the client.
1 2D Graphics CIS 487/587 Bruce R. Maxim UM-Dearborn.
RAPTOR Syntax and Semantics By Lt Col Schorsch
Computer Graphics Tz-Huan Huang National Taiwan University (Slides are based on Prof. Chen’s)
Quick starting Manual. Just watch and follow the instructions ! With little effort, you will be on your way to creating a personalized program for any.
Revision.
1 RTL Example: Video Compression – Sum of Absolute Differences Video is a series of frames (e.g., 30 per second) Most frames similar to previous frame.
COMPUTER PROGRAMMING I Essential Standard 5.02 Understand Breakpoint, Watch Window, and Try And Catch to Find Errors.
FINAL CUT PRO VIDEO EDITING SUITE REVIEW. FINAL CUT PRO REVIEW GETTING STARTED: Start by clicking the Final Cut Pro (FCP) icon in your dock. Wait for.
Interactive Boardmaker Basics By: Vanessa Wilkinson (nee Bushbacher) & Robyn Jung.
8.7 Memory management Program E Program D System memory DOS INT 21, function 48H: Allocate Memory Specification: allocates a number of memory paragraphs.
1 DirectDraw and Bitmaps Part 1 CIS 487/587 Bruce R. Maxim UM-Dearborn.
R-1 University of Washington Computer Programming I Lecture 17: Multidimensional Arrays © 2000 UW CSE.
First Bytes - LabVIEW. Today’s Session Introduction to LabVIEW Colors and computers Lab to create a color picker Lab to manipulate an image Visual ProgrammingImage.
L.
Input and Output: The User Connection
COMPUTER GRAPHICS Prepared by S.MAHALAKSHMI Asst. Prof(Sr) / SCSE VIT University.
Basics of a Computer Graphics System Introduction to Computer Graphics CSE 470/598 Arizona State University Dianne Hansford.
ORG ; FOUR INT 21H and INT 10H Programming and Macros Dec Hex Bin
Introduction to Scratch!
9/20/20151 Interaction Devices CIS 577 Bruce R. Maxim UM-Dearborn.
Working with iMovie: The Basics Created by MJ. Importing Video Footage attach your camera to your computer and set to VTR mode move the camera button.
ECE291 Computer Engineering II Lecture 9 Josh Potts University of Illinois at Urbana- Champaign.
Practical Electronics & Programming
Introduction to CUDA (1 of 2) Patrick Cozzi University of Pennsylvania CIS Spring 2012.
Introduction to Experiment 5 VGA Signal Generator ECE 448 Spring 2009.
ENGR 3950U / CSCI 3020U: Operating Systems Description and C Code of Major Functions in Simulated Unix File System. Instructor: Dr. Kamran Sartipi Faculty.
Another Example: #include<BIOS.H> #include<DOS.H>
L. Akshay Masare Piyush Awasthi IMAGE PROCESSING AND OPENCV.
1 Input and Interaction. 2 Input Devices Physical input devices Keyboard devices and pointing devices Logical input devices.
Week 7. Lecture 2 Functions, Arrays, PHP&MySQL. Function with More than one argument and a return statement For a function to return a value, the return.
ES305 Virtual Tools in Engineering Design Importing Objects Prof. Searleman
Addison Wesley is an imprint of © 2010 Pearson Addison-Wesley. All rights reserved. Chapter 7 The Game Loop and Animation Starting Out with Games & Graphics.
Virtual Book Tools How to insert a Text Box Click on Insert Go to Text Box Click on slide to insert OR Click on Drawing Toolbar picture of Text Box Click.
CSE3AGT Paul Taylor Stupid Conventions! l = Long p = Pointer h = handle g = global wnd = Windows WM = Windows Message d3d = Direct3D hr = HRESULT.
Animate picture to peek from bottom (1 of 3) 1. Right click on picture you want to animate. 2. Click on Custom Animation. 2 1 R.
Agenda Last class: Memory, Digitizing Numbers Today: Digitizing: Text
Today’s lecture 2-Dimensional indexing Color Format Thread Synchronization within for- loops Shared Memory Tiling Review example programs Using Printf.
Peter Norton, 6 th edition By: Rena Essa. Lesson 3A:Using the Keyboard and Mouse.
XNA Game Studio 4.0 Keyboard and Mouse Controls + more on Animated Sprites.
PowerPoint Practice Exercise 1 1.Save this file in your AV-TECH Folder as PowerPoint Practice Exercise 1. 2.Open this file in PowerPoint. 3.Edit each slide.
NestedLoops-Mody7-part51 Two-Dimensional Arrays and Nested Loops – part 5 Rotations Barb Ericson Georgia Institute of Technology May 2007.
Chapter 13 DirectSound 로 잡음 만들기. 2 History of Sound Programming Sound programming always gets put off until the end DOS –Third party sound libraries:
Guide to Programming with Python Week 15 Chapter Twelve Sound, Animation, and Program Development: The Astrocrash Game.
Program 2 due 02/01  Be sure to document your program  program level doc  your name  what the program does  each function  describe the arguments.
Haptic & Direct User Input with DirectInput ® 8 API Graphics Lab. Korea Univ.
2/16/2016 EEC492/693/793 - iPhone Application Development 1 EEC-693/793 Applied Computer Vision with Depth Cameras Lecture 4 Wenbing Zhao
Chapter 2 HAEDWAER.
Resources & Bitmaps Adding clip art to your application.
Programming for Art: Arrays – 2D ART 315 Dr. J. R. Parker Art/Digital Media Lab Lec 16 Fall 2010.
Lecture 11 Text mode video
# No Function Privacy Mode On/Off No Function * Play Message Alarm Pullcord LED Indicator (Central) Red Alarm Call Flashing RedExtracare Mode GreenPrivacy.
Dreamweaver MX. 2 Timeline Overview (p. 480) n Animations can be achieved with DHTML (__________ HTML) using JavaScript code and _____ or later browsers.
Game Maker Tutorials Introduction Clickball IntroductionClickball Where is it? Shooting Where is it?Shooting.
COMP413: Computer Graphics Overview of Graphics Systems Chapter 1.
Know: What a ‘hook’ is. Be able to: Decode the main hook from Kids by MGMT. Starter: Work out the riff by ear. Understand: How to play and record into.
Computer Graphics Lecture 1 Introduction to Computer Graphics
Selenium HP Web Test Tool Training
Hook Stage 1 Know: What a ‘hook’ is.
Microsoft Access 2007 – Level 2
Selenium HP Web Test Tool Training
3. Click at the point in your document where you’d like to
Reading Netpbm Images.
CS320n –Visual Programming
Creating Tables: 4.4 project 1
Presentation transcript:

Chapter 16 GPDUMB Engine Part II

2 GPDUMB2 Engine

3 Constants for Sound #define MAX_SOUNDS 64 // max sounds in system at once #define SOUND_NULL 0 // sound not loaded #define SOUND_LOADED 1 // sound has been loaded #define SOUND_PLAYING 2 // sound is currently playing #define SOUND_STOPPED 3 // sound has been stopped #define NVB_SIZE 6 // size of new voice block in bytes

4 Constants for Screen Transition fades, swipes, dissolves… only work for 8-bit modes #define SCREEN_DARKNESS 0 // fade to black #define SCREEN_WHITENESS 1 // fade to white #define SCREEN_SWIPE_X 2 // do a horizontal swipe #define SCREEN_SWIPE_Y 3 // do a vertical swipe #define SCREEN_DISSOLVE 4 // a pixel disolve #define SCREEN_SCRUNCH 5 // a square compression #define SCREEN_BLUENESS 6 // fade to blue #define SCREEN_REDNESS 7 // fade to red #define SCREEN_GREENNESS 8 // fade to green

5 Others… #define BOB_ATTR_CLONE 256 // the bob is a clone #define DSVOLUME_TO_DB(volume) ((DWORD)(-30*(100 - volume))) typedef struct pcm_sound_typ { LPDIRECTSOUNDBUFFER dsbuffer; // the DirectSound buffer containing the sound int state; // state of the sound int rate; // playback rate int size; // size of sound int id; // id number of the sound } pcm_sound, *pcm_sound_ptr;

6 Globals LPDIRECTSOUND lpds; // DirectSound interface pointer DSBUFFERDESC dsbd; // DirectSound description DSCAPS dscaps; // DirectSound caps HRESULT dsresult // general DirectSound result DSBCAPS dsbcaps; // DirectSound buffer caps pcm_sound sound_fx[MAX_SOUNDS]; // array of sound buffers WAVEFORMATEX pcmwf; // generic waveformat structure LPDIRECTINPUT8 lpdi; // dinput object LPDIRECTINPUTDEVICE8 lpdikey; // dinput keyboard LPDIRECTINPUTDEVICE8 lpdimouse; // dinput mouse LPDIRECTINPUTDEVICE8 lpdijoy; // dinput joystick GUID joystickGUID; // GUID for main joystick char joyname[80]; // name of joystick // these contain the target records for all DirectInput input packets UCHAR keyboard_state[256];// contains keyboard state table DIMOUSESTATE mouse_state; // contains state of mouse DIJOYSTATE joy_state; // contains state of joystick int joystick_found; // tracks if stick is plugged in

7 DirectSound Wrapper - 1 if (!DSound_Init(void)) { /* error */ } int boom_id = Load_VOC(“BOOM.VOC”); if (boom_id == -1) { /* error */ } int fire_id = Load_WAV(“FIRE.WAV”); if (fire_id == -1) { /* error */} // accessing sound buffer sound_fx[sound_id].dsbuffer …. if (!DSound_Shutdown()) { /* error */ }

8 DirectSound Wrapper - 2 int gunshot_ids[8]; // this holds all the ids // load the master sound gunshot_ids[0] = Load_WAV(“GUNSHOT.WAV”); // now make copies ( 실제로 copy 하는 것이 아니라 같은 buffer 를 // pointing 하게 함. for (int index=1; index<8; index++) gunshot_ids[index] = Replicate_Sound(gunshot_ids[0]); // use gunshot_ids[0..7],they all go bang!

9 Play Sound int Play_Sound(int id, // id of sound to play int flags=0, // 0 or DSBPLAY_LOOPING int volume=0, // unused int rate=0, // unused int pan=0); // unused int fire_id = Load_WAV(“FIRE.WAV”); Play_Sound(fire_id,0);

10 Sound Functions int Stop_Sound(int id); int Stop_All_Sounds(void); int Delete_Sound(int id); // id of sound to delete int Delete_All_Sounds(void); // initialize DirectSound DSound_Init(); // load a sound int fire_id = Load_WAV(“FIRE.WAV”); // play the sound in single mode Play_Sound(fire_id); // wait until the sound is done (key following on one line) while(Sound_Status(fire_id) & (DSBSTATUS_LOOPING | DSBSTATUS_PLAYING)); // delete the sound Delete_Sound(fire_id); // shut down DirectSound DSound_Shutdown();

11 Sound Functions int Set_Sound_Volume(int id, // id of sound int vol); // volume from int Set_Sound_Freq( int id, // sound id int freq); // new playback rate from int Set_Sound_Pan( int id, // sound id int pan); // panning value from to 10000

12 DirectInput Initialize / Shutdown // initialize the DirectInput system DInput_Init(); // initialize all input devices and acquire them DI_Init_Joystick(); DI_Init_Mouse(); DI_Init_Keyboard(); // input loop, insert program code here // now’s time for your program to end // first release all devices (order is unimportant) void DI_Release_Joystick(void); void DI_Release_Mouse(void); void DI_Release_Keyboard(void); // shut down DirectInput DInput_Shutdown();

13 Reading Keyboard // read the keyboard if (!DI_Read_Keyboard()) { /* error */ } // now test the state data if (keyboard_state[DIK_RIGHT] { /* move ship right */ } else if (keyboard_state[DIK_LEFT] { /* move ship left */ }

14 Reading Mouse // read the mouse if (!DI_Read_Mouse()) { /* error */ } // move cursor cx+=mouse_state.lX; cy+=mouse_state.lY; // test whether left button is down if (mouse_state.rgbButtons[0]) Draw_Pixel(cx,cy,col,buffer,pitch);

15 Reading Joystick // read the joystick data if (!DI_Read_Joystick()) { /* error */ } // move the ship ship_x+=joy_state.lX; ship_y+=joy_state.lY; // test for trigger if (joy_state.rgbButtons[0]) { // fire weapon // }

16 More Graphics Functions void HLine*(int x1, // starting x position of HLine int x2, // ending x position of HLine int y, // row or vertical position of HLine int color, // color of HLine UCHAR *vbuffer, // destination memory buffer int lpitch); // memory pitch of buffer void VLine(int y1, // starting y position of HLine int y2, // ending y position of HLine int x, // column or horizontal pos of VLine int color, // color of HLine UCHAR *vbuffer, // destination memory buffer int lpitch); // memory pitch of buffer

17 Master-Clone BOB

18 Clone_BOBX BOB master_bob, // the master BOB clone_bobs[64]; // the clones of the master // first create the master BOB (single frame, multi, etc.) Create_BOB(&master_bob, 0,0, 64,64,1,BOB_ATTR_SINGLE_FRAME); // load the image into the BOB Load_Frame(&master_bob, &bitmap8bit,0,0,0,BITMAP_EXTRACT_CELL_MODE); // create the clones for (int clone=0; clone<64; clone++) { // create the clone // don’t load imagery; just clone it Create_BOB(&clone_bobs[clone], 0,0, 64,64,1,BOB_ATTR_SINGLE_FRAME); Clone_BOBX(&master_bob, &clone_bobs[clone]; // reset the fields you want changed (code not shown) } // end for clone // now you can use all the clones

19 Destroy Clone BOB int Destroy_BOBX(BOB_PTR bob);

20 Star Ferret Delux DEMO