unity跨屏显示


using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;
using System.Runtime.InteropServices;

public class ScreenManager : MonoBehaviour
{
    [HideInInspector]
    //导入设置窗口函数  
    [DllImport("user32.dll")]
    static extern bool SetWindowPos(IntPtr hWnd, int hWndInsertAfter, int X, int Y, int cx, int cy, uint uFlags);
    [DllImport("user32.dll")]
    static extern IntPtr SetWindowLong(IntPtr hwnd, int _nIndex, int dwNewLong);
    //导入当前活动窗口  
    [DllImport("user32.dll")]
    static extern IntPtr GetActiveWindow();

    const uint SWP_SHOWWINDOW = 0x0040;//显示窗口
    const int GWL_STYLE = -16;
    const int WS_BORDER = 1;

   // public JsonDatas _JsonDatas;
    private void Awake()
    {
        //_JsonDatas = JsonLoad.Instance.LoadJsonDatas(Application.streamingAssetsPath + "/Json/JsonDate.json");
    }

    void Start()
    {
        //去掉上面的框
        SetWindowLong(GetActiveWindow(), GWL_STYLE, WS_BORDER);
        //显示范围
        SetWindowPos(GetActiveWindow(), -1, 0, 0, 1456, 1080, SWP_SHOWWINDOW);
    }
}

你可能感兴趣的:(unity,游戏引擎)