Thread: FOV settings
View Single Post
  #29  
Old 07-08-2012, 09:45 PM
Artist's Avatar
Artist Artist is offline
Approved Member
 
Join Date: Jan 2010
Posts: 362
Default Modest Proposal for assigning a key to any desired FOV - by a gentlemen from Germany

Using Autohotkey, this script enables to assign any desirable FOV between 0-180° (e.g. 22° 45°, 57°) to a key.

Assumption (but you can change that) is that:
"Hold to Adjust Field of View" is assigned to <Alt + Insert>
"Field of View 30°" is assigned to <Strg + Insert>
"Field of View 70°" is assigned to <Strg + Home>
"Field of View 70°" is assigned to <Strg + PageUp>

This example assigns
<Shift + 1> to FOV 10°
<Shift + 2> to FOV 20°
<Shift + 3> to FOV 30°
...
<Shift + 9> to FOV 90°
and
<Shift + z> to increase by 10°
<Shift + x> to decrease by 10°



The most important is
Quote:
iMousePixelFor10Degrees := 75
which defines that the Mosue has to move 75 pixels to change the FOV by 10°. A value of 75 is fine for my 1920x1200 25,5" Screen. Probably you have to experiment with different values...


Code:
#Persistent  ; Keep this script running until the user explicitly exits it.
; =====================================
; Assigning Keys
; =====================================
; Using Shift + Number, Strg + and Alt + combinations do not work, because
;                       Strg and Alt is already used with 
;                       - "Hold to Adjust Field of View" <Alt + Insert>
;                       - "Field of View 30°" <Strg + Insert>
;                       - "Field of View 70°" <Strg + Home>
;                       - "Field of View 70°" <Strg + PageUp>
+1::setFOV(10)
+2::setFOV(20)
+3::setFOV(30)
+4::setFOV(40)
+5::setFOV(50)
+6::setFOV(60)
+7::setFOV(70)
+8::setFOV(80)
+9::setFOV(90)
+Y::zoomFOV(10)
+X::zoomFOV(-10)

return

; =======================================
; useful functions
; =======================================
setView_30(){
    Send ^{Insert}      ; 30°
    return 0
}    
setView_70(){
    Send ^{Home}        ; 70° screen 16:10 or 16:9
    return 0
}    
setView_90(){
    Send ^{PgUp}        ; 90° screen 16:10 or 16:9
    return 0
}
zoomFOV(iByDegrees){
    iMousePixelFor10Degrees := 75   ; Valid on my 25,5" 1920x1200
    
    iMoveX := A_ScreenWidth
    iMoveY := A_ScreenHeight * (iByDegrees > 0 ? -1 : 1)
    DllCall("mouse_event", uint, ciFLAG_MOVE, int, iMoveX, int, iMoveY, uint, 0, int, 0)

    iMoveX := 0
    iMoveY := (iMousePixelFor10Degrees * iByDegrees)/10

    BlockInput, On
    Send !{Insert down}
    DllCall("mouse_event", uint, ciFLAG_MOVE, int, iMoveX, int, iMoveY, uint, 0, int, 0)
    KeyWait %A_ThisHotkey%
    Send !{Insert up}
    BlockInput, Off

    return 0
}
; ==============================================================================
; setFOV by Degrees
; ==============================================================================
setFOV(iDegrees){
    iAdjFOV  := 0
    iDegrees := iDegrees <=0 ? 0 : iDegrees
    iDegrees := iDegrees >=180 ? 180 : iDegrees
    
    if(iDegrees < 50){
        setView_30()
        iAdjFOV := 30 - iDegrees
    }
    else if(iDegrees < 80){
        setView_70()
        iAdjFOV := 70 - iDegrees
    }
    else{
        setView_90()
        iAdjFOV := 90 - iDegrees
    }
    
    if(0 != iAdjFOV){
        zoomFOV(iAdjFOV)
    }
    
    return 0
}
Artist
__________________
Ceterum censeo the mixture axis should be supported in IL-2 1946' DeviceLink.

-------------------------------------------------------------
Reply With Quote