Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
help with box making
#1
why doesnt this work:

Code:
declare sub box
screen 12
dim shared mb
dim shared mx
dim shared my
dim shared scr(307200)

setmouse 1,1,1
do until a$=chr$(27)
   a$=inkey$
   getmouse mx,my,,mb
   if mb = 1 then call box
loop

sub box
   oldx=mx
   oldy=my
   get (1,1)-(640,400),scr
   do until mb <> 1
      getmouse x,y,,mb
      if oldx <>x then
         line (mx,my)-(oldx,oldy),0,b
         line (mx,my)-(x,y),7,b
         oldx=x
      end if
      if oldy <>y then
         line (mx,my)-(oldx,oldy),0,b
         line (mx,my)-(x,y),7,b
         oldy=y
      end if
      
   loop
   cls
   put (1,1),scr
   line (mx,my)-(x,y),7,b
end sub
his world has been connected...
Tied to the darkness.
Soon to be completely eclipsed.
There is so very much to learn...
You understand so little.
A meaningless effort.
One who knows nothing can understand nothing.
-Ansem Bringer of darkness and creator of the heartless
Reply
#2
What's is -supposed- to do?

For me it has a click and drag box thing.
[Image: sig.php]
Back by popular demand!
I will byte and nibble you bit by bit until nothing remains but crumbs.
Reply
#3
sorry shouldve explained it more
Its a click and drag box (pritty simple) i dont want it to delete what was left there b4 so i want it to take a screen shot of the screen first then have it put it back there bot it doest like my put command and it freezes
his world has been connected...
Tied to the darkness.
Soon to be completely eclipsed.
There is so very much to learn...
You understand so little.
A meaningless effort.
One who knows nothing can understand nothing.
-Ansem Bringer of darkness and creator of the heartless
Reply
#4
here ya go i think


Code:
screen 12, ,2


dim scr((640 * 480) \ 4 + 1) As Integer


ScreenSet 0, 1


Do

  a$ = Inkey$
  getMouse xx,yy,,mb 'dummy xx yy, only want the mb here...


  put (0,0),scr, Pset 'make the background


  If holdstate = -1 Then 'if holding

    getmouse x,y,, 'get current x y

    If x <> -1 Then 'if mouse is in screen(works without, but causes weirdness when you hold and go off screen)
      line (mx,my)-(x,y),7,b' draw between the 2
  
    End If
  
  End If


  If mb = 1 Then 'if clicking
          
    If Not holdstate Then 'if not already holding
      getMouse mx,my 'grab the mx my of where holding begins
      holdstate = -1
      
    End If
      
  Else 'if not clicking
    If holdstate Then Get (0,0)-(639,479),scr 'if WAS holding, but now button off
    holdstate = 0

  End If  
  

  ScreenCopy
  Cls

Loop Until Multikey(1) Or a$ = Chr$(255) + "X"


edit forgot Loop :P
Reply
#5
you wouldnt mind explaining why mine didnt work would you
his world has been connected...
Tied to the darkness.
Soon to be completely eclipsed.
There is so very much to learn...
You understand so little.
A meaningless effort.
One who knows nothing can understand nothing.
-Ansem Bringer of darkness and creator of the heartless
Reply
#6
it was all the flow of your program, you would halt the flow once there was a mouse button, where as mine the control flows through the whole prog the whole time, only changing direction based on states.

thats the best way i can put it. im sure theres a way you couldve fixed your logic but it was just easier to scrap that model and go for the FSM approach, imo.
Reply
#7
:o Please dont tell me your making a fake OS.....please....
i]"But...it was so beautifully done"[/i]
Reply
#8
nah im not id just thought i would try it. Im not even NEAR that stage in programming
his world has been connected...
Tied to the darkness.
Soon to be completely eclipsed.
There is so very much to learn...
You understand so little.
A meaningless effort.
One who knows nothing can understand nothing.
-Ansem Bringer of darkness and creator of the heartless
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)