FORUM DE DISCUSSION SUR LE LANGAGE PANORAMIC
Vous souhaitez réagir à ce message ? Créez un compte en quelques clics ou connectez-vous pour continuer.
FORUM DE DISCUSSION SUR LE LANGAGE PANORAMIC

Développement d'applications avec le langage Panoramic
 
AccueilAccueil  RechercherRechercher  Dernières imagesDernières images  S'enregistrerS'enregistrer  MembresMembres  Connexion  
Derniers sujets
» demande explication KGF pour imprimer en mm
Boussole Emptypar lepetitmarocain Aujourd'hui à 12:55

» Petit passage furtif
Boussole Emptypar Froggy One Hier à 14:26

» SPIN et aide langage (résolu)
Boussole Emptypar leclode Sam 23 Mar 2024 - 15:20

» Aide-mémoire des mots-clés Panoramic
Boussole Emptypar papydall Mer 20 Mar 2024 - 21:23

» Je ne comprend pas pourquoi la largeur de la scene 3d change
Boussole Emptypar Marc Mar 12 Mar 2024 - 20:06

» Comment télécharger panoramic?
Boussole Emptypar lepetitmarocain Sam 9 Mar 2024 - 13:31

» @lepetitmarocain <==> KGFGrid
Boussole Emptypar Klaus Dim 3 Mar 2024 - 9:59

» Tangram-Toukaré
Boussole Emptypar jjn4 Mer 28 Fév 2024 - 18:12

» Editeur EliP 6 : Le Tiny éditeur avec 25 onglets de travail
Boussole Emptypar jjn4 Mer 28 Fév 2024 - 18:09

» KGF_dll - nouvelles versions
Boussole Emptypar Klaus Mer 28 Fév 2024 - 17:01

» Mes souhaits d'amélioration de Panoramic.
Boussole Emptypar Pedro Lun 26 Fév 2024 - 18:12

» Testez-votre-QI
Boussole Emptypar jjn4 Dim 25 Fév 2024 - 17:12

» Utilisation d'Élip
Boussole Emptypar jjn4 Sam 24 Fév 2024 - 18:33

» Récapitulatif ludothèque panoramic jjn4
Boussole Emptypar jjn4 Sam 24 Fév 2024 - 18:11

» Générateur de mots de passe
Boussole Emptypar mindstorm Mar 20 Fév 2024 - 20:09

Navigation
 Portail
 Index
 Membres
 Profil
 FAQ
 Rechercher
Rechercher
 
 

Résultats par :
 
Rechercher Recherche avancée
Mars 2024
LunMarMerJeuVenSamDim
    123
45678910
11121314151617
18192021222324
25262728293031
CalendrierCalendrier
-20%
Le deal à ne pas rater :
-20% sur le Lot de 2 écrans PC GIGABYTE 27″ LED M27Q
429 € 539 €
Voir le deal

 

 Boussole

Aller en bas 
4 participants
AuteurMessage
Marc

Marc


Nombre de messages : 2372
Age : 63
Localisation : TOURS (37)
Date d'inscription : 17/03/2014

Boussole Empty
MessageSujet: Boussole   Boussole EmptyVen 13 Juil 2018 - 23:59

Bonjour à tous !

Pour le plaisir de programmer : voici une boussole un peu particulière, elle indique la position de la souris.
Elle est réalisée avec un mélange de 2D et 3D.
Le moteur 3D de Panoramic permet une très bonne fluidité et rapidité du déplacement de l'aiguille.

Code:
' ------------------------------------------------------------------------------
'  PANORAMIC Compass / Boussole
'  Marc - July 2018 - Panoramic v0.9.28
'  http://panoramic-language.pagesperso-orange.fr/French/index.html
'  http://panoramic.top-forum.net
' ------------------------------------------------------------------------------
' Main
    Init()
    Instructions()
    Needle()
    Background()
    ON_MOUSE_MOVE 1,Move1
    ON_MOUSE_MOVE 2,Move2
END
' ------------------------------------------------------------------------------
SUB Init()
    HEIGHT 0,540 + HEIGHT(0)-HEIGHT_CLIENT(0)
    WIDTH 0,500 + WIDTH(0)-WIDTH_CLIENT(0)
    LEFT 0,(screen_x-WIDTH(0))/2
    TOP 0,(screen_y-HEIGHT(0))/2
    COLOR 0,0,0,0
    LABEL Move1, Move2, Quit
    DIM x,y,z
    DEGREES
    ON_CLOSE 0, Quit
END_SUB
' ------------------------------------------------------------------------------
SUB Background()
    DIM_LOCAL i%,x,y
    PICTURE 1
    WIDTH 1,500
    HEIGHT 1,500
    COLOR 1,0,0,0
    PRINT_TARGET_IS 1
    FONT_NAME 1,"Arial"
    FONT_BOLD 1
    FONT_SIZE 1,"12"
    FONT_COLOR 1,0,0,0
    2D_TARGET_IS 1
    2D_PEN_COLOR 0,0,0
    2D_FILL_COLOR 255,255,255
    2D_CIRCLE 250,250,200
    FOR i% = 0 TO 360 STEP 10
         x= 185*COS(i%)+250
         y= 185*SIN(i%)+250
         2D_LINE 250,250,x,y
    NEXT i%
    FOR i% = 0 TO 360 STEP 45
         x= 195*COS(i%)+250
         y= 195*SIN(i%)+250
         2D_LINE 250,250,x,y
    NEXT i%
    2D_FILL_COLOR 0,0,0
    2D_POLY_FROM 250,75
    2D_POLY_TO 425,250
    2D_POLY_TO 250,425
    2D_POLY_TO 75,250
    2D_POLY_TO 250,75
    2D_FLOOD 247,87,0,0,0
    2D_FLOOD 413,253,0,0,0
    2D_FLOOD 246,412,0,0,0
    2D_FLOOD 87,247,0,0,0
    2D_CIRCLE 250,250,160
    2D_FILL_COLOR 255,255,255
    PRINT_LOCATE 245,52
    PRINT "N"
    PRINT_LOCATE 245,430
    PRINT "S"
    PRINT_LOCATE 433,242
    PRINT "E"
    PRINT_LOCATE 55,242
    PRINT "W"
    2D_FILL_COLOR 0,0,0
    FONT_COLOR 1,255,255,255
END_SUB
' ------------------------------------------------------------------------------
SUB Needle()
    PICTURE 3
    WIDTH 3,240
    HEIGHT 3,240
    TOP 3,130
    LEFT 3,130
    COLOR 3,0,0,0
    2D_TARGET_IS 3
    2D_PEN_COLOR 255,255,255
    ' Needle Tip
    2D_LINE 0,120,20,110
    2D_LINE 0,120,20,130
    2D_LINE 19,110,19,130
    2D_FILL_COLOR 255,255,255
    2D_FLOOD 6,120,255,255,255
    ' Needle Body
    2D_LINE 0,120,240,120
    2D_LINE 6,119,240,119
    2D_LINE 6,121,240,121
    ' Needle Center
    2D_CIRCLE 120,120,6
    2D_PEN_COLOR 0,0,0
    2D_CIRCLE 120,120,2
    ' Needle End
    2D_PEN_COLOR 255,255,255
    2D_CIRCLE 235,120,13
    2D_FILL_COLOR 0,0,0
    2D_CIRCLE 239,120,12
    IMAGE 4
    2D_IMAGE_COPY 4,0,0,240,240
    SCENE3D 2
    WIDTH 2,240
    HEIGHT 2,240
    LEFT 2,130
    TOP 2,130
    COLOR 2,0,0,0
    3D_PLANE 5
    3D_V_TILE 5,1
    3D_U_TILE 5,1
    CAM_POSITION 0,0,15.8
    3D_IMAGE_TEXTURE 5,4
END_SUB
' ------------------------------------------------------------------------------
SUB Instructions()
    PICTURE 50
    HEIGHT 50,40
    WIDTH 50,500
    TOP 50,500
    COLOR 50,0,0,0
    2D_TARGET_IS 50
    2D_FILL_COLOR 0,0,0
    PRINT_TARGET_IS 50
    FONT_NAME 50,"Times New Roman"
    FONT_SIZE 50,18
    FONT_ITALIC 50
    FONT_COLOR 50,255,255,255
    PRINT_LOCATE 55,8
    PRINT "Move the mouse   /   Bougez la souris"
END_SUB                        
' ------------------------------------------------------------------------------
Move1:
    x = MOUSE_X_POSITION(1)-250
    y = MOUSE_Y_POSITION(1)-250
    Action()
RETURN
' ------------------------------------------------------------------------------
Move2:
    x = MOUSE_X_POSITION(2)-120
    y = MOUSE_Y_POSITION(2)-120
    Action()
RETURN
' ------------------------------------------------------------------------------
SUB Action()
    IF x=0 AND y=0
    ELSE
        z = (ACOS(y/SQR(x*x+y*y))-180)*-1
    END_IF
    IF x < 0
        z=360-z
    END_IF
    3D_Z_ROTATE 5,(270-z)
    PRINT_LOCATE 237,383
    IF z > 9.99 THEN PRINT_LOCATE 233,383
    IF z > 99.99 THEN PRINT_LOCATE 229,383
    PRINT "  "+STR$(INT(z+0.5))+"°"+"     "
END_SUB
' ------------------------------------------------------------------------------
Quit:
    TERMINATE
RETURN

Boussole Bousso10
Revenir en haut Aller en bas
Jean Claude

Jean Claude


Nombre de messages : 5948
Age : 69
Localisation : 83 Var
Date d'inscription : 07/05/2009

Boussole Empty
MessageSujet: Re: Boussole   Boussole EmptySam 14 Juil 2018 - 10:42

Bravo Marc,

Un beau code bien propre ! Je garde sous le coude, ça peut servir. Very Happy

A+
Revenir en haut Aller en bas
Marc

Marc


Nombre de messages : 2372
Age : 63
Localisation : TOURS (37)
Date d'inscription : 17/03/2014

Boussole Empty
MessageSujet: Re: Boussole   Boussole EmptyLun 16 Juil 2018 - 14:03

Salut Jean-Claude !

Merci pour ton retour.

Il est vrai que c'est encore un "source gadget" qui ne sert à rien... Juste pour le plaisir de programmer.

Bonne journée estivale !
Revenir en haut Aller en bas
Ouf_ca_passe




Nombre de messages : 285
Age : 75
Localisation : Villeneuve d'Ascq (59-Dpt du NORD) France
Date d'inscription : 21/12/2015

Boussole Empty
MessageSujet: Re: Boussole   Boussole EmptyMer 18 Juil 2018 - 9:49

Bonjour les Panoramicien(ne)s et FBPanistes

Marc a écrit a écrit:

Il est vrai que c'est encore un "source gadget" qui ne sert à rien... Juste pour le plaisir de programmer.

Je ne suis pas d'accord avec ce que Marc a écrit.
Tout partage sur le forum (avec le code) mérite respect et considération.

Si Marc ou qq'un d'autre veut se lancer dans des simulations statiques ou dynamiques (avec animation), il y a des idées à prendre chez Phet Colorado ou QuCS (labo de physique) ou d'autres.

Cordialement
Revenir en haut Aller en bas
jean_debord

jean_debord


Nombre de messages : 1246
Age : 69
Localisation : Limoges
Date d'inscription : 21/09/2008

Boussole Empty
MessageSujet: Re: Boussole   Boussole EmptyMer 18 Juil 2018 - 11:06

Revenir en haut Aller en bas
http://www.unilim.fr/pages_perso/jean.debord/index.htm
Contenu sponsorisé





Boussole Empty
MessageSujet: Re: Boussole   Boussole Empty

Revenir en haut Aller en bas
 
Boussole
Revenir en haut 
Page 1 sur 1

Permission de ce forum:Vous ne pouvez pas répondre aux sujets dans ce forum
FORUM DE DISCUSSION SUR LE LANGAGE PANORAMIC :: PANORAMIC :: Vos sources, vos utilitaires à partager-
Sauter vers: