Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
How to AceSlide centered on the screen? — Gideros Forum

How to AceSlide centered on the screen?

turker2000turker2000 Member
edited January 2016 in Plugins
Hi!
I designed a level screen using AceSlide. But how do you keep the middle of the screen in different resolution?

My Code:
	stage:addChild(slider)
 
	local levelsay = 0
 
	for i = 1, 10 do
		local group = Sprite.new()
 
		for ss = 1 , 5 do
 
			for ii = 1, 7, 2 do
 
				local box = Button.new(Bitmap.new(Texture.new("Ekranlar/halka.png")), Bitmap.new(Texture.new("Ekranlar/halka.png")))
				levelsay = levelsay + 1
				box:setScale(EkranGenislikOrani,EkranYukseklikOrani)
				box:setPosition(EkranGenisligi*(ii/10), EkranYuksekligi*(0.3+(ss/9.2)))
				--box:setPosition((150*EkranGenislikOrani)*ii, (240*EkranYukseklikOrani)*ss)
				group:addChild(box)
 
 
				local LevelSayYazi = TextField.new(PlayFont1, levelsay)
				LevelSayYazi:setScale(EkranGenislikOrani,EkranYukseklikOrani)
				LevelSayYazi:setTextColor(0xffffff)
				if levelsay < 10 then
					LevelSayYazi:setPosition(EkranGenisligi*(ii/10)+(box:getWidth()*0.38), (EkranYuksekligi*(0.3+(ss/9.2))+(box:getHeight()*0.65)))
				end
				if levelsay > 9 and levelsay < 100 then
					LevelSayYazi:setPosition(EkranGenisligi*(ii/10)+(box:getWidth()*0.29), (EkranYuksekligi*(0.3+(ss/9.2))+(box:getHeight()*0.65)))
				end
				if levelsay > 99 and levelsay < 1000 then
					LevelSayYazi:setPosition(EkranGenisligi*(ii/10)+(box:getWidth()*0.20), (EkranYuksekligi*(0.3+(ss/9.2))+(box:getHeight()*0.65)))
				end
				group:addChild(LevelSayYazi)
 
 
 
				if Level < levelsay then
					kilit  = Bitmap.new(Texture.new("Ekranlar/lock.png"))
					kilit:setScale(EkranGenislikOrani,EkranYukseklikOrani)
					kilit:setPosition(EkranGenisligi*(ii/10)+(box:getWidth()*0.33), (EkranYuksekligi*(0.3+(ss/9.2))-(box:getHeight()*0.18)))
					group:addChild(kilit)
				end
				if Level > levelsay then
					okey  = Bitmap.new(Texture.new("Ekranlar/okey_saydam.png"))
					okey:setScale(EkranGenislikOrani,EkranYukseklikOrani)
					okey:setPosition(EkranGenisligi*(ii/10)+(box:getWidth()*0.3), (EkranYuksekligi*(0.3+(ss/9.2))+(box:getHeight()*0.3))+ss)
					group:addChild(okey)
				end
 
			end
 
		end
 
	slider:add(group)
 
	end
 
	--display slider
	slider:show()

Comments

  • Go to the project properties and select the scale mode.
    Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!).
    https://deluxepixel.com
  • I can not use this method for all scaling objects. The result is getting worse.

  • I think I found the solution.
    application:setLogicalDimensions(application:getDeviceWidth(), application:getDeviceHeight())
    :)>-
Sign In or Register to comment.