locked
Newbie needs some help RRS feed

  • Question

  • Hi, I just started messing with small basic yesterday and am starting to get the hang of it but, I am trying to make a simple program that when the left mouse button is clicked it displays a picture and when it's not pressed it displays a different one. The problem is the screen is not cleared. I know I could use graphicswindow.clear() but the problem is I don't know were I could put it in my code so that it doesn't refresh every second no matter if anything has changed on screen. Any suggestions?The import code is XMK295 .

    Thanks in advance!
    Tuesday, December 1, 2009 12:13 AM

Answers

All replies

  • I suggest you explore mouse events.

    Example:

    Itachi = ImageList.LoadImage("http://img37.imageshack.us/img37/8111/itachidvdntsc.jpg")
    Naruto = ImageList.LoadImage("http://img37.imageshack.us/img37/841/narutopq.png")
    GraphicsWindow.Width = 800
    GraphicsWindow.Height = 500

    GraphicsWindow.MouseUp  = onMouseUp
    GraphicsWindow.MouseDown = onMouseDown

    Sub onMouseUp
    GraphicsWindow.Clear()
    GraphicsWindow.DrawImage(Naruto,0,0)
    EndSub

    Sub onMouseDown
     GraphicsWindow.Clear()
     GraphicsWindow.DrawImage(Itachi,0,0)
    EndSub

    • Marked as answer by p.d.khumara Tuesday, December 1, 2009 1:11 AM
    Tuesday, December 1, 2009 12:45 AM
  • well that works really well, It changes pictures over 50 times faster lol.... but I have one question... whats an event and how do  you use it
    Tuesday, December 1, 2009 12:57 AM
  • You can read Chapter 11 from Introducing Small Basic.pdf that's included in Small Basic installation.

    Tuesday, December 1, 2009 1:00 AM
  • thanks, that answered all my questions!
    Tuesday, December 1, 2009 1:11 AM