lol ca sert a rien de mettre celui que j'ai inclue car cela le fait a tous les programme utilisant DM 3D j'ai déja essayer.
Code : Tout sélectionner
;{- Enumerations / DataSections
;{ Windows
Enumeration
#Window_0 : #Text_0 : #Button_0 : #Button_1 : #Button_2 : #file_0
EndEnumeration
;}
Define.l event, EventWindow, EventGadget, EventType, EventMenu
;}
;- Fonts
Global FontID1
FontID1 = LoadFont(1, "Algerian", 48)
IncludeFile "Base_La Guerre Mondiale de la Préhistoire et de l'Histoire.pb"
Procedure OpenWindow_Window_0()
If OpenWindow(#window_0, 216, 0, 800, 600, "Guerre de la Préhistoire et de l'Histoire", #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_TitleBar | #PB_Window_ScreenCentered )
TextGadget(#Text_0, 50, 10, 700, 230, "Guerre de la Préhistoire et de l'Histoire", #PB_Text_Center)
SetGadgetFont(#Text_0, FontID1)
ButtonGadget(#Button_0, 310, 280, 210, 60, "COMMENCER")
ButtonGadget(#Button_1, 310, 460, 210, 60, "QUITTER")
ButtonGadget(#Button_2, 310, 370, 210, 60, "CONTROLE")
EndIf
Repeat
event = WaitWindowEvent()
Select event
; ///////////////////
Case #PB_Event_Gadget
EventGadget = EventGadget()
EventType = EventType()
If EventGadget = #Button_0
MON_JEU()
EndIf
; ////////////////////////
Case #PB_Event_CloseWindow
EventWindow = EventWindow()
If EventWindow = #Window_0
CloseWindow(#Window_0)
Break
EndIf
EndSelect
ForEver
EndProcedure
OpenWindow_Window_0()
;
;}
Code : Tout sélectionner
; ------------------------------------------------------------
; DreaMotion3D
;
; Exemple : Base_game
; Historique :
; 18/09/06 00:00 DreaMotion3D Team
; 10/02/07 19:16 TMyke
;
; ------------------------------------------------------------
;-Include Files
IncludePath "Include" : IncludeFile "dreamotion3d.pbi"
Declare FrameFind( *pframe.D3DXFRAME , *frame.D3DXFRAME)
;-Globales
Global anglex.f, angley.f, flagXDown.w
Global mox.f, omx.f, moy.l, omy.l
Global mFar.f, hh.f
Global *camera.CEntity
Global *texture.CTexture
Global *font.CFont
Global Dim *tiny.CAnimX(30)
Global Quit.b
Global i.l, flag.l
Global tab.l=0, *tFrame.D3DXFRAME
PROCEDURE MON_JEU()
DM_InitPhysic()
;-Init PB modules
If InitSprite() = 0 Or InitKeyboard() = 0 Or InitMouse() = 0
End
EndIf
;-set graphic window 3D
DM_Graphics3D(800,600, 32, 1, 1)
;-load font
*font = DM_LoadFont( "Tahoma",9 , 0)
DM_TextColor(*font, 198,198,198,255)
;-change directory for media
SetCurrentDirectory("media/")
;-Set ambient color
DM_AmbientLight(250, 250, 250)
DM_CreateLight(3)
; ---------------------------------------
;-a little skybox, well here a skydome must be define in first
;
; ---------------------------------------
*sky.CSkySphere = DM_LoadSkySphere("grassenvmap1024.dds", 50)
DM_TranslateEntity(*sky, 0,-10,0)
DM_TextureMipLevel( 0 )
; ---------------------------------------
;-create terrain with terrain engine
;
; ---------------------------------------
;-create base terrain with heightmap "map.jpg"
*terrain = DM_CreateTerrain("height113.bmp", 1.5, #False)
*brush = DM_CreateBrush("terrain")
DM_LoadTexture("sol113.jpg", DM_GetTexture(*brush))
DM_LoadTexture("detail3.bmp", DM_GetTexture(*brush,1))
DM_PaintTerrain(*terrain, *brush )
DM_FreeBrush(*brush)
mFar=800.0
*tiny = DM_LoadAnimMesh("bones_all.x")
DM_ScaleEntity(*tiny, 13,13,13)
DM_AnimateSpeed(*tiny, 0.01)
DM_RotateEntity(*tiny, 0,225,0)
; ---------------------------------------
;-create camera
; ---------------------------------------
*camera = DM_CreateCamera(800,600,*tiny)
DM_MoveEntity(*camera, 0,2,4)
DM_TurnEntity(*camera, 10,180,0)
DM_CameraClsColor(*camera, 125, 125, 125)
DM_CameraProjRatio(*camera, 800,600, mFar)
; ---------------------------------------
;-main loop
; ---------------------------------------
;-if fullscreen, must do it for keep mouse cursor
;-change_curseur( #IDC_ARROW )
Repeat
ExamineKeyboard()
ExamineMouse()
;-if Escape Key, exit
If KeyboardReleased(#PB_Key_Escape) Or WindowEvent()=#PB_Event_CloseWindow
Quit=1
EndIf
h.f = DM_GetTerrainHeight(*terrain, DM_EntityX(*tiny), DM_EntityZ(*tiny))
If KeyboardPushed(#PB_Key_Down)
DM_AnimateIndex(*tiny, 1)
DM_MoveEntity(*tiny, 0,0,4)
DM_PositionEntity(*tiny, DM_EntityX(*tiny), h+5, DM_EntityZ(*tiny))
EndIf
If KeyboardReleased(#PB_Key_Down)
DM_AnimateIndex(*tiny, 0)
DM_MoveEntity(*tiny, 0,0,0)
DM_PositionEntity(*tiny, DM_EntityX(*tiny), h+5, DM_EntityZ(*tiny))
EndIf
If KeyboardPushed(#PB_Key_Up)
DM_AnimateIndex(*tiny, 1)
DM_MoveEntity(*tiny, 0,0,-4)
DM_PositionEntity(*tiny, DM_EntityX(*tiny), h+5, DM_EntityZ(*tiny))
EndIf
If KeyboardReleased(#PB_Key_Up)
DM_AnimateIndex(*tiny, 0)
DM_MoveEntity(*tiny, 0,0,0)
DM_PositionEntity(*tiny, DM_EntityX(*tiny), h+5, DM_EntityZ(*tiny))
EndIf
If KeyboardPushed(#PB_Key_Right)
DM_TurnEntity(*tiny, 0,1,0)
EndIf
If KeyboardPushed(#PB_Key_Left)
DM_TurnEntity(*tiny, 0,-1,0)
EndIf
If flagXdown=0
omx = MouseX()
omy = MouseY()
flagXDown=11
Else
moy = MouseY()-omy
angley=(moy/5.0)
omy= MouseY()
mox = MouseX()-omx
anglex=(mox/5.0)
omx= MouseX()
DM_TurnEntity(*tiny, 0,anglex,0)
EndIf
; ---------------
;-Render
; ---------------
If flag=0 : DM_UpdateWorld() : EndIf
DM_BeginScene()
DM_RenderWorld(*camera)
;-draw some informations
DM_DrawText(*font, 10, 15, "FPS: "+Str(DM_FPS()))
DM_EndScene()
Until Quit=1
;-end
DM_ClearGraphics()
ENDPROCEDURE
Procedure FrameFind( *pframe.D3DXFRAME , *frame.D3DXFRAME)
Protected a$
a$=Space(tab)
Repeat
*frame = DM_AnimateGetChild(*tiny(0), *pframe, *frame)
If *frame
Debug a$+DM_AnimFrameName(*frame)
tab+3
FrameFind(*frame, #Null)
EndIf
Until *frame=#Null
tab-3
EndProcedure