Podobne
- Strona startowa
- Nekritin Alex Binary Options. Strategies For Directional And Volatility Trading
- newsweek 24 2006
- [eBook] DirectX 3D Graphics Programming Bible
- Advanced 3D Game Programming with DirectX 9
- (ebook pdf) Teach Yourself Database Programming with Visual C in 21 days
- (ebook pdf) Teach Yourself SQL in 21 Days
- Teach Yourself Database Programming with Visual C in 21 Da
- SAMS Teach Yourself PHP4 in 24 Hours
- Dziekoński Józef Bohdan Sędziwój
- Bell Ted Alex Hawke 6 Zamach
- zanotowane.pl
- doc.pisz.pl
- pdf.pisz.pl
- thelemisticum.opx.pl
Cytat
Do celu tam się wysiada. Lec Stanisław Jerzy (pierw. de Tusch-Letz, 1909-1966)
A bogowie grają w kości i nie pytają wcale czy chcesz przyłączyć się do gry (. . . ) Bogowie kpią sobie z twojego poukładanego życia (. . . ) nie przejmują się zbytnio ani naszymi planami na przyszłość ani oczekiwaniami. Gdzieś we wszechświecie rzucają kości i przypadkiem wypada twoja kolej. I odtąd zwyciężyć lub przegrać - to tylko kwestia szczęścia. Borys Pasternak
Idąc po kurzych jajach nie podskakuj. Przysłowie szkockie
I Herkules nie poradzi przeciwko wielu.
Dialog półinteligentów równa się monologowi ćwierćinteligenta. Stanisław Jerzy Lec (pierw. de Tusch - Letz, 1909-1966)
[ Pobierz całość w formacie PDF ]
.Behaviors can also be reactive and interactive.There are event behaviors that can besetup to change other behaviors when the event occurs.Also, events can be defined basedon user input, so this provides an interactive element to the behaviors.Each type ofbehavior will have a number of methods defined on its interface that allows you to per-form operations relevant to that behavior type.There are also a number of inheritedmethods from the IDABehavior interface that will apply to all behaviors.Some methods,such as Transform() are pretty much common to all behaviors, but because the seman-tics of the transformation is different depending on the type of the behavior, these areindividually defined, but have similar signatures.So basically, the DirectAnimation model is really all about defining behaviors and therelationships between them.After this is done, you start the DirectAnimation control run-ning, and it does the rest.You can still modify the behaviors after it is running by initial-izing behaviors using the ModifiableBehavior() method of the IDAStatics interface andthen using the SwitchTo() method on those behaviors somewhere else in your code (thatis, a menu or command handler).A Versatile Programming EnvironmentBecause the DirectAnimation interfaces include most of their capability through automa-tion compatible interfaces, these interfaces can be accessed and manipulated from anylanguage that supports COM or automation interface programming.You can access the33 1634xCH24 11/13/99 11:14 AM Page 493Integrating Media Into Web Pages and Applications with DirectAnimation 493full capabilities of DirectAnimation through normal COM interfaces or automation inter-faces through Visual C++, Visual Basic, and Java.But the automation compatible inter-faces can also be accessed from scripting languages and other environments that do notsupport the manipulation of COM interface pointers directly.The most common scriptinglanguages that support this type of interaction are HTML embedded JScript andVBScript.If you choose to use DirectAnimation from C++, the possibilities open up even more.You can use DirectAnimation to create a standalone application where the Direct-Animation scene takes up the entire window area, or you could simply use Direct-Animation to create media elements that are embedded in your application, either asActiveX controls or simply programmatic elements of the main application (that is, childwindows of the main window).You can also embed DirectAnimation inside otherActiveX controls that you create from Visual C++ and distribute those controls either as24elements of an application, as third-party controls, or as Web content ActiveX controls.This also enables you to protect your source code from distribution in the Web environ-ment.If you code your animation in script, anyone is able to copy or modify your code.Another advantage to using DirectAnimation from C++ is that some interfaces includedin DirectAnimation are not accessible from automation environments, and these addi-tional interfaces can make a significant difference in performance and capability.Mostnotably, by programming DirectAnimation from C++, you can create a DirectDraw sur-face yourself as shown in earlier parts of this book, pass that surface to the Direct-Animation model, and then control the updating of the surface yourself.By doing this,you can greatly improve performance because the normal DirectAnimation control justuses the GDI to draw to the screen.It gives you better control of the update frequency,and you can have better control of how you react to events and provide hooks into thebehaviors that compose a DirectAnimation scene.Because of the automation and type library support provided by DirectAnimation, thereare multiple ways to access the functionality within more powerful languages like VisualC++.Because there are so many variants and we are trying to keep this lesson down toan hour, we will only dive into the shallow end of two of the choices: C++ and scripts.DirectAnimation Programming in C++When programming DirectAnimationfrom Visual C++, you have a lot of choices on howyou can access and use the capabilities of the library.You can stick to straight C++ COMinterface programming, as is required for most other DirectX libraries, or you can takeadvantage of the type library and automation support and use some of the features ofVisual C++ to make your life a little easier.Because of the way you program with33 1634xCH24 11/13/99 11:14 AM Page 494494 Hour 24DirectAnimation, getting a little help with all the COM interface management becomesmuch more important than it is for DirectDraw.DirectDraw has a lot of helper functionsdefined that hide most of the COM details from you.DirectAnimation does not includesimilar helper functions, but the code can still be very straightforward and easy to codeand understand with a little help from the Visual C++ environment.The thing about DirectAnimation that causes straight C++ COM programming to get alittle painful is that you will be creating and manipulating a ton of interfaces.This makeskeeping track of all the reference counting and HRESULT error checking extremelytedious and error prone.That is where wrapper classes come in.You have a number ofchoices in the Visual C++ environment that can help you out with the interface manage-ment.You can use the ActiveX Template Library (ATL) classes: the Components andControls library to create wrapper classes, or the #import directive to generate smartpointer classes from a type library.In the sample C++ code we will be covering in detail, we will be using the #importmechanism.We won t go into a great deal of explanation on this, but you will see that itis pretty straightforward to use, and significantly simplifies the code.This will let usfocus more on what is going on with DirectAnimation, instead of what is going on withCOM.Using Scripts to Use DirectAnimation on the WebYou can also use scripts in HTML to program DirectAnimation capabilities directly intoa Web page.In fact, this is the primary thrust of the DirectAnimation documentation andsamples.The process is essentially the same as in C++.You create a DirectAnimationcontrol, get an IDAStatics interface from it, create behaviors and set the model running.The main difference is in the syntax, but the code actually turns out to be very similar tothe code you use with the #import mechanism in Visual C++.Sample DirectAnimation Application in C++Enough with the theory and abstractions: let s work with some code to show just howpowerful and easy DirectAnimation really is
[ Pobierz całość w formacie PDF ]