lundi 3 mars 2014

Sub voyant 3D

un programme de démonstration d'une "Sub"
 pour créer  un voyant 3D avec différentes couleurs du voyant
 et de l'étiquette  avec le texte de l'étiquette  et aussi
 un coefficient de zoom


 



 Code :

rem =============================================

' .............      .....+Numéro objet
'                          !   +parent
'                          !    !    +top
'                          !    !     !    + left
'                          !     !    !     !   + texte étiquette
'                          !     !    !     !   !       + couleur voyant
'                          !     !    !     !   !       !        + couleur étiquette
'                          !     !    !     !   !       !        !       + couleur corps
'                          !     !    !     !   !       !        !        !     + coefficient zoom
'                          !     !    !     !   !       !        !        !      !  +font_size
'                          !     !    !     !   !       !        !        !      !   !
' sub voyant_3d(ntp,par,ttp,ltp,txt$,colv$,cole$,colc$,cf,fz)
rem =============================================
dim nobj
 nobj=10:voyant_3d(nobj,0,40,50,"  AUTO","v","r","j",2,5)
 nobj=30:voyant_3d(nobj,0,30,300,"  MANU","r","n","n",5,5)
  nobj=40:voyant_3d(nobj,0,30,150,"  Moteur 1","b","j","n",3,4)
' =============================
end
' =============================

sub voyant_3d(ntp,par,ttp,ltp,txt$,colv$,cole$,colc$,cf,fz)
rem crée un monde 3D
panel ntp:top ntp,ttp:left ntp,ltp
width ntp,30*cf:height ntp,40*cf
if colc$="r" :color ntp,255,0,0:end_if
if colc$="v" :color ntp,0,255,0:end_if
if colc$="b" :color ntp,0,255,255:end_if
if colc$="j" :color ntp,255,255,0:end_if
if colc$="n" :color ntp,0,0,0:end_if

scene3d ntp+1:top ntp+1,10*cf:parent ntp+1,ntp
width ntp+1,30*cf:height ntp+1,30*cf
if colc$="r" :color ntp+1,255,0,0:end_if
if colc$="v" :color ntp+1,0,255,0:end_if
if colc$="b" :color ntp+1,0,255,255:end_if
if colc$="j" :color ntp+1,255,255,0:end_if
if colc$="n" :color ntp+1,0,0,0:end_if
panel ntp+2:parent ntp+2,ntp
width ntp+2,30*cf:height ntp+2,10*cf
alpha ntp+3:parent ntp+3,ntp+2:full_space ntp+3
if cole$="r" :color ntp+3,255,0,0:end_if
if cole$="v" :color ntp+3,0,255,0:end_if
if cole$="b" :color ntp+3,0,255,255:end_if
if cole$="j" :color ntp+3,255,255,0:end_if
if cole$="n" :color ntp+3,0,0,0:font_color ntp+3,255,255,255:end_if
font_size ntp+3,fz*cf:caption ntp+3,txt$
font_bold ntp+3
3d_target_is ntp+1
3d_torus ntp+2,1.6,0.3
3d_color ntp+2,10,10,10
3d_sphere ntp+3,1.5
if colv$="r" :3d_color ntp+3,255,0,0:end_if
if colv$="v" :3d_color ntp+3,0,255,0:end_if
if colv$="b" :3d_color ntp+3,0,255,255:end_if
if colv$="j" :3d_color ntp+3,255,255,0:end_if
cam_z_position 60/cf

end_sub