Problems with LINE
Posted: Sat Apr 01, 2023 1:05 pm
I was playing with 2dgraphics, wanted to make a triangle and couldn't make it if I put 0 in y increment. It works fine if I put 1 or -1 (see last lines of code)
I copy the code
Is there a problem with the language or am I doing something wrong?
If I put a 0 I can't see any line (it doesn't close the triangle. Perhaps is something that happens just in my system.
Any comments will be appreciated
I copy the code
Is there a problem with the language or am I doing something wrong?
If I put a 0 I can't see any line (it doesn't close the triangle. Perhaps is something that happens just in my system.
Any comments will be appreciated
Code: Select all
;MessageRequester("BARRA DE TÍTULOS","CUERPO DEL TEXTO QUE SE QUIERE VER",5);SI CAMBIO NUMERO SE CAMBIAN BOTONES
;ColorRequester()
If InitSprite() = 0
MessageRequester("ERROR", "NO SE PUEDE INICIALIZAR GRÁFICOS", 0)
End
EndIf
If InitKeyboard() = 0
MessageRequester("ERROR", "NO SE PUEDE INICIALIZAR TECLADO", 0)
End
EndIf
If InitSound() = 0
MessageRequester("ERROR", "NO SE PUEDE INICIALIZAR SONIDO", 0)
End
EndIf
If InitMouse() = 0
MessageRequester("ERROR", "NO SE PUEDE INICIALIZAR RATÓN", 0)
End
EndIf
OpenScreen(800,600,32,"BTÍTULO")
Repeat
ExamineKeyboard()
StartDrawing(ScreenOutput()) :
DrawingMode(1)
FrontColor(RGB(200,00,00))
Circle(100,100,50,RGB(0,0,125))
Box(100,300,125,75)
RoundBox(300,100,75,50,15,15,RGB(128,128,128))
RoundBox(300,175,75,50,10,10,RGB(200,200,200))
RoundBox(300,250,75,50,5,5,RGB(200,200,200))
RoundBox(300,325,75,50,30,30,RGB(128,128,128))
RoundBox(300,400,75,50,35,35,RGB(128,128,128))
Line(400,150,100,-100,RGB(250,250,50))
Line(600,150,-100,-100,RGB(250,250,50))
Line(600,150,-200,-1,RGB(250,250,50))
;FillArea(500,100,RGB(250,250,250))
Plot(500,125,RGB(250,250,50))
;FillArea(500,125,RGB(250,250,50),RGB(250,250,50))
Line(500,300,100,100,RGB(0,128,128))
Line(500,300,-100,100,RGB(0,128,128))
Line(600,400,-200,-1,RGB(0,128,128))
FillArea(550,350,RGB(0,128,128),RGB(0,128,128))
Line(500,450,25,100,RGB(0,175,175))
Line(500,450,-25,100,RGB(0,175,175))
Line(475,550,50,0,RGB(0,175,175))
;FillArea(500,500,RGB(0,175,175),RGB(0,150,200))
DrawText(10,10,"ESC-Fin")
StopDrawing()
FlipBuffers()
Until KeyboardReleased(#PB_Key_Escape)