follow my heart...
分类:
2006-09-12 13:14:23
'$INCLUDE: "SDL\SDL.bi
FMOD:
'$Include: 'fmod.bi'
TinyPTC:
'$INCLUDE: 'tinyptc.bi'
初始化库,并加载文件
SDL:
CONST SCR_WIDTH = 640
CONST SCR_HEIGHT = 480
DIM MenuScreen AS SDL_Surface ptr 'our bitmap
DIM Shared video AS SDL_Surface ptr 'our screen surface
SDL_Init ( SDL_INIT_VIDEO )
video = SDL_SetVideoMode( SCR_WIDTH, SCR_HEIGHT, 32, 0 ) 'sets the video mode for 640x480x32
MenuScreen = SDL_LoadBMP("bitmap.bmp")
------------------------------------
FMOD当中
DIM sound AS INTEGER 'it's just a handle, so it's an int!
IF FSOUND_GetVersion <= FMOD_VERSION THEN
ErrorQuit "FMOD version " + STR$(FMOD_VERSION) + " or greater required"
End If
If FSOUND_Init(44100, 32, 0) = FALSE Then
ErrorQuit "Can't initialize FMOD"
End If
--------------------------------------
tinyptc
const SCR_WIDTH = 320
const SCR_HEIGHT = 200
const SCR_SIZE = SCR_WIDTH*SCR_HEIGHT
if( ptc_open( "tinyPTC test", SCR_WIDTH, SCR_HEIGHT ) = 0 ) then
end -1
end if
sound = FSOUND_Sample_Load(FSOUND_FREE,"sound.wav", FSOUND_HW3D, 0, 0)
翻转/播放
SDL:
SUB BlitImage(x as integer,y as integer,image as sdl_surface ptr, dest as sdl_surface ptr)
DIM Rectangle as SDL_Rect
DIM Rectangle2 as SDL_Rect
Rectangle.X = 0
Rectangle.Y = 0
rectangle.w = image->w
rectangle.h = image->h
Rectangle2.x = x
Rectangle2.y = y
SDL_BlitSurface image, @rectangle, dest, @rectangle2
-----------------------------------------------------
FMOD:
FUNCTION fModPlayWave( samp1 as integer ) AS INTEGER
'where samp1 is the number returned by FSOUND_SampleLoad
DIM position(0 to 2)' as FSound_Vector
DIM vel(0 to 2)' FSound_Vector
fModPlayWave = FSOUND_PlaySoundEx(FSOUND_FREE, samp1, NULL, TRUE)
---------------------------------------------------
TinyPTC:
SUB putd(BYREF buffer(), BYVAL x AS INTEGER, BYVAL y AS INTEGER, BYVAL colr as INTEGER)
buffer((y * SCR_WIDTH) + x) = colr
ptc_update @buffer(0) 'This is a pageFlip
END SUB
中止
SDL: SDL_Quit ()
fmod: FSOUND_Close ()
tinyPTC: PTC_Close ()
END SUB
END FUNCTION
END SUB