help with optimizing =)

Discussion in 'Questions (Windows Mobile)' started by Byak@, Nov 16, 2008.

  1. Byak@

    Byak@ Active Member Licensed User

    i'm write interesting algotitm.in desctop it work fast but in device...can you help me with optimizing?

    Code:
    Sub Globals
    xx=
    ""
    yy=
    ""
    End Sub

    Sub App_Start
    Form1.Show
    yy=bimg.Top+(bimg.Height/
    2)
    xx=bimg.Left+(bimg.Width/
    2)
    End Sub


    Sub Form1_Mousedown (x,y)
    bex.New1(AppPath&
    "\1.bmp")
    angle = 
    Abs(Round(ATan((Y - yy)/(x-xx+0.0001)) * 180/cPI))
    If X < xx Then
    If y>yy Then
    angle=
    180-angle
    Else
    angle = angle + 
    180
    End If
    Else
    If y<yy Then angle=360-angle
    End If
    'form1.Text=x&","&y&" :"&angle
    bex.Rotate(angle,cWhite)
    bimg.Image=bex.Value
    DoEvents
    End Sub
     
  2. agraham

    agraham Expert Licensed User

    That is probably as fast as it can go subjectively. I think the time is being taken up by the rotate which is doing a lot of floating point ops, and as devices don't have floating point hardware I think that is where the time is going. I doesn't seem that slow anyway, a couple of hundred milliseconds I'd guess, a noticable but not a long delay.
     
  3. Byak@

    Byak@ Active Member Licensed User

    agraham,if replace mouseup on mousemove(what i wan) i have big lags...in my flame VGA display,maybe it is problem?
     
  4. agraham

    agraham Expert Licensed User

    No, you are expecting too much of a relatively low powered device without hardware floating point handling a VGA sized screen quickly without programming at native code level.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice