mirror of
https://onedev.site.tesses.net/crosslang/crosslangextras
synced 2026-02-08 17:15:45 +00:00
Get more done on packageserver
This commit is contained in:
2
Templates/gui/.crossarchiveignore
Normal file
2
Templates/gui/.crossarchiveignore
Normal file
@@ -0,0 +1,2 @@
|
||||
bin
|
||||
obj
|
||||
26
Templates/gui/cross.json
Normal file
26
Templates/gui/cross.json
Normal file
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"dependencies": [
|
||||
],
|
||||
"info": {
|
||||
"template_extra_text_ftles": [
|
||||
"res/layout.json"
|
||||
],
|
||||
"template_ignored_files": [
|
||||
"bin",
|
||||
"obj"
|
||||
],
|
||||
"template_info": {
|
||||
"type": "app",
|
||||
"license": "MIT"
|
||||
},
|
||||
"template_name": "gui",
|
||||
"template_project_dependencies": [
|
||||
],
|
||||
"repo": "https://onedev.site.tesses.net/CrossLang/CrossLangExtras",
|
||||
"homepage": "https://crosslang.tesseslanguage.com/",
|
||||
"type": "template",
|
||||
"description": "A crosslang gui, using tesses-framework's gui library"
|
||||
},
|
||||
"name": "Tesses.CrossLang.Template.GUI",
|
||||
"version": "1.0.0.0-prod"
|
||||
}
|
||||
33
Templates/gui/res/layout.json
Normal file
33
Templates/gui/res/layout.json
Normal file
@@ -0,0 +1,33 @@
|
||||
{
|
||||
"Child": {
|
||||
"Type": "AbsoluteView",
|
||||
"Items": [
|
||||
{
|
||||
"Bounds": {
|
||||
"X": 42,
|
||||
"Y": 42,
|
||||
"Width": 200,
|
||||
"Height": 50
|
||||
},
|
||||
"Type": "ButtonView",
|
||||
"Text": "Click Me",
|
||||
"Id": "btn1",
|
||||
"Active": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"Palette": {
|
||||
"IsDarkMode": true,
|
||||
"Accent": "#DB0",
|
||||
"Border": "#040",
|
||||
"BorderActive":"#A00",
|
||||
"BorderHover": "#00A",
|
||||
"BorderHoverActive": "#A0A",
|
||||
"FontSize": 20
|
||||
},
|
||||
"Size": {
|
||||
"Width": 640,
|
||||
"Height": 480
|
||||
},
|
||||
"Text": "%PROJECT_NAME%"
|
||||
}
|
||||
18
Templates/gui/src/main.tcross
Normal file
18
Templates/gui/src/main.tcross
Normal file
@@ -0,0 +1,18 @@
|
||||
func btn1_Click(sender,e)
|
||||
{
|
||||
Console.WriteLine("Button Clicked");
|
||||
}
|
||||
func main(args)
|
||||
{
|
||||
if(TypeOf(GUI) != "Dictionary")
|
||||
{
|
||||
Console.WriteLine("The GUI is not supported, please build tessesframework with TESSESFRAMEWORK_ENABLE_SDL2.");
|
||||
return 1;
|
||||
}
|
||||
var window = GUI.Window.FromJSON(embed("layout.json"), SDL2.Window.Resizable);
|
||||
var btn1 = window.FindViewById("btn1");
|
||||
btn1.Click += btn1_Click;
|
||||
VM.RunEventLoop();
|
||||
btn.Click -= btn1_Click;
|
||||
window.Dispose(); //we need to destroy it or it will leak
|
||||
}
|
||||
Reference in New Issue
Block a user