こんにちわ。
jniフォルダのmain.cでは難しいような気がします。
画面のアスペクト比を取得できればなんとかなりますでしょうか?
「
http://ja.softuses.com/164611」から記述をHSPに置き換えてみただけですが、アスペクト比を算出するモジュールを作りました。
実際に使用する際には、パラメーターとして渡す値はデスクトップ全体のサイズである、ginfo_dispxとginfo_dispyを渡してあげれば良いと思います。
#module mod_aspect
#defcfunc aspect_w int screen_width, int screen_height
asp_w = screen_width / gcd(screen_width, screen_height)
return asp_w
#defcfunc aspect_h int screen_width, int screen_height
asp_h = screen_height / gcd(screen_width, screen_height)
return asp_h
#defcfunc local gcd int screen_width, int screen_height
if screen_height = 0 {
return screen_width
} else {
return gcd@mod_aspect(screen_height, screen_width \ screen_height)
}
#global
gamen_yoko = 640
gamen_tate = 480
w = aspect_w(gamen_yoko, gamen_tate)
h = aspect_h(gamen_yoko, gamen_tate)
mes "" + w + ":" + h ; 結果"4:3"
gamen_yoko = 1280
gamen_tate = 720
w = aspect_w(gamen_yoko, gamen_tate)
h = aspect_h(gamen_yoko, gamen_tate)
mes "" + w + ":" + h ; 結果"16:9"
stop