dofile(LockOn_Options.common_script_path.."devices_defs.lua")

indicator_type = indicator_types.COMMON
used_render_mask = "interleave.bmp"

if LockOn_Options.flight.easy_radar then    render_target_always = true
else                                        render_target_always = false    end

if LockOn_Options.flight.easy_radar then 
   purposes 	 = {render_purpose.GENERAL,render_purpose.HUD_ONLY_VIEW,render_purpose.SCREENSPACE_OUTSIDE_COCKPIT}
else
   purposes 	 = {render_purpose.GENERAL,render_purpose.HUD_ONLY_VIEW}
end

screenspace_scale    = 4;

-- from  indication page  : in hud only it is scaled like  {  1.15 ,  0.78}
local 				 y_size        = 0.78
local 				 x_size        = 1.15
local 				 screen_height = 2.0;
local 				 screen_width  = screen_height * LockOn_Options.screen.aspect;
local 				 scaled_width  = SelfWidth  * screenspace_scale 
local 				 scaled_height =  y_size * scaled_width -- for indicator all sizes is function of width
local				 scaled_width  =  x_size * scaled_width 
screenspace_diplacement    = {-0.5 * screen_width  + 0.5 * scaled_width,
					          -0.5 * screen_height + 0.5 * scaled_height}
                              
screenspace_diplacement_arcade    = {-0.5 * screen_width  + 0.5 * scaled_width,
                                      0.5 * screen_height - 0.5 * scaled_height}
                         

function set_full_viewport_coverage(viewport)
   local w = LockOn_Options.screen.width
   local h = LockOn_Options.screen.height
   local a = LockOn_Options.screen.aspect
   local x = (-1.0 + 2.0 * (viewport.x / w)) * a
   local y =   1.0 - 2.0 * (viewport.y / h)
   
   local width  = (viewport.width  / w) * a
   local height =  viewport.height / h 
   local scl_hgt_K = y_size * SelfWidth -- size always function of SelfWidth
   local scl_wdt_K = x_size * SelfWidth -- size always function of SelfWidth
      
   screenspace_scale_x 	      =  2.0 * width  / scl_wdt_K
   screenspace_scale_y 		  =  2.0 * height / scl_hgt_K 
   screenspace_diplacement    = {x +  width,
								 y -  height}
 
   screenspace_diplacement_arcade = screenspace_diplacement
   purposes 	 = {render_purpose.GENERAL,
					render_purpose.HUD_ONLY_VIEW,
					render_purpose.SCREENSPACE_OUTSIDE_COCKPIT,
					render_purpose.SCREENSPACE_INSIDE_COCKPIT} -- set purposes to draw it always 
   render_target_always = true
end

-- try to find assigned viewport
local multimonitor_setup_name =  "Config/MonitorSetup/"..get_multimonitor_preset_name()..".lua"
local env = {}
	  env.screen = LockOn_Options.screen
local f = loadfile(multimonitor_setup_name)
if	  f 	then
	  setfenv(f,env)
	  pcall(f)
	  if env.Shkval ~= nil then
			dbg_print("ok we have directly assigned viewport to shkval\n")
			set_full_viewport_coverage(env.Shkval)
	  end	  
end


							  
-------PAGE IDs-------
id_Page =
{
	PAGE_NULL = 0,
	PAGE_OFF  = 1,
	PAGE_TEST = 2,
	PAGE_MAIN = 3
}

id_pagesubset =
{
	COMMON  = 0,
	MAIN    = 1,
	TEST    = 2,
}

page_subsets = {}
page_subsets[id_pagesubset.COMMON] = LockOn_Options.script_path.."SHKVAL\\SHKVAL_base_page.lua"
page_subsets[id_pagesubset.MAIN]   = LockOn_Options.script_path.."SHKVAL\\SHKVAL_page.lua"
page_subsets[id_pagesubset.TEST]   = LockOn_Options.script_path.."SHKVAL\\SHKVAL_page_test.lua"
  	
----------------------
pages = {}
pages[id_Page.PAGE_MAIN] = { id_pagesubset.COMMON, id_pagesubset.MAIN}
pages[id_Page.PAGE_TEST] = { id_pagesubset.COMMON, id_pagesubset.TEST}

init_pageID     = id_Page.PAGE_MAIN
test_pageID     = id_Page.PAGE_TEST

always_show_ground = false
--use_parser      = false
