mirror of
https://gitee.com/energye/energy.git
synced 2024-12-16 02:11:35 +08:00
33 lines
868 B
Go
33 lines
868 B
Go
|
package main
|
|||
|
|
|||
|
import (
|
|||
|
"github.com/energye/energy/cef"
|
|||
|
"github.com/energye/energy/cef/process"
|
|||
|
)
|
|||
|
|
|||
|
func main() {
|
|||
|
// 进程类型获取
|
|||
|
// 通过命令行参数 type 区分
|
|||
|
process.Args.Print()
|
|||
|
if process.Args.ProcessType() == process.PT_MAIN {
|
|||
|
// 主进程
|
|||
|
println("main process")
|
|||
|
} else if process.Args.ProcessType() == process.PT_GPU {
|
|||
|
println("gpu process")
|
|||
|
} else if process.Args.ProcessType() == process.PT_UTILITY {
|
|||
|
println("utility process")
|
|||
|
} else if process.Args.ProcessType() == process.PT_RENDERER {
|
|||
|
// 渲染进程
|
|||
|
println("renderer process")
|
|||
|
}
|
|||
|
process.FrameId()
|
|||
|
//全局初始化 每个应用都必须调用的
|
|||
|
cef.GlobalInit(nil, nil)
|
|||
|
//创建应用
|
|||
|
cefApp := cef.NewApplication()
|
|||
|
//指定一个URL地址,或本地html文件目录
|
|||
|
cef.BrowserWindow.Config.Url = "https://energy.yanghy.cn"
|
|||
|
//运行应用
|
|||
|
cef.Run(cefApp)
|
|||
|
}
|