Code : Tout sélectionner
Global MaVariable_1.l=0,MaVariable_2.l=0,MaVariable_3.l=0,MaVariable_4.l=0
Procedure test(*pt)
Protected i
For i=0 To 3
PokeL(*pt+i*4,100 * i) ;4 représente la taille en octet d'un long
Next
EndProcedure
InitSprite()
InitKeyboard()
InitMouse()
Enumeration
#Fenetre_principale
#Canvas_principal
#Texte
#Sortie
#Aucune
EndEnumeration
Global Police = FontID(LoadFont(#PB_Any, "Arial Rounded MT", 15, #PB_Font_Bold))
Procedure VectorDrawText(X, Y, Texte$, CouleurTexte, Transparence = 255)
VectorSourceColor(RGBA(Red(CouleurTexte), Green(CouleurTexte), Blue(CouleurTexte), Transparence))
MovePathCursor(X, Y)
DrawVectorText(Texte$)
EndProcedure
Procedure VectorBox(X, Y, Largeur, Hauteur, Couleur, Transparence = 255)
VectorSourceColor(RGBA(Red(Couleur), Green(Couleur), Blue(Couleur), Transparence))
AddPathBox(X, Y, Largeur, Hauteur)
FillPath()
EndProcedure
Procedure Vector_LineXY(x1.d, y1.d, x2.d, y2.d, Epaisseur.d = 1.0, Couleur = 0, Transparence = 255)
MovePathCursor(x1, y1)
AddPathLine(x2, y2, #PB_Path_Default)
;VectorSourceColor(Couleur)
VectorSourceColor(RGBA(Red(Couleur), Green(Couleur), Blue(Couleur), Transparence))
StrokePath(Epaisseur)
EndProcedure
If InitSprite() = 0 Or InitKeyboard() = 0 Or InitMouse() = 0
MessageRequester("ERREUR","L'initialisation à échoué",#PB_MessageRequester_Error)
EndIf
ExamineDesktops() : Global Largeur_Ecran = DesktopWidth(0) , Hauteur_Ecran = DesktopHeight(0) , Profondeur = DesktopDepth(0)
Global x,y,z,Texte.s, h_Fenetre
Largeur_Ecran-10 : Hauteur_Ecran-40
h_Fenetre = OpenWindow(#Fenetre_principale, 0, 0, Largeur_Ecran, Hauteur_Ecran, "Test", #PB_Window_ScreenCentered)
OpenWindowedScreen(h_Fenetre, 0, 0, Largeur_Ecran, Hauteur_Ecran, 0, 0, 0, #PB_Screen_SmartSynchronization)
CanvasGadget(#Canvas_principal, 0, 0, Largeur_Ecran, Hauteur_Ecran)
ShowCursor_(#True) ; montrer le curseur
StartVectorDrawing(CanvasVectorOutput(#Canvas_principal))
VectorBox(0, 0, Largeur_Ecran, Hauteur_Ecran, #Black) ;pour nettoyer l'écran
VectorFont(Police)
test(@MaVariable_1)
Texte = "Valeur de ma variable 1: "
VectorDrawText(x, y, Texte + Str(MaVariable_1), #Yellow)
y + VectorTextHeight(" ")
Texte = "Valeur de ma variable 2: "
VectorDrawText(x, y, Texte + Str(MaVariable_2), #Yellow)
y + VectorTextHeight(" ")
Texte = "Valeur de ma variable 3: "
VectorDrawText(x, y, Texte + Str(MaVariable_3), #Yellow)
y + VectorTextHeight(" ")
Texte = "Valeur de ma variable 4: "
VectorDrawText(x, y, Texte + Str(MaVariable_4), #Yellow)
y + VectorTextHeight(" ")
Texte = "Pressez une touche ou cliquez pour sortir"
VectorDrawText(Largeur_Ecran/2-VectorTextWidth(Texte)/2,Hauteur_Ecran-VectorTextHeight(" "), Texte, #White)
;- fin d'affichage
StopVectorDrawing()
;- boucle d'événements
Global action.i = #Aucune
Repeat
Global Evenement = WindowEvent()
Select Evenement
Case #PB_Event_CloseWindow
action = #Sortie
Case 0
ExamineKeyboard()
If KeyboardPushed(#PB_Key_All)
action = #Sortie
EndIf
ExamineMouse()
If MouseButton(#PB_MouseButton_Left) <> 0
action = #Sortie
EndIf
If MouseButton(#PB_MouseButton_Middle) <> 0
action = #Sortie
EndIf
If MouseButton(#PB_MouseButton_Right) <> 0
action = #Sortie
EndIf
EndSelect
Until action = #Sortie
;- fermeture de l'écran & de la fenêtre
CloseScreen()
CloseWindow(#Fenetre_principale)
Plus de code à taper, mais on peut prévoir un fichier à inclure.