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 


Trainer Scaling/Resizing

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
Octopus3535
How do I cheat?
Reputation: 0

Joined: 12 Mar 2016
Posts: 4
Location: the void

PostPosted: Thu Aug 10, 2023 9:07 pm    Post subject: Trainer Scaling/Resizing Reply with quote

I made a trainer, and for the most part it works fine for me. I made at 2160p so it's a bit large. On smaller screens like 1080p it cuts off the bottom and there's no way to get to it. Is there away to make it so you can resize the window and everything shrinks proportionately? I've tried messing with ChildSizing and AutoScroll. Auto scroll breaks the trainer and when opened has an error message about an access violation. Child sizing seemed like it worked but moved everything so it was unusable. So i anchored everything and it doesn't work anymore.

I have included said trainer and layout.
Back to top
View user's profile Send private message
AylinCE
Grandmaster Cheater Supreme
Reputation: 37

Joined: 16 Feb 2017
Posts: 1516

PostPosted: Fri Aug 11, 2023 1:31 am    Post subject: Reply with quote

You can get ideas from this code.
My advice is to use scaling as the default 96.

Probably the code I've hidden won't do you any good.
But if you want to resize the control for each pixel change, have a look at the hidden code.
(Still, this may cause you to add too many lines of code.)

Code:
if myForm1 then myForm1.Destroy() myForm1=nil end

DP1=getScreenDPI()/96  -- default CE dpi

myForm1=createForm() or {}
--myForm1 = your Trainer name UDF1 or ..

--[[
function dpiScrn()
local scrHeight = getScreenHeight()
local scrWidth = getScreenWidth()
print(scrHeight,scrWidth)
local DP1
  if tonumber(scrWidth)==1680 then
    DP1=getScreenDPI()/50
  elseif scrWidth=="1080" then
    DP1=getScreenDPI()/76
  elseif scrWidth=="900" then
    DP1=getScreenDPI()/100
  else
    DP1=getScreenDPI()/96  -- default CE dpi
  end
return DP1
end

DP1=dpiScrn()
]]

myForm1.height=200*DP1 myForm1.width=350*DP1 myForm1.left=261*DP1 myForm1.top=98*DP1
myForm1.PopupMode=0 myForm1.caption="myForm1"
myForm1.Position="poDesktopCenter" myForm1.BorderStyle="bsSingle"  myForm1.ShowInTaskBar="stAlways"
-------------------------
--local myForm1 = {}
----------------------- myForm1.CEButton1 ----- 
myForm1.CEButton1=createButton(myForm1)
myForm1.CEButton1.AutoSize=false
myForm1.CEButton1.height=30*DP1 myForm1.CEButton1.width=100*DP1 myForm1.CEButton1.left=50*DP1 myForm1.CEButton1.top=50*DP1
myForm1.CEButton1.caption="CEButton1"
myForm1.CEButton1.Font.Style="fsBold" myForm1.CEButton1.Font.Size=0*DP1
-----------------------
----------------------- myForm1.CEEdit1 ----- 
myForm1.CEEdit1=createEdit(myForm1)
myForm1.CEEdit1.AutoSize=false
myForm1.CEEdit1.height=30*DP1 myForm1.CEEdit1.width=100*DP1 myForm1.CEEdit1.left=200*DP1 myForm1.CEEdit1.top=50*DP1
myForm1.CEEdit1.text=""
myForm1.CEEdit1.alignment="taLeftJustify"
myForm1.CEEdit1.Font.Style="fsBold" myForm1.CEEdit1.Font.Size=0*DP1
-----------------------
----------------------- myForm1.CEButton2 ----- 
myForm1.CEButton2=createButton(myForm1)
myForm1.CEButton2.AutoSize=false
myForm1.CEButton2.height=30*DP1 myForm1.CEButton2.width=100*DP1 myForm1.CEButton2.left=50*DP1 myForm1.CEButton2.top=85*DP1
myForm1.CEButton2.caption="CEButton1"
myForm1.CEButton2.Font.Style="fsBold" myForm1.CEButton2.Font.Size=0*DP1
-----------------------
----------------------- myForm1.CEButton3 ----- 
myForm1.CEButton3=createButton(myForm1)
myForm1.CEButton3.AutoSize=false
myForm1.CEButton3.height=30*DP1 myForm1.CEButton3.width=100*DP1 myForm1.CEButton3.left=50*DP1 myForm1.CEButton3.top=120*DP1
myForm1.CEButton3.caption="CEButton1"
myForm1.CEButton3.Font.Style="fsBold" myForm1.CEButton3.Font.Size=0*DP1
-----------------------
----------------------- myForm1.CEButton4 ----- 
myForm1.CEButton4=createButton(myForm1)
myForm1.CEButton4.AutoSize=false
myForm1.CEButton4.height=30*DP1 myForm1.CEButton4.width=100*DP1 myForm1.CEButton4.left=50*DP1 myForm1.CEButton4.top=155*DP1
myForm1.CEButton4.caption="CEButton1"
myForm1.CEButton4.Font.Style="fsBold" myForm1.CEButton4.Font.Size=0*DP1
-----------------------
----------------------- myForm1.CEEdit2 ----- 
myForm1.CEEdit2=createEdit(myForm1)
myForm1.CEEdit2.AutoSize=false
myForm1.CEEdit2.height=30*DP1 myForm1.CEEdit2.width=100*DP1 myForm1.CEEdit2.left=200*DP1 myForm1.CEEdit2.top=85*DP1
myForm1.CEEdit2.text=""
myForm1.CEEdit2.alignment="taLeftJustify"
myForm1.CEEdit2.Font.Style="fsBold" myForm1.CEEdit2.Font.Size=0*DP1
-----------------------
----------------------- myForm1.CEEdit3 ----- 
myForm1.CEEdit3=createEdit(myForm1)
myForm1.CEEdit3.AutoSize=false
myForm1.CEEdit3.height=30*DP1 myForm1.CEEdit3.width=100*DP1 myForm1.CEEdit3.left=200*DP1 myForm1.CEEdit3.top=120*DP1
myForm1.CEEdit3.text=""
myForm1.CEEdit3.alignment="taLeftJustify"
myForm1.CEEdit3.Font.Style="fsBold" myForm1.CEEdit3.Font.Size=0*DP1
-----------------------
----------------------- myForm1.CEEdit4 ----- 
myForm1.CEEdit4=createEdit(myForm1)
myForm1.CEEdit4.AutoSize=false
myForm1.CEEdit4.height=30*DP1 myForm1.CEEdit4.width=100*DP1 myForm1.CEEdit4.left=200*DP1 myForm1.CEEdit4.top=155*DP1
myForm1.CEEdit4.text=""
myForm1.CEEdit4.alignment="taLeftJustify"
myForm1.CEEdit4.Font.Style="fsBold" myForm1.CEEdit4.Font.Size=0*DP1
-----------------------

myForm1.CEButton1.OnClick=function()
local scrHeight = getScreenHeight()
local scrWidth = getScreenWidth()
print(scrHeight,scrWidth)
end

_________________
Hi Hitler Different Trainer forms for you!
https://forum.cheatengine.org/viewtopic.php?t=619279
Enthusiastic people: Always one step ahead
Do not underestimate me Master: You were a beginner in the past
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Dark Byte
Site Admin
Reputation: 470

Joined: 09 May 2003
Posts: 25788
Location: The netherlands

PostPosted: Fri Aug 11, 2023 5:27 pm    Post subject: Reply with quote

find the CE exe, and copy it to cheatengine-somethingelse.exe
rightclick the new file and go to properties->compatibility tab

click on "change high dpi settings" and set "override high DPI scaling behaviour" to "system"

Now use that .exe to create your trainers and make sure that the "scaled" property of the form is set to true. This will make it scale images buttons and everything else according to the design on low dpi

(This is for ce 7.5 trainers, earlier versions always run at low dpi)

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
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