Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Magnifier Over TImage Using Mouse Move (Code Review)

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1668

PostPosted: Thu Sep 22, 2022 11:20 pm    Post subject: Magnifier Over TImage Using Mouse Move (Code Review) Reply with quote

As the subject, I try make it. Is there anyone to review the code and fix it?.
The problem, code work not as expected Very Happy
Note, I already tried to use Draw / StretchDraw.

Code:
if Form1 then Form1.Destroy() end

Form1 = createForm()
Form1.setSize(700, 500)
Form1.Position = 'poScreenCenter'
Form1.Caption = 'CRDR - CE Magnifying Glass Effect'

PicMap = createImage(Form1)
PicMap.Align = 'alClient'
PicMap.BorderStyle = 'bsFixed'
PicMap.BorderWidth = 1
PicMap.Stretch = true
PicMap.Picture.loadFromStream(findTableFile('usmap.gif').Stream)

PicHidden = createImage(Form1)
PicHidden.Left = 648
PicHidden.Top = 448
PicHidden.Width = 165
PicHidden.Height = 106
PicHidden.Visible = false
PicHidden.Picture.loadFromStream(findTableFile('usmapsmall.jpg').Stream)

--------------------------------------------------------------------------------
SCALE_FACTOR  = 2
SMALL_RADIUS  = 25
BIG_RADIUS  = SMALL_RADIUS * SCALE_FACTOR
BIG_DIAMETER = 2 * BIG_RADIUS
--rect1 = {}
--rect2 = {}

function picMap_MouseMove(X, Y)
 X,Y = PicMap.ScreenToClient(getMousePos())
 PicMap.Repaint()

 --rect1.Left = X - BIG_RADIUS
 --rect1.Top = Y - BIG_RADIUS
 --rect1.Height = BIG_DIAMETER
 --rect1.Width = BIG_DIAMETER

 --rect2.Left = X * 2 - BIG_RADIUS
 --rect2.Top = Y * 2 - BIG_RADIUS
 --rect2.Height = BIG_DIAMETER
 --rect2.Width = BIG_DIAMETER

 par = [[ Original script in VB6 below :
 PaintPicture picHidden.Picture, _
 X - BIG_RADIUS, Y - BIG_RADIUS, BIG_DIAMETER, BIG_DIAMETER,
 X * 2 - BIG_RADIUS, Y * 2 - BIG_RADIUS, BIG_DIAMETER, BIG_DIAMETER) ]]

 --draw(x,y, graphic) : Draw the image of a specific Graphic class
 PicMap.Canvas.copyRect(X * 2 - BIG_RADIUS, Y * 2 - BIG_RADIUS, BIG_DIAMETER, BIG_DIAMETER, PicHidden.Picture.Bitmap.Canvas, X - BIG_RADIUS, Y - BIG_RADIUS, BIG_DIAMETER, BIG_DIAMETER)

 --draw(x,y, graphic) : Draw the image of a specific Graphic class
 -- Make border to magnifier
 --PicMap.Canvas.LineTo(X - BIG_RADIUS, Y - BIG_RADIUS, BIG_DIAMETER, BIG_DIAMETER)
end

function closed()
 closeCE()
 return caFree
end

Form1.Show()
PicMap.OnMouseMove = picMap_MouseMove
Form1.OnClose = closed

_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites