Overlays végső állapot letöltése (GhostGame) OpenAL letöltése Include könyvtárak,lib könyvtárak  OpenAL/include, OpenAL\include\AL  OpenAL/lib lib referenciák.

Slides:



Advertisements
Similar presentations
Continuation of chapter 6…. Nested while loop A while loop used within another while loop is called nested while loop. Q. An illustration to generate.
Advertisements

OpenGL Open a Win32 Console Application in Microsoft Visual C++.
OpenGL CMSC340 3D Character Design & Animation. What is OpenGL? A low-level graphics library specification designed for use with the C and C++ provides…
File Management in C. What is a File? A file is a collection of related data that a computers treats as a single unit. Computers store files to secondary.
Physical representation of a game character. Basics 05_02_Bullet_CharacterControl_Base.zip Extract.
GUI Ogre3D Overlay.
Csontváz animáció Third person camera PhysX character controller.
Kezdeti teendők Letöltés: OgreBillboardParticles.zip Kicsomagol Futtat: OgreBillboardParticles.sln Include és library útvonalak beállítása Working directory.
Ogre3D Alapok Model betöltés AnyagjellemzőkFényforrásokShaderek.
PhysX. Kezdeti teendők Letöltés: OgrePhysicsBase.zip Kicsomagol Futtat: OgrePhysics.sln Include és library útvonalak beállítása Working directory beállítása.
SEE C GO Provisional Title. Syntax Types int, float, double, char, void Identifiers foo Operators + - * / ^ Delimiters ; {} () “” ‘’ Keywords return,
CPSC 441 TUTORIAL – JANUARY 16, 2012 TA: MARYAM ELAHI INTRODUCTION TO C.
And c++?. What will we do? C vs JAVA Dev-C++ tutorial and your first program C++ structure Reading input/output Flow Control (if, for, while) array function.
I/O means Input and Output. One way: use standard input and standard output. To read in data, use scanf() (or a few other functions) To write out data,
Starting Out with C++, 3 rd Edition 1 Chapter 10 – Characters, Strings, and the string Class.
Buffer Overflow Prabhaker Mateti Wright State University.
Templated Functions. Overloading vs Templating  Overloaded functions allow multiple functions with the same name.
1 Chapter 10 Strings and Pointers. 2 Introduction  String Constant  Example: printf(“Hello”); “Hello” : a string constant oA string constant is a series.
Lecture 20 Arrays and Strings
Sort the given string, without using string handling functions.
C Intro.
BITS Pilani, Pilani Campus TA C252 Computer Programming - II Vikas Singh File Handling.
GUI II. Ogre3D GUI with MyGUI.
C Programming - Lecture 5
Stack buffer overflow.
Lab2 TA Notes. Set up for Visual C++ New Workspace Win32 Console Application – This runs from a command line Chose Blank Project Add your.C file Build.
General Computer Science for Engineers CISC 106 Lecture 33 Dr. John Cavazos Computer and Information Sciences 05/11/2009.
Command line arguments. – main can take two arguments conventionally called argc and argv. – Information regarding command line arguments are passed to.
Binary numbers and arithmetic. ADDITION Addition (decimal)
CS140: Intro to CS An Overview of Programming in C by Erin Chambers.
Defining and Converting Data Copyright Kip Irvine, 2003 Last Update: 11/4/2003.
Lecture #5 Introduction to C++
ITEC 320 C++ Examples.
C++ Character Set It is set of Characters/digits/symbol which is valid in C++. Example – A-Z, (white space) C++ Character Set It is set of.
File IO and command line input CSE 2451 Rong Shi.
Chapter 8 Scope of variables Name reuse. Scope The region of program code where it is legal to reference (use) a variable The scope of a variable depends.
Lin Chen 09/13/2011. Count words number in the file arrayUtils.h include the adding functions template int addInOrder (T* array, int& size, T value);
111 Introduction to OGRE3D Programming: Main Loop.
Object Oriented Programming (OOP) Lecture No. 10.
Gaudi Framework Tutorial, April Job Options and Printing.
Introduction to Programming
1 + 1 becomes 11 what does our software promise?.
CS-1030 Dr. Mark L. Hornick 1 Java Review Interactive.
Sound DirectMusic & DirectSound. Sound Formats Wav Midi (Musical Instrument Digital Interface) DLS (Downloadable Sounds) DirectMusic Producer Segments.
Navigating Directories
CSCI 3133 Programming with C Instructor: Bindra Shrestha University of Houston – Clear Lake.
Quiz // // The function exchanges the two parameters. // Param: ( ) // Param:
Minimal standard C program int main(void) { return 0 ; }
Lecturer: Nguyen Thi Hien Software Engineering Department Home page: hienngong.wordpress.com Chapter 2: Language C++
Introduction to sound using processing. 2 Minim –A sound library which uses javasound library –Provide convenient but flexible way to play,, synthesize.
CS426Fall 2010/Lecture 141 Computer Security CS 426 Lecture 14 Software Vulnerabilities: Format String and Integer Overflow Vulnerabilities.
Ogre Resource Managers References: 1. anagers&structure=Tutorialshttp://
1988 Morris Worm … estimated 10% penetration 2001 Code Red … 300,00 computers breached 2003 Slammer/Sapphire … 75,00 infections in 10 min Zotob …
Unbuffered Input Games generally use unbuffered Input Ogre provides FrameListeners – Ogre's main infinite loop → startRendering – Also called the render.
CS 1430: Programming in C++ 1. File Input in VS Project Properties Debugging Command Arguments quiz8-1.out We want to know how to do it ourselves, right?
Function: Declaration
A bit of C programming Lecture 3 Uli Raich.
Lecture 11 File input/output
Command line arguments
Command Line Arguments
Command-Line Arguments
CS-401 Computer Architecture & Assembly Language Programming
Yung-Hsiang Lu Purdue University
C Stuff CS 2308.
Stack buffer overflow.
Standard Input/Output Stream
Default Arguments.
Introduction to Programming
C Programming - Lecture 5
Building Blocks of C Programming Language
Presentation transcript:

Overlays végső állapot letöltése (GhostGame) OpenAL letöltése Include könyvtárak,lib könyvtárak  OpenAL/include, OpenAL\include\AL  OpenAL/lib lib referenciák  OpenAL32.lib, alut.lib dll-ek bin-be másolása OpenAL/bin OpenAL32.dll, alut.dll

GameAudio.h #pragma once #include "Inputs.h" #include class GameAudio { public: GameAudio(int argc, char** argv) { printf("*** Initializing OpenAL ***\n"); alutInit (&argc, argv); ALenum error; error = alutGetError(); if(error != AL_NO_ERROR) { Ogre::LogManager::getSingleton().logMessage("Error initializing OpenAL: " + Ogre::String(alutGetErrorString(error))); } ~GameAudio() { printf("*** Shutting down OpenAL ***\n"); alutExit(); } };

Main.cpp #include "GameAudio.h"... GameAudio* gameAudio;... int main(int argc, char** argv) { ogreRoot = new Root("",""); gameAudio = new GameAudio(argc, argv);

Próba... fordul-e, fut-e

Valamit játszunk le class GameAudio { public: GameAudio(int argc, char** argv) { printf("*** Initializing OpenAL ***\n"); alutInit (&argc, argv); ALuint helloBuffer, helloSource; helloBuffer = alutCreateBufferHelloWorld (); alGenSources (1, &helloSource); alSourcei (helloSource, AL_BUFFER, helloBuffer); alSourcePlay (helloSource);

Játszadozzunk... alSourcei (helloSource, AL_LOOPING, AL_TRUE); alSourcei (helloSource, AL_GAIN, 10); alSourcef (helloSource, AL_PITCH, 0.3); alListener3f(AL_POSITION, 0,0,0); alSource3f(helloSource, AL_POSITION, -1,0,0); alSourcePlay (helloSource); Hangerő Folyamatos lejátszás Lejátszás sebessége világtérbeli pozíció

File lejátszása helloBuffer = alutCreateBufferFromFile(„media/titlemusic.wav"); error = alutGetError(); if(error != AL_NO_ERROR) { Ogre::LogManager::getSingleton().logMessage("Cannot load audio file: "+ Ogre::String(alutGetErrorString(error))); } Próba

Error handing #define ALUT_SAFE_CALL(call, message) {call; \ ALenum error = alutGetError(); \ if(error != ALUT_ERROR_NO_ERROR) \ Ogre::LogManager::getSingleton().logMessage(message + Ogre::String(" ") + Ogre::String(alutGetErrorString(error))); \ } #define AL_SAFE_CALL(call, message) {call; \ ALenum error = alGetError(); \ if(error != AL_NO_ERROR) \ Ogre::LogManager::getSingleton().logMessage(message + Ogre::String(" ") + Ogre::String(alutGetErrorString(error))); \ }

Title music class GameAudio { ALuint ambientBuffer; ALuint ambientSource; float musicVolume; ALuint loadFile(const char* filename) { ALenum error; ALuint newBuffer; ALUT_SAFE_CALL(newBuffer = alutCreateBufferFromFile(filename), "Cannot load audio file: " + Ogre::String(filename)); return newBuffer; } void createSource(ALuint* source) { AL_SAFE_CALL(alGenSources (1, source), "Unable to generate source"); } public: void playTitleMusic() { AL_SAFE_CALL(alSourceStop(ambientSource), "unable to stop title source"); AL_SAFE_CALL(alSourcei (ambientSource, AL_BUFFER, ambientBuffer), "unable to bind buffer to ambient source"); AL_SAFE_CALL(alSourcePlay (ambientSource), "unable to play title source"); }

Title Music GameAudio(int argc, char** argv) { … // az eddigi hellowBuffer és Source helyett ambientBuffer = loadFile("media/titlemusic.wav"); createSource(&ambientSource); AL_SAFE_CALL(alSourcei (ambientSource, AL_BUFFER, ambientBuffer), "unable to bind title buffer"); AL_SAFE_CALL(alSourcei (ambientSource, AL_LOOPING, AL_TRUE), "unable to set looping"); musicVolume = 10; alSourcei (ambientSource, AL_GAIN, musicVolume); }

Title Music int main(int argc, char* argv[]) { … gameAudio = new GameAudio(argc, argv); gameAudio->playTitleMusic(); Próba

Egyébb bufferek //Uj publikus függvények a GameAudio osztályba ALuint levelAmbientBuffer; ALuint ghostBirthBuffer; ALuint ghostDeathBuffer; ALuint* ghostSources; void loadLevelResources(int maxGhostCount) { levelAmbientBuffer = loadFile("media/ambient.wav"); ghostBirthBuffer = loadFile("media/ghostbirth.wav"); ghostDeathBuffer = loadFile("media/ghostdeath.wav"); ghostSources = new ALuint[maxGhostCount]; for(int i = 0; i < maxGhostCount; ++i) { alGenSources (1, &ghostSources[i]); alSourcef(ghostSources[i], AL_GAIN, 0.2); } void playAmbientMusic() { AL_SAFE_CALL(alSourceStop(ambientSource), "unable to stop level ambient source"); AL_SAFE_CALL(alSourcei (ambientSource, AL_BUFFER, levelAmbientBuffer), "unable to bind buffer to ambient source"); AL_SAFE_CALL(alSourcePlay (ambientSource), "unable to play level ambient source"); } //main.cpp setupPostProc(); gameAudio->loadLevelResources(ghosts->getParticleQuota()); gameAudio->playAmbientMusic(); Próba

Szellem születik/meghal //Uj publikus függvények a GameAudio osztályba void ghostBirth(int ghost) { AL_SAFE_CALL(alSourceStop(ghostSources[ghost]), "unable to stop ghost source" + Ogre::StringConverter::toString(ghost)); AL_SAFE_CALL(alSourcei (ghostSources[ghost], AL_BUFFER, ghostBirthBuffer), "unable to bind buffer to ghost source " + Ogre::StringConverter::toString(ghost)); AL_SAFE_CALL(alSourcePlay (ghostSources[ghost]), "unable to play ghost source" + Ogre::StringConverter::toString(ghost)); alSourcef(ghostSources[ghost], AL_PITCH, 1.0); } void ghostDeath(int ghost) { AL_SAFE_CALL(alSourceStop(ghostSources[ghost]), "unable to stop ghost source" + Ogre::StringConverter::toString(ghost)); AL_SAFE_CALL(alSourcei (ghostSources[ghost], AL_BUFFER, ghostDeathBuffer), "unable to bind buffer to ghost source " + Ogre::StringConverter::toString(ghost)); AL_SAFE_CALL(alSourcePlay (ghostSources[ghost]), "unable to play ghost source" + Ogre::StringConverter::toString(ghost)); alSourcef(ghostSources[ghost], AL_PITCH, 2.0); }

Szellem születik/meghal //main.cpp class GhostCounter : public ParticleAffector { … void _initParticle(Particle* pParticle) { … gameAudio->ghostBirth(ghosts->getNumParticles() - 1); } class ShootController { … bool handleEvent {... ++ghostShooted; mainHUD->refreshScore(ghostBorn, ghostShooted); gameAudio->ghostDeath(ghostID); Próba

Harang class GameAudio { ALuint bellBuffer; ALuint bellSource; … void loadLevelResources(int maxGhostCount) { … bellBuffer = loadFile("media/churchbell.wav"); createSource(&bellSource); AL_SAFE_CALL(alSourcei (bellSource, AL_BUFFER, bellBuffer), "unable to bind buffer to bell source"); alSourcei(bellSource, AL_LOOPING, AL_TRUE); alSource3f(bellSource, AL_POSITION, 0.5f,10.0f,-8.0f); alSourcef(bellSource, AL_GAIN, 30); } void playTitleMusic() { AL_SAFE_CALL(alSourcePause(bellSource), "unable to stop bell source"); … } void playAmbientMusic() { … AL_SAFE_CALL(alSourcePlay (bellSource), "unable to play bell source"); } Próba

Hallgató //Uj publikus függvény a GameAudio osztályba void setListenerPose(Ogre::Vector3 pos, Ogre::Vector3 dir) { alListener3f(AL_POSITION, pos.x, pos.y, pos.z); float orient[] = {dir.x, dir.y, dir.z, 0, 1, 0}; alListenerfv(AL_ORIENTATION, orient); } //main.cpp class CameraAnimation { … bool frameStarted { … camera->setDirection(oldDir * (1.0 - smooth) + newDir * smooth); gameAudio->setListenerPose(camera->getPosition(), camera->getDirection()); Próba

Szellemek pozíciója //Uj publikus függvény a GameAudio osztályba void setGhostPosition(int ghost, Ogre::Vector3 pos) { alSource3f(ghostSources[ghost],AL_POSITION, pos.x, pos.y, pos.z); } //main.cpp class GhostCounter : public ParticleAffector { void _affectParticles(ParticleSystem* pSystem, Real timeElapsed) { int ghostCount = ghosts->getNumParticles(); for(unsigned int i = 0; i < ghostCount; ++i) { gameAudio->setGhostPosition(i, ghosts->getParticle(i)->position + ghosts->getParentSceneNode()->getPosition()); } Próba

Vége Sok minden lehetne még……