Liberty BASIC Community Forum
« Search Results »

Welcome Guest. Please Login or Register.
May 26th, 2015, 8:29pm


Rules|Home|Help|Search|Recent Posts|Notification

--Liberty BASIC Resources--
Yahoo Code Repository (source must be included)
Liberty BASIC Community WikiSpace
Liberty Labs
Bay Six Software Forum
Liberty BASIC Home Page

Official Liberty BASIC Support
Liberty BASIC Programmer's Encyclopedia
Liberty BASIC 5 Handbook
Liberty BASIC on Rosetta Code

Search Results

Total results: 10


 1   Novice / Re: Graphics vs GraphicsBox type windows  on: Today at 10:16am
Started by lbas447 | Post by Rod
The one thing I would change in John's code is to swap the down command in the drawing loop with discard. Down isn't needing to be repeated, discard will ensure the repetitive drawing does not use memory.

So if you wanted to pause and flush, only the last drawn line would be saved to a segment as all the previous drawing has been discarded from the live segment.
 
  Reply Quote Notify of replies

 2   Novice / Re: Graphics vs GraphicsBox type windows  on: Today at 09:38am
Started by lbas447 | Post by lbas447

I am updating the display at 100 Hz, so there is a lot of flicker if the whole screen is redrawn each time. So I can't use CLS. But I think I understand.

The XOR method works well-no flicker, very smooth. I'll investigate Sprites, BMPs etc. to gain other ways.

Thanks,
John
 
  Reply Quote Notify of replies

 3   Novice / Re: Graphics vs GraphicsBox type windows  on: Today at 06:03am
Started by lbas447 | Post by Rod
Your original code needed a tweak.

Code:
nomainwin
open "Graphics" for graphics_nsb as #graph
xx=50
yy=50

xx1=100
yy1=100

for n= 1 to 50
xx=xx+1
    print #graph, "up"
    print #graph, "goto ";xx;" ";yy ' go to NEW P1 (initial point for line draw
    print #graph, "down"
    print #graph, "goto ";xx1;" ";yy1 ' draw new line from new P1 to new P2
    print #graph, "segment segnum"; ' get seg # for new line
    print #graph, "flush" ' new segnum should now be one greater than last segnum
    print #graph, "delsegment ";segnum-2 ' discard seg for old line
    print #graph, "cls ; redraw segnum-1"

next
wait
 


So to answer the question, no the graphics will not be removed from the screen. I did that with a cls command.

So the code works but its not the right strategy to use for drawing. John answered that.

The confusion I think is to do with the fact that FLUSH and SEGMENTS are all about fixing drawn graphics to display permanently and so not be wiped out if they are covered or minimised/restored.

There are a couple of strategies for displaying moving graphics. If the display is updating itself regularly you perhaps don't need to flush/segment every iteration, just when you pause.

Sprite engine is good too. Also the blitter. If you outline the task folks might offer other strategies but Johns reply should sort the problem.

So segments are background copies of the drawn screen go here for more info

http://lbpe.wikispaces.com/Graphic+Segments

and here

http://lbpe.wikispaces.com/SegmentsAndFlushing
 
  Reply Quote Notify of replies

 4   Internet and network programming / A VERY simple web page Generator  on: Today at 12:55am
Started by michael gallup | Post by michael gallup
For the fist trial just put a couple words per line .
It is just a sample program generator .. I will be making a very powerful version later with graphics display !!
Code:
input "Website name (just a name) : "; W$
input "Enter the Title on the Page : "; T$
input "Enter the first Subtitle : "; st$
input "Enter  first paragraph : "; art1$
open "Myweb.html" for output as #1
print#1, "<!DOCTYPE html>"
print#1, "<html lang=" + chr$(34) + "en" + chr$(34) + ">"
print#1, "<head>"
NL$ = "<meta charset=" +chr$(34) + "UTF-8"+ chr$(34) + ">"
print #1, NL$
NL$ = "<title>"+W$+"</title>" ' This will show at the top of the browser along with the path to the file
print #1, NL$
print #1, "</head>"
print #1, "<body>"
NL$ = "<h1 style="+chr$(34)+"text-align:center; color:red" + Chr$(34) + ">" + T$ + "</h1>"  'The title at the top of the page
print #1, NL$
NL$ = "<h2>" + st$ + "</h2>"
print #1, NL$
NL$ = "<p>" + art1$ + "</p>"
print #1, NL$
print #1, "</body>"
print #1, "</html>"
close #1
print "OK now close this program and look for an internet file called "
input "'Myweb.html' right click it and open it"; done$

wait
end



 

 
  Reply Quote Notify of replies

 5   Novice / Re: Graphics vs GraphicsBox type windows  on: Yesterday at 10:06pm
Started by lbas447 | Post by lbas447
Thanks,

That is what I did, use the XOR pen mode to retrace the line before writing a new line. Works fine.

I wanted to get the segments working, but so far with no luck.

When a segment is deleted, like with "delsegment SegName", the screen still retains the image until a redraw. What I don't understand is, if I redraw (another segment by name), is the deleted segment suppose to disappear from the screen? So far that hasn't happened in my experiments.

John
 
  Reply Quote Notify of replies

 6   Novice / Re: Graphics vs GraphicsBox type windows  on: Yesterday at 5:20pm
Started by lbas447 | Post by tenochtitlanuk
If you understand the logic operator XOR you may find it easier to program with the drawing rule set to XOR rathher than work with segments.
Code:
    nomainwin

    WindowWidth  = 600:     WindowHeight = 600

    r =2 *3.14159265 /360

    open "Tumbling line" for graphics_nsb as #w

    #w "trapclose [quit]"

    #w "color red ; rule OVER ; goto 300 300 ; down ; fill 0 0 0 ; size 4"
    #w "rule XOR"

    for i =0 to 3600 step 6
        scan
        #w "down"
        #w "color 0 255 255"
        #w "goto "; 300 +200 *sin( i *r); " "; 300 -200 *cos( i *r)
        calldll #kernel32,"Sleep", 100 as ulong, r as void
        #w "goto "; 300; " "; 300
    next i

    wait

[quit]
    close #w
    end
 


 
  Reply Quote Notify of replies

 7   Novice / Re: Graphics vs GraphicsBox type windows  on: Yesterday at 3:18pm
Started by lbas447 | Post by lbas447
Hello again,

I'm sure its a bug in my code. (This is in window type "graphics")
Here is a sample of code. I am trying to draw a line. Then calculate a new line. After that discard the old line and draw the new line, repetitively. This code is part of a loop that waits for data available, then processes it in this code. But all my efforts at making lines disappear using flush, segment, delsegment, redraw, etc fail. This code is just one of many experiments to get a line to disappear with these commands but without success. All plotted lines remain, piling up on the screen, whereas I want only one line, to appear in motion.

Code:
print #graph, "up"
            print #graph, "goto ";xx;" ";yy    ' go to NEW P1 (initial point for line draw
            print #graph, "down"
            print #graph, "goto ";xx1;" ";yy1 ' draw new line from new P1 to new P2
            print #graph, "segment segnum";    ' get seg # for new line
            print #graph, "flush"              ' new segnum should now be one greater than last segnum
            print #graph, "discard ";segnum-2  ' discard seg for old line
            print #graph, "redraw segnum-1" 

 
  Reply Quote Notify of replies

 8   Novice / Re: Graphics vs GraphicsBox type windows  on: Yesterday at 2:30pm
Started by lbas447 | Post by Rod
They should all work so coding bug?. If you are only doing graphics then a graphics window fits the bill. If you intend to mix graphics and controls of any description then choose a window of type window and insert a graphic box control within it. Pop up is worth an explore if you have a truly graphic application because it hides all of the traditional windows trappings. With transparency you can have truly photorealistic floating gadgets that look nothing like standard windows. Think Winamp etc etc
 
  Reply Quote Notify of replies

 9   Novice / Graphics vs GraphicsBox type windows  on: Yesterday at 2:21pm
Started by lbas447 | Post by lbas447
Can anyone describe briefly what are the differences between these 2 types of windows? Is there documentation that details the differences? I can't find it.

Do all the commands related to segments, redraw, delsegment, flush, etc. work in "graphics" type window? I am having trouble getting this to work. Do I need to open a graphics box instead?

Thanks,
John
 
  Reply Quote Notify of replies

 10   Liberty BASIC Code / Re: turning off graphics box  on: Yesterday at 2:02pm
Started by rich357 | Post by Stefan Pendl
Using the STYLEBITS command, you can remove the _WS_BORDER style.

See the style bits series over at LBPE for further information.
 
  Reply Quote Notify of replies


Rules|Home|Help|Search|Recent Posts|Notification



Donate $6.99 for 50,000 Ad-Free Pageviews!

| |

This forum powered for FREE by Conforums ©
Sign up for your own Free Message Board today!
Terms of Service | Privacy Policy | Conforums Support | Parental Controls