Last active
August 25, 2017 17:23
-
-
Save jerstlouis/02181fdff3b1b3f5cb8fdc7b8bb37551 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import "ecere" | |
class HelloForm : Window | |
{ | |
caption = $"Hello Form"; | |
background = formColor; | |
borderStyle = sizable; | |
hasMaximize = true; | |
hasMinimize = true; | |
hasClose = true; | |
tabCycle = true; | |
size = { 640, 498 }; | |
displayDriver = "OpenGL"; | |
Button button1 | |
{ | |
this, caption = $"Say Hello", isDefault = true, font = { "Tahoma", 12, bold = true }, | |
position = { 184, 64 }; | |
bool NotifyClicked(Button button, int x, int y, Modifiers mods) | |
{ | |
String s = PrintString("Hello, ", ebName.contents); | |
MessageBox { contents = s }.Modal(); | |
delete s; | |
return true; | |
} | |
}; | |
EditBox ebName { this, caption = $"Name:", size = { 174, 19 }, position = { 88, 24 } }; | |
Label lblName { this, position = { 40, 24 }, labeledWindow = ebName }; | |
BitmapResource butterfly { ":butterfly.jpg", window = this }; | |
FontResource myFont | |
{ | |
"Comic Sans MS", size = 20, outlineSize = 3, outlineFade = 0.2, bold = true, window = this | |
}; | |
Window renderArea | |
{ | |
this, background = black, anchor = { left = 20, top = 100, right = 20, bottom = 20 }; | |
void OnRedraw(Surface surface) | |
{ | |
HelloForm form = (HelloForm)master; | |
Bitmap bmp = form.butterfly.bitmap; | |
surface.Blit(bmp, 0, 0, 0, 0, bmp.width, bmp.height); | |
surface.foreground = white; | |
surface.Rectangle(10, 10, 100, 100); | |
surface.background = green; | |
surface.Area(20, 20, 90, 90); | |
surface.foreground = skyBlue; | |
surface.outlineColor = orange; | |
surface.font = form.myFont.font; | |
surface.WriteTextf(140, 10, "Graphics are cool!"); | |
} | |
}; | |
} | |
HelloForm form {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Version" : 0.2, | |
"ModuleName" : "sampleForm", | |
"Options" : { | |
"Warnings" : "All", | |
"TargetType" : "Executable", | |
"TargetFileName" : "sampleForm", | |
"Libraries" : [ | |
"ecere" | |
] | |
}, | |
"Configurations" : [ | |
{ | |
"Name" : "Debug", | |
"Options" : { | |
"Debug" : true, | |
"Optimization" : "None", | |
"PreprocessorDefinitions" : [ | |
"_DEBUG" | |
], | |
"FastMath" : false | |
} | |
}, | |
{ | |
"Name" : "Release", | |
"Options" : { | |
"Debug" : false, | |
"Optimization" : "Speed", | |
"FastMath" : true | |
} | |
} | |
], | |
"Files" : [ | |
"sampleForm.ec" | |
], | |
"ResourcesPath" : "", | |
"Resources" : [ | |
"butterfly.jpg" | |
] | |
} |
Author
jerstlouis
commented
Aug 25, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment