Page 1 sur 1

dessin 2D

Publié : sam. 30/juil./2005 13:31
par nico
Je ne suis pas très doué en dessin, est-ce que vous auriez des infos sur la façon de dessiner par exemple un cercle en donnant du relief de façon à faire apparaître une demi sphère.

Il doit y avoir des techniques, j'imagine!

:)

Publié : sam. 30/juil./2005 13:34
par lionel_om
Euh, je comprend pas ce que tu veux dire...
J'ai mis qq dessins sur mon site, pour ceux que ça inté&resdse de regarder (rubrique dessins)

Publié : sam. 30/juil./2005 14:02
par nico
Ben c'est simple, donner de la dimension aux dessins et pas seulement dessiner un cercle mais lui donner du relief.

Publié : sam. 30/juil./2005 14:39
par fweil
nico,

Un jouet pour dire si ça répond en partie à ta question ! Si ça va dans le bon sens j'ajouterai des skins et des paramètres si possible.

Code : Tout sélectionner

Enumeration
  #Window_Main
  #Image
EndEnumeration

  WindowWidth = 640
  WindowHeight = 480
  MaxModes = 1
  If OpenWindow(#Window_Main, 0, 0, WindowWidth, WindowHeight, #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget | #PB_Window_TitleBar | #PB_Window_ScreenCentered, "MyWindow")
      AddKeyboardShortcut(#Window_Main, #PB_Shortcut_Escape, #PB_Shortcut_Escape)
      AddKeyboardShortcut(#Window_Main, #PB_Shortcut_F1, #PB_Shortcut_F1)
      AddKeyboardShortcut(#Window_Main, #PB_Shortcut_Left, #PB_Shortcut_Left)
      AddKeyboardShortcut(#Window_Main, #PB_Shortcut_Right, #PB_Shortcut_Right)
      If CreateGadgetList(WindowID(#Window_Main))
      EndIf
      ImageID = CreateImage(#Image, WindowWidth, WindowHeight)
      cx = WIndowWidth / 2
      cy = WindowHeight / 2
      Quit = #FALSE
      Repeat
        StartDrawing(ImageOutput())
          Radius = 100 * Int(WindowHeight / 100) / 2
          Select Mode
            Case 0
              yRadius = Radius
              For xRadius = yRadius To 0 Step -1
                Color = 255 * xRadius / Radius
                Ellipse(cx, cy, xRadius, yRadius, Color)
              Next
            Case 1
              For x = 0 To Radius
                Color = 255 * x / Radius
                Circle(cx - x / 2, cy + x / 3, Radius - x, Color)
              Next
          EndSelect
        StopDrawing()
        Select WindowEvent()
          Case #PB_Event_CloseWindow
            Quit = #TRUE
          Case #PB_Event_Menu
            Select EventMenuID()
              Case #PB_Shortcut_Escape
                Quit = #TRUE
              Case #PB_Shortcut_F1
                Statistics = 1 - Statistics
              Case #PB_Shortcut_Left
                Mode - 1
                If Mode < 0
                    Mode = 0
                EndIf
              Case #PB_Shortcut_Right
                Mode + 1
                If Mode > MaxModes
                    Mode = MaxModes
                EndIf
            EndSelect
          Case #PB_Event_SizeWindow
            WindowWidth = WindowWidth()
            WindowHeight = WindowHeight()
            ImageID = CreateImage(#Image, WindowWidth, WindowHeight)
            cx = WIndowWidth / 2
            cy = WindowHeight / 2
        EndSelect
        StartDrawing(WindowOutput())
          DrawImage(ImageID, 0, 0)
          If Statistics
              BackColor(0, 0, 40)
              FrontColor(255, 255, 255)
              Locate(10, 10)
              DrawText("FPS : " + Str(FPS))
          EndIf
        StopDrawing()
        NFrames + 1
        If ElapsedMilliseconds() - tz => 1000
            FPS = NFrames
            NFrames = 0
            tz = ElapsedMilliseconds()
        EndIf
        Delay(1)
      Until Quit
  EndIf
End

Publié : sam. 30/juil./2005 15:10
par Le Soldat Inconnu
ou alors comme ceci


il faut ma lib Effect pour lancé ce code

Code : Tout sélectionner

Rayon = 45
x = 50
y = 50
Couleur = RGB(50, 200, 25)

CreateImage(0, 100, 100)
StartDrawing(ImageOutput())

  For n = 0 To Rayon - 1
    
    CouleurCercle = ColorLuminosity(Couleur, 0.75 + n / Rayon / 2)
    
    DeplacementCercle = n / (2 * Sqr(2))
    
    Circle(x - DeplacementCercle, y - DeplacementCercle, Rayon - n, CouleurCercle)
  Next
   
StopDrawing()

If OpenWindow(0, 0, 0, 300, 300, #PB_Window_SystemMenu | #PB_Window_ScreenCentered | #PB_Window_MinimizeGadget, "Test") = 0 Or CreateGadgetList(WindowID()) = 0
  End
EndIf

ImageGadget(0, 0, 0, 100, 100, UseImage(0))

Repeat
  Event = WaitWindowEvent()
  
Until Event = #PB_EventCloseWindow

Publié : sam. 30/juil./2005 18:06
par nico
C'est bien trouvé, mais je perd l'effet en utilisant la transparence. :roll: