mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-07 13:15:01 +00:00
Remove Win32API calls & upgrade to modern Ruby (#96)
* Win32API removal + Ruby 3 updates * Update binaries to match mkxp-z 2.1
This commit is contained in:
@@ -141,7 +141,7 @@ def pbTrackPopupMenu(commands)
|
||||
menuwindow.update
|
||||
hit=menuwindow.hittest
|
||||
menuwindow.index=hit if hit>=0
|
||||
if Input.triggerex?(Input::LeftMouseKey) || Input.triggerex?(Input::RightMouseKey) # Left or right button
|
||||
if Input.trigger?(Input::MOUSELEFT) || Input.trigger?(Input::MOUSELEFT) # Left or right button
|
||||
menuwindow.dispose
|
||||
return hit
|
||||
end
|
||||
@@ -251,7 +251,7 @@ class AnimationWindow < SpriteWrapper
|
||||
def update
|
||||
mousepos=Mouse::getMousePos
|
||||
@changed=false
|
||||
return if !Input.repeatex?(Input::LeftMouseKey)
|
||||
return if !Input.repeat?(Input::MOUSELEFT)
|
||||
return if !mousepos
|
||||
return if !self.animbitmap
|
||||
arrowwidth=@arrows.bitmap.width/2
|
||||
@@ -276,7 +276,7 @@ class AnimationWindow < SpriteWrapper
|
||||
end
|
||||
# Left arrow
|
||||
if left.contains(mousepos[0],mousepos[1])
|
||||
if Input.repeatcount(Input::LeftMouseKey)>30
|
||||
if Input.count(Input::MOUSELEFT)>30
|
||||
@start-=3
|
||||
else
|
||||
@start-=1
|
||||
@@ -286,7 +286,7 @@ class AnimationWindow < SpriteWrapper
|
||||
end
|
||||
# Right arrow
|
||||
if right.contains(mousepos[0],mousepos[1])
|
||||
if Input.repeatcount(Input::LeftMouseKey)>30
|
||||
if Input.count(Input::MOUSELEFT)>30
|
||||
@start+=3
|
||||
else
|
||||
@start+=1
|
||||
@@ -800,7 +800,7 @@ class AnimationCanvas < Sprite
|
||||
cel=currentCel
|
||||
mousepos=Mouse::getMousePos
|
||||
if mousepos && pbSpriteHitTest(self,mousepos[0],mousepos[1],false,true)
|
||||
if Input.triggerex?(Input::LeftMouseKey) # Left mouse button
|
||||
if Input.trigger?(Input::MOUSELEFT) # Left mouse button
|
||||
selectedcel=-1
|
||||
usealpha=(Input.press?(Input::ALT)) ? true : false
|
||||
for j in 0...PBAnimation::MAX_SPRITES
|
||||
@@ -827,7 +827,8 @@ class AnimationCanvas < Sprite
|
||||
end
|
||||
end
|
||||
currentFrame=getCurrentFrame
|
||||
if currentFrame && !@selecting && Input.repeat?(Input::TAB)
|
||||
if currentFrame && !@selecting &&
|
||||
(Input.triggerex?(:TAB) || Input.repeatex?(:TAB))
|
||||
currentFrame.length.times {
|
||||
@currentcel+=1
|
||||
@currentcel=0 if @currentcel>=currentFrame.length
|
||||
@@ -841,42 +842,42 @@ class AnimationCanvas < Sprite
|
||||
cel[AnimFrame::Y]=mousepos[1]-BORDERSIZE+@selectOffsetY
|
||||
@dirty[@currentcel]=true
|
||||
end
|
||||
if !Input.getstate(Input::LeftMouseKey) && @selecting
|
||||
if !Input.press?(Input::MOUSELEFT) && @selecting
|
||||
@selecting=false
|
||||
end
|
||||
if cel
|
||||
if Input.repeat?(Input::DELETE) && self.deletable?(@currentcel)
|
||||
if (Input.triggerex?(:DELETE) || Input.repeatex?(:DELETE)) && self.deletable?(@currentcel)
|
||||
@animation[@currentframe][@currentcel]=nil
|
||||
@dirty[@currentcel]=true
|
||||
return
|
||||
end
|
||||
if Input.repeatex?(0x50) # "P" for properties
|
||||
if Input.triggerex?(0x50) || Input.repeatex?(0x50) # "P" for properties
|
||||
pbCellProperties(self)
|
||||
@dirty[@currentcel]=true
|
||||
return
|
||||
end
|
||||
if Input.repeatex?(0x4C) # "L" for lock
|
||||
if Input.triggerex?(0x4C) || Input.repeatex?(0x4C) # "L" for lock
|
||||
cel[AnimFrame::LOCKED]=(cel[AnimFrame::LOCKED]==0) ? 1 : 0
|
||||
@dirty[@currentcel]=true
|
||||
end
|
||||
if Input.repeatex?(0x52) # "R" for rotate right
|
||||
if Input.triggerex?(0x52) || Input.repeatex?(0x52) # "R" for rotate right
|
||||
cel[AnimFrame::ANGLE]+=10
|
||||
cel[AnimFrame::ANGLE]%=360
|
||||
@dirty[@currentcel]=true
|
||||
end
|
||||
if Input.repeatex?(0x45) # "E" for rotate left
|
||||
if Input.triggerex?(0x45) || Input.repeatex?(0x45) # "E" for rotate left
|
||||
cel[AnimFrame::ANGLE]-=10
|
||||
cel[AnimFrame::ANGLE]%=360
|
||||
@dirty[@currentcel]=true
|
||||
end
|
||||
if Input.repeatex?(0x6B) # "+" for zoom in
|
||||
if Input.triggerex?(0x6B) || Input.repeatex?(0x6B) # "+" for zoom in
|
||||
cel[AnimFrame::ZOOMX]+=10
|
||||
cel[AnimFrame::ZOOMX]=1000 if cel[AnimFrame::ZOOMX]>1000
|
||||
cel[AnimFrame::ZOOMY]+=10
|
||||
cel[AnimFrame::ZOOMY]=1000 if cel[AnimFrame::ZOOMY]>1000
|
||||
@dirty[@currentcel]=true
|
||||
end
|
||||
if Input.repeatex?(0x6D) # "-" for zoom in
|
||||
if Input.triggerex?(0x6D) || Input.repeatex?(0x6D) # "-" for zoom in
|
||||
cel[AnimFrame::ZOOMX]-=10
|
||||
cel[AnimFrame::ZOOMX]=10 if cel[AnimFrame::ZOOMX]<10
|
||||
cel[AnimFrame::ZOOMY]-=10
|
||||
@@ -884,22 +885,22 @@ class AnimationCanvas < Sprite
|
||||
@dirty[@currentcel]=true
|
||||
end
|
||||
if !self.locked?(@currentcel)
|
||||
if Input.repeat?(Input::UP)
|
||||
if Input.trigger?(Input::UP) || Input.repeat?(Input::UP)
|
||||
increment=(Input.press?(Input::ALT)) ? 1 : 8
|
||||
cel[AnimFrame::Y]-=increment
|
||||
@dirty[@currentcel]=true
|
||||
end
|
||||
if Input.repeat?(Input::DOWN)
|
||||
if Input.trigger?(Input::DOWN) ||Input.repeat?(Input::DOWN)
|
||||
increment=(Input.press?(Input::ALT)) ? 1 : 8
|
||||
cel[AnimFrame::Y]+=increment
|
||||
@dirty[@currentcel]=true
|
||||
end
|
||||
if Input.repeat?(Input::LEFT)
|
||||
if Input.trigger?(Input::LEFT) || Input.repeat?(Input::LEFT)
|
||||
increment=(Input.press?(Input::ALT)) ? 1 : 8
|
||||
cel[AnimFrame::X]-=increment
|
||||
@dirty[@currentcel]=true
|
||||
end
|
||||
if Input.repeat?(Input::RIGHT)
|
||||
if Input.trigger?(Input::RIGHT) || Input.repeat?(Input::RIGHT)
|
||||
increment=(Input.press?(Input::ALT)) ? 1 : 8
|
||||
cel[AnimFrame::X]+=increment
|
||||
@dirty[@currentcel]=true
|
||||
|
||||
@@ -125,12 +125,12 @@ class Button < UIControl
|
||||
return if !mousepos
|
||||
rect=Rect.new(self.x+1,self.y+1,self.width-2,self.height-2)
|
||||
rect=toAbsoluteRect(rect)
|
||||
if Input.triggerex?(Input::LeftMouseKey) &&
|
||||
if Input.trigger?(Input::MOUSELEFT) &&
|
||||
rect.contains(mousepos[0],mousepos[1]) && !@captured
|
||||
@captured=true
|
||||
self.invalidate
|
||||
end
|
||||
if Input.releaseex?(Input::LeftMouseKey) && @captured
|
||||
if Input.release?(Input::MOUSELEFT) && @captured
|
||||
self.changed=true if rect.contains(mousepos[0],mousepos[1])
|
||||
@captured=false
|
||||
self.invalidate
|
||||
@@ -263,7 +263,7 @@ class TextField < UIControl
|
||||
self.changed=false
|
||||
self.invalidate if ((@frame%10)==0)
|
||||
# Moving cursor
|
||||
if Input.repeat?(Input::LEFT)
|
||||
if Input.triggerex?(:LEFT) || Input.repeatex?(:LEFT)
|
||||
if @cursor > 0
|
||||
@cursor-=1
|
||||
@frame=0
|
||||
@@ -271,7 +271,7 @@ class TextField < UIControl
|
||||
end
|
||||
return
|
||||
end
|
||||
if Input.repeat?(Input::RIGHT)
|
||||
if Input.triggerex?(:LEFT) || Input.repeatex?(:RIGHT)
|
||||
if @cursor < self.text.scan(/./m).length
|
||||
@cursor+=1
|
||||
@frame=0
|
||||
@@ -280,50 +280,13 @@ class TextField < UIControl
|
||||
return
|
||||
end
|
||||
# Backspace
|
||||
if Input.repeat?(Input::BACKSPACE) || Input.repeat?(Input::DELETE)
|
||||
if Input.triggerex?(:BACKSPACE) || Input.repeatex?(:BACKSPACE) ||
|
||||
Input.triggerex?(:DELETE) || Input.repeatex?(:DELETE)
|
||||
self.delete if @cursor > 0
|
||||
return
|
||||
end
|
||||
# Letter keys
|
||||
for i in 65..90
|
||||
if Input.repeatex?(i)
|
||||
shift=(Input.press?(Input::SHIFT)) ? 0x41 : 0x61
|
||||
insert((shift+i-65).chr)
|
||||
return
|
||||
end
|
||||
end
|
||||
# Number keys
|
||||
shifted=")!@\#$%^&*("
|
||||
unshifted="0123456789"
|
||||
for i in 48..57
|
||||
if Input.repeatex?(i)
|
||||
insert((Input.press?(Input::SHIFT)) ? shifted[i-48].chr : unshifted[i-48].chr)
|
||||
return
|
||||
end
|
||||
end
|
||||
keys=[
|
||||
[32," "," "],
|
||||
[106,"*","*"],
|
||||
[107,"+","+"],
|
||||
[109,"-","-"],
|
||||
[111,"/","/"],
|
||||
[186,";",":"],
|
||||
[187,"=","+"],
|
||||
[188,",","<"],
|
||||
[189,"-","_"],
|
||||
[190,".",">"],
|
||||
[191,"/","?"],
|
||||
[219,"[","{"],
|
||||
[220,"\\","|"],
|
||||
[221,"]","}"],
|
||||
[222,"\"","'"]
|
||||
]
|
||||
for i in keys
|
||||
if Input.repeatex?(i[0])
|
||||
insert((Input.press?(Input::SHIFT)) ? i[2] : i[1])
|
||||
return
|
||||
end
|
||||
end
|
||||
# Letter & Number keys
|
||||
Input.gets.each_char{|c|insert(c)}
|
||||
end
|
||||
|
||||
def refresh
|
||||
@@ -428,17 +391,17 @@ class Slider < UIControl
|
||||
self.curvalue=self.minvalue
|
||||
end
|
||||
return false if self.disabled
|
||||
return false if !Input.repeatex?(Input::LeftMouseKey)
|
||||
return false if !Input.repeat?(Input::MOUSELEFT)
|
||||
return false if !mousepos
|
||||
left=toAbsoluteRect(@leftarrow)
|
||||
right=toAbsoluteRect(@rightarrow)
|
||||
oldvalue=self.curvalue
|
||||
# Left arrow
|
||||
if left.contains(mousepos[0],mousepos[1])
|
||||
if Input.repeatcount(Input::LeftMouseKey)>100
|
||||
if Input.count(Input::MOUSELEFT)>100
|
||||
self.curvalue-=10
|
||||
self.curvalue=self.curvalue.floor
|
||||
elsif Input.repeatcount(Input::LeftMouseKey)>50
|
||||
elsif Input.count(Input::MOUSELEFT)>50
|
||||
self.curvalue-=5
|
||||
self.curvalue=self.curvalue.floor
|
||||
else
|
||||
@@ -450,10 +413,10 @@ class Slider < UIControl
|
||||
end
|
||||
#Right arrow
|
||||
if right.contains(mousepos[0],mousepos[1])
|
||||
if Input.repeatcount(Input::LeftMouseKey)>100
|
||||
if Input.count(Input::MOUSELEFT)>100
|
||||
self.curvalue+=10
|
||||
self.curvalue=self.curvalue.floor
|
||||
elsif Input.repeatcount(Input::LeftMouseKey)>50
|
||||
elsif Input.count(Input::MOUSELEFT)>50
|
||||
self.curvalue+=5
|
||||
self.curvalue=self.curvalue.floor
|
||||
else
|
||||
@@ -676,16 +639,16 @@ class TextSlider < UIControl
|
||||
self.curvalue=self.minvalue
|
||||
end
|
||||
return false if self.disabled
|
||||
return false if !Input.repeatex?(Input::LeftMouseKey)
|
||||
return false if !Input.repeat?(Input::MOUSELEFT)
|
||||
return false if !mousepos
|
||||
left=toAbsoluteRect(@leftarrow)
|
||||
right=toAbsoluteRect(@rightarrow)
|
||||
oldvalue=self.curvalue
|
||||
# Left arrow
|
||||
if left.contains(mousepos[0],mousepos[1])
|
||||
if Input.repeatcount(Input::LeftMouseKey)>100
|
||||
if Input.count(Input::MOUSELEFT)>100
|
||||
self.curvalue-=10
|
||||
elsif Input.repeatcount(Input::LeftMouseKey)>50
|
||||
elsif Input.count(Input::MOUSELEFT)>50
|
||||
self.curvalue-=5
|
||||
else
|
||||
self.curvalue-=1
|
||||
@@ -695,9 +658,9 @@ class TextSlider < UIControl
|
||||
end
|
||||
# Right arrow
|
||||
if right.contains(mousepos[0],mousepos[1])
|
||||
if Input.repeatcount(Input::LeftMouseKey)>100
|
||||
if Input.count(Input::MOUSELEFT)>100
|
||||
self.curvalue+=10
|
||||
elsif Input.repeatcount(Input::LeftMouseKey)>50
|
||||
elsif Input.count(Input::MOUSELEFT)>50
|
||||
self.curvalue+=5
|
||||
else
|
||||
self.curvalue+=1
|
||||
|
||||
@@ -20,7 +20,7 @@ class ControlPointSprite < SpriteWrapper
|
||||
end
|
||||
|
||||
def mouseover
|
||||
if Input.repeatcount(Input::LeftMouseKey)==0 || !@dragging
|
||||
if Input.count(Input::MOUSELEFT)==0 || !@dragging
|
||||
@dragging=false
|
||||
return
|
||||
end
|
||||
@@ -292,7 +292,7 @@ def pbDefinePath(canvas)
|
||||
if Input.trigger?(Input::B)
|
||||
break
|
||||
end
|
||||
if Input.triggerex?(Input::LeftMouseKey)
|
||||
if Input.trigger?(Input::MOUSELEFT)
|
||||
for j in 0...4
|
||||
next if !curve[j].hittest?
|
||||
if j==1||j==2
|
||||
@@ -370,11 +370,11 @@ def pbDefinePath(canvas)
|
||||
loop do
|
||||
Graphics.update
|
||||
Input.update
|
||||
if Input.trigger?(Input::ESC)
|
||||
if Input.triggerex?(:ESCAPE)
|
||||
canceled=true
|
||||
break
|
||||
end
|
||||
if Input.triggerex?(Input::LeftMouseKey)
|
||||
if Input.trigger?(Input::MOUSELEFT)
|
||||
break
|
||||
end
|
||||
mousepos=Mouse::getMousePos(true)
|
||||
@@ -389,7 +389,7 @@ def pbDefinePath(canvas)
|
||||
window.text = (mousepos) ? sprintf("(%d,%d)",mousepos[0],mousepos[1]) : "(??,??)"
|
||||
Graphics.update
|
||||
Input.update
|
||||
if Input.trigger?(Input::ESC) || Input.repeatcount(Input::LeftMouseKey)==0
|
||||
if Input.triggerex?(:ESCAPE) || Input.count(Input::MOUSELEFT)==0
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
@@ -26,7 +26,7 @@ end
|
||||
################################################################################
|
||||
def pbSelectAnim(canvas,animwin)
|
||||
animfiles=[]
|
||||
pbRgssChdir(".\\Graphics\\Animations\\") {
|
||||
pbRgssChdir(File.join("Graphics", "Animations")) {
|
||||
animfiles.concat(Dir.glob("*.png"))
|
||||
}
|
||||
cmdwin=pbListWindow(animfiles,320)
|
||||
@@ -91,6 +91,7 @@ def pbAnimName(animation,cmdwin)
|
||||
window=ControlWindow.new(320,128,320,32*4)
|
||||
window.z=99999
|
||||
window.addControl(TextField.new(_INTL("New Name:"),animation.name))
|
||||
Input.text_input = true
|
||||
okbutton=window.addButton(_INTL("OK"))
|
||||
cancelbutton=window.addButton(_INTL("Cancel"))
|
||||
window.opacity=224
|
||||
@@ -98,16 +99,17 @@ def pbAnimName(animation,cmdwin)
|
||||
Graphics.update
|
||||
Input.update
|
||||
window.update
|
||||
if window.changed?(okbutton) || Input.trigger?(Input::ENTER)
|
||||
if window.changed?(okbutton) || Input.triggerex?(:RETURN)
|
||||
cmdwin.commands[cmdwin.index]=_INTL("{1} {2}",cmdwin.index,window.controls[0].text)
|
||||
animation.name=window.controls[0].text
|
||||
break
|
||||
end
|
||||
if window.changed?(cancelbutton) || Input.trigger?(Input::ESC)
|
||||
if window.changed?(cancelbutton) || Input.triggerex?(:ESCAPE)
|
||||
break
|
||||
end
|
||||
end
|
||||
window.dispose
|
||||
Input.text_input = false
|
||||
return
|
||||
end
|
||||
|
||||
@@ -512,7 +514,7 @@ def pbSelectSE(canvas,audio)
|
||||
displayname=(filename!="") ? filename : _INTL("<user's cry>")
|
||||
animfiles=[]
|
||||
ret=false
|
||||
pbRgssChdir(".\\Audio\\SE\\Anim\\") {
|
||||
pbRgssChdir(File.join("Audio", "SE", "Anim")) {
|
||||
animfiles.concat(Dir.glob("*.wav"))
|
||||
animfiles.concat(Dir.glob("*.mp3"))
|
||||
animfiles.concat(Dir.glob("*.ogg"))
|
||||
@@ -579,7 +581,7 @@ def pbSelectBG(canvas,timing)
|
||||
animfiles=[]
|
||||
animfiles[cmdErase=animfiles.length]=_INTL("[Erase background graphic]")
|
||||
ret=false
|
||||
pbRgssChdir(".\\Graphics\\Animations\\") {
|
||||
pbRgssChdir(File.join("Graphics", "Animations")) {
|
||||
animfiles.concat(Dir.glob("*.bmp"))
|
||||
animfiles.concat(Dir.glob("*.png"))
|
||||
animfiles.concat(Dir.glob("*.jpg"))
|
||||
@@ -1020,10 +1022,10 @@ def animationEditorMain(animation)
|
||||
break
|
||||
end
|
||||
end
|
||||
if Input.trigger?(Input::ONLYF5)
|
||||
if Input.triggerex?(:F5)
|
||||
pbAnimEditorHelpWindow
|
||||
next
|
||||
elsif Input.triggerex?(Input::RightMouseKey) && sliderwin.hittest?(0) # Right mouse button
|
||||
elsif Input.trigger?(Input::MOUSERIGHT) && sliderwin.hittest?(0) # Right mouse button
|
||||
commands=[
|
||||
_INTL("Copy Frame"),
|
||||
_INTL("Paste Frame"),
|
||||
@@ -1058,7 +1060,7 @@ def animationEditorMain(animation)
|
||||
sliderwin.invalidate
|
||||
end
|
||||
next
|
||||
elsif Input.triggerex?(Input::RightMouseKey) # Right mouse button
|
||||
elsif Input.trigger?(Input::MOUSERIGHT) # Right mouse button
|
||||
mousepos=Mouse::getMousePos
|
||||
mousepos=[0,0] if !mousepos
|
||||
commands=[
|
||||
|
||||
@@ -19,7 +19,7 @@ class MapSprite
|
||||
end
|
||||
|
||||
def getXY
|
||||
return nil if !Input.triggerex?(Input::LeftMouseKey)
|
||||
return nil if !Input.trigger?(Input::MOUSELEFT)
|
||||
mouse = Mouse::getMousePos(true)
|
||||
return nil if !mouse
|
||||
if mouse[0]<@sprite.x || mouse[0]>=@sprite.x+@sprite.bitmap.width
|
||||
@@ -118,7 +118,7 @@ class RegionMapSprite
|
||||
end
|
||||
|
||||
def getXY
|
||||
return nil if !Input.triggerex?(Input::LeftMouseKey)
|
||||
return nil if !Input.trigger?(Input::MOUSELEFT)
|
||||
mouse=Mouse::getMousePos(true)
|
||||
return nil if !mouse
|
||||
if mouse[0]<@sprite.x||mouse[0]>=@sprite.x+@sprite.bitmap.width
|
||||
@@ -480,13 +480,13 @@ class MapScreenScene
|
||||
mousepos=Mouse::getMousePos
|
||||
if mousepos
|
||||
hitmap=hittest(mousepos[0],mousepos[1])
|
||||
if Input.triggerex?(Input::LeftMouseKey)
|
||||
if Input.trigger?(Input::MOUSELEFT)
|
||||
onClick(hitmap,mousepos[0],mousepos[1])
|
||||
elsif Input.triggerex?(Input::RightMouseKey)
|
||||
elsif Input.trigger?(Input::MOUSERIGHT)
|
||||
onRightClick(hitmap,mousepos[0],mousepos[1])
|
||||
elsif Input.releaseex?(Input::LeftMouseKey)
|
||||
elsif Input.release?(Input::MOUSELEFT)
|
||||
onMouseUp(hitmap)
|
||||
elsif Input.releaseex?(Input::RightMouseKey)
|
||||
elsif Input.release?(Input::MOUSERIGHT)
|
||||
onRightMouseUp(hitmap)
|
||||
else
|
||||
if @lasthitmap!=hitmap
|
||||
@@ -520,14 +520,14 @@ class MapScreenScene
|
||||
i[1].x -= 4 if i
|
||||
end
|
||||
end
|
||||
if Input.triggerex?("A"[0])
|
||||
if Input.triggerex?(:A)
|
||||
id=chooseMapScreen(_INTL("Add Map"),@currentmap)
|
||||
if id>0
|
||||
addSprite(id)
|
||||
setTopSprite(id)
|
||||
@mapconns=generateConnectionData
|
||||
end
|
||||
elsif Input.triggerex?("S"[0])
|
||||
elsif Input.triggerex?(:S)
|
||||
id=chooseMapScreen(_INTL("Go to Map"),@currentmap)
|
||||
if id>0
|
||||
@mapconns=generateConnectionData
|
||||
@@ -538,7 +538,7 @@ class MapScreenScene
|
||||
putSprite(id)
|
||||
@currentmap=id
|
||||
end
|
||||
elsif Input.trigger?(Input::DELETE)
|
||||
elsif Input.triggerex?(:DELETE)
|
||||
if @mapsprites.keys.length>1 && @selmapid>=0
|
||||
@mapsprites[@selmapid].bitmap.dispose
|
||||
@mapsprites[@selmapid].dispose
|
||||
|
||||
Reference in New Issue
Block a user