Page 1 sur 1
100% debutant bloqué des 1er essai
Publié : jeu. 31/déc./2009 17:13
par drfloyd
Bon voilà je debute à 100% en basic et j'ai voulu teste l'affichage d'une box et une line dans une fenetre et rien ne fonctionne :
(je suis sur Mac)
; test purebasic
OpenConsole()
OpenWindow(1,100,100,500,500,"TITRE")
CreateImage (1,400,400)
StartDrawing(ImageOutput(1))
Box (10,10,200,200,RGB(80,80,80))
LineXY(0,0,400,400)
StopDrawing()
Repeat
Until Inkey()<>""
1. rien ne s'affiche dans la fenetre :/ ca reste blanc
2. le repeat/until ne fonctionne pas, je n'arrive pas a quitter en pressant une touche, ca tourne en boucle
je dois vous faire sourire !
merci de votre aide
Re: 100% debutant bloqué des 1er essai
Publié : jeu. 31/déc./2009 18:11
par Fred
Regardes les examples... Specialement 2DDrawing.pb.
Re: 100% debutant bloqué des 1er essai
Publié : jeu. 31/déc./2009 18:17
par drfloyd
c'est ce que je fais, sans succes
faut ouvrir une fenetre
creer une image
lancer le dessin
terminer le dessin
Mais ca s'affiche pas

bouhhhhh Apres il existe la fonction imagegadget mais je suis paumé
Bonne année au fait

Re: 100% debutant bloqué des 1er essai
Publié : jeu. 31/déc./2009 18:27
par zaphod
J'ai fait une appli qui fonctionne sous windows à partir de ton code :
Code : Tout sélectionner
;{- Enumerations / DataSections
;{ Windows
Enumeration
#Window_0
EndEnumeration
;}
;}
Procedure OpenWindow_Window_0()
If OpenWindow(#Window_0, 450, 200, 400, 400, "Window_0", #PB_Window_SystemMenu|#PB_Window_SizeGadget|#PB_Window_MinimizeGadget|#PB_Window_TitleBar)
StartDrawing(WindowOutput(#window_0))
Box (10,10,200,200,RGB(80,80,80))
LineXY(0,0,400,400)
StopDrawing()
EndIf
EndProcedure
OpenWindow_Window_0()
;{- Event loop
Repeat
Select WaitWindowEvent()
; ///////////////////
Case #PB_Event_Gadget
; ////////////////////////
Case #PB_Event_CloseWindow
Select EventWindow()
Case #Window_0
CloseWindow(#Window_0)
Break
EndSelect
EndSelect
ForEver
;
;}
Si ca peut t'aider...
Re: 100% debutant bloqué des 1er essai
Publié : jeu. 31/déc./2009 18:33
par drfloyd
bah non mais merci
c'est peut etre a cause du mac.....
Re: 100% debutant bloqué des 1er essai
Publié : ven. 01/janv./2010 15:06
par case
tu as surtout oublié le flipbuffers()
Re: 100% debutant bloqué des 1er essai
Publié : ven. 01/janv./2010 17:41
par Good07
Bonjour drfloyd,
Le programme suivant marche très bien sur Mac:
Code : Tout sélectionner
#Width=1024
#Height=768
If OpenWindow(0, 0, 0, #Width, #Height, "Test", #PB_Window_SystemMenu | #PB_Window_ScreenCentered | #PB_Window_MinimizeGadget) = 0
End
EndIf
LoadFont(1,"Times New Roman",36)
StartDrawing(WindowOutput(0))
Box(0,0,#width,#Height,RGB(255,255,255))
DrawingMode(#PB_2DDrawing_Transparent)
DrawingFont(FontID(1))
DrawText(10,10,"Ceci est un essai",RGB(0,0,0))
Circle(100,100,50,RGB(26, 237, 229))
DrawingMode(#PB_2DDrawing_Outlined)
Box(399,199,152,122,RGB(0,0,0))
DrawingMode(#PB_2DDrawing_Default)
Box(400, 200, 50, 120,RGB(17, 26, 238))
Box(450, 200, 50, 120,RGB(255, 255, 255))
Box(500, 200, 50, 120,RGB(242, 18, 13))
DrawingMode(1)
For Angle = 0 To 360 Step 3
LineXY(100, 300, 100+Cos(Angle)*90, 300+Sin(Angle)*90, RGB(Random(255), Random(255), Random(255)))
Next Angle
StopDrawing()
Repeat
Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow
End
Tu peux rajouter ce que tu veux entre StartDrawing et StopDrawing (line, box, circle). Il n'y a pas de problème.
Par ailleurs, merci à Fred et à toute l'équipe, la version 4.40 fonctionne à merveille sous Mac. Plus de problèmes avec StartDrawing(WindowOutput())
