Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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 {};
{
"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"
]
}
@jerstlouis

This comment has been minimized.

Show comment
Hide comment
Owner

jerstlouis commented Aug 25, 2017

butterfly

sampleshot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment