“Conocimientos software>Software de Animación

Tutorial de SDL de desplazamiento lateral

2014/7/16
Simple Capa DirectMedia permite el acceso a audio, teclado, ratón , joystick , OpenGL 3 -D de hardware y D-2 framebuffers vídeo . Utilizado con el software de reproducción de MPEG, emuladores y otros juegos , el programa SDL es útil para una variedad de cosas , como la animación de un juego desplazador lateral . SDL trabaja nativamente con C + +, pero también trabaja en C, Ada , C #, D, Eiffell , Erlang , Euphoria , Go, Guile , Haskell , Java, Lisp, Lua , ML, Objective C , Pascal , Perl , PHP , Pike , Pliant , Python , Ruby , y Tcl Smalltalk . Instrucciones
1

Crear dos nuevos archivos llamados " CAnimation.h " y añadir la siguiente directiva "include " en " CApp.h " " CAnimation.cpp /. ": " # include " CAnimation.h "
2

Open " CAnimation.h " e introducir el siguiente código: .

# ifndef _CANIMATION_H_ # define _CANIMATION_H_ # include < SDL . h> clase CAnimation {private : int currentFrame ; int FrameInc ; privada: FrameRate int ; //milisegundos Oldtime ; públicos: MaxFrames int ; públicos: CAnimation () ; void OnAnimate () ; SetFrameRate públicos: void ( int Rate) ; void SetCurrentFrame (int frame) ; GetCurrentFrame int () ;} , # endif
3

Abrir " CAnimation.cpp " e introducir el siguiente código con los valores de velocidad de cuadro : # include " CAnimation.h " CAnimation :: CAnimation () { currentFrame = 0 ; MaxFrames = 0 ; FrameInc = 1 ; FrameRate = 100 ; //milisegundos Oldtime = 0 ;

} void CAnimation :: OnAnimate () { if ( Oldtime + FrameRate > SDL_GetTicks ()) {return ;} Oldtime = SDL_GetTicks (); currentFrame + = FrameInc ; if ( FrameInc > 0 ) {if ( currentFrame > = MaxFrames - 1) = { FrameInc - FrameInc ;} } else { if ( currentFrame < = 0 ) { FrameInc = - FrameInc ;} } } else {if ( currentFrame > = MaxFrames - 1) { currentFrame = 0 ;} } } void CAnimation :: SetFrameRate (int Cambio ) { FrameRate = Cambio ;} void CAnimation :: SetCurrentFrame (int Frame) { if ( Frame < 0

Software de Animación
Opciones Shockwave flash
Cómo importar una animación de una escena en otro Al Maya
Cómo actualizar Pivot
¿Qué es Microsoft Silverlight usado para
Juego Animación flash Tutorial
Cómo importar Photoshop en Maya
Cómo hacer una película transparente con Swish Max
Cómo convertir archivos de pintura en una película
Conocimientos Informáticos © http://www.ordenador.online