English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Language > Coders. Blitz Basic

 
 
Thread Tools
Old 26 December 2023, 10:28   #1
thyslo
Registered User
 
Join Date: Apr 2018
Location: Germany
Posts: 189
Problems drawing a Line in a Window

I've some simple lines of BB2 Code to open a window on the Workbench screen and draw a line from its left top edge to ist bottom right edge:

Code:
WbToScreen 0
Window 0, 0, 12, 320, 240, $100f, "Use +/- key to resize.", 1, 2
Use Window 0
Line 0,0,320,240,1

Repeat
  VWait
  ev.l = Event
Until ev = $200
The window is opened and can be closed with the Close-gadget. But the line isn't drawn. I've already tried it with other pens like 2 or 3 instead of the '1' from above but that didn't work either.

What could be the problem?
thyslo is offline  
Old 26 December 2023, 11:30   #2
Honitos
Registered User
 
Honitos's Avatar
 
Join Date: Nov 2019
Location: Celle / Germany
Posts: 145
To draw in a window, use the command Wline instead of Line!
Honitos is offline  
Old 26 December 2023, 18:28   #3
thyslo
Registered User
 
Join Date: Apr 2018
Location: Germany
Posts: 189
Thank you, this works

So, one more question regarding (the formatting of) line drawing.

Currently I have this call:

Code:
  WLine X+xoffset1, Y+yoffset1, X+xoffset2, Y+yoffset2, X+xoffset3, Y+yoffset3, X+xoffset4, Y+yoffset4, X+xoffset1, Y+yoffset1, 1
If I break it like
Code:
  WLine X+xoffset1, Y+yoffset1,
        X+xoffset2, Y+yoffset2,
        X+xoffset3, Y+yoffset3,
        X+xoffset4, Y+yoffset4,
        X+xoffset1, Y+yoffset1, 1
the compiler won't build it, gives a Syntax Error instead. Is it somehow possible to break long lines like this?
thyslo is offline  
Old 26 December 2023, 20:56   #4
Honitos
Registered User
 
Honitos's Avatar
 
Join Date: Nov 2019
Location: Celle / Germany
Posts: 145
Yes, but only with AmiBlitz. The editor of BlitzBasic does not Support that.

With AmiBlitz you can separate lines by using the @@ operator like this:

Wline 10,10, @@
20,20
Honitos is offline  
Old 28 December 2023, 18:49   #5
thyslo
Registered User
 
Join Date: Apr 2018
Location: Germany
Posts: 189
Thank you!

And one last question. I have a main loop that is basically like this:

Code:
Repeat
  VWait
  ev.l = Event
Until ev = $200
And as expected it runs until the windows close gadget is pressed.

But I seem to get no keyboard input from the window. I've put this line before the VWait:

if InKey$ = "-" and R>20 then R = R - 1


And when I press the '-' key the value of R is not changed. How can I get keyboard input? Must I use the result of
Event
because I'm in a Intuition window?
thyslo is offline  
Old 28 December 2023, 19:35   #6
thyslo
Registered User
 
Join Date: Apr 2018
Location: Germany
Posts: 189
Ah I got it: it works when I put the InKey$ result in a variable first:

Code:
pressed_key$ = Inkey$
if pressed_key$ = "-" and R>20 then R = R - 1
thyslo is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Normal horizontal line drawing issue leonard Coders. Asm / Hardware 3 29 March 2021 12:08
Blitter Line reverse drawing question sandruzzo Coders. Asm / Hardware 9 20 February 2021 05:52
Blitter line-drawing mode? E-Penguin Coders. Blitz Basic 2 13 April 2019 21:37
Blitter line drawing: nothing happens Crank Coders. General 21 25 April 2018 21:43
Drawing a line... Lonewolf10 Coders. Tutorials 24 06 September 2011 00:46

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 13:03.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.07158 seconds with 15 queries