Created
August 11, 2017 01:20
-
-
Save jerstlouis/c09395703ae1403197609f9e895d1f6d 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 = { 760, 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; | |
int w = clientSize.w, h = clientSize.h; | |
surface.foreground = white; | |
surface.Rectangle(10, 10, 100, 100); | |
surface.background = green; | |
surface.Area(20, 20, 90, 90); | |
//surface.Blit(bmp, 0,0,0,0, bmp.width, bmp.height); | |
surface.Stretch(bmp, (w - bmp.width/2)/2, (h - bmp.height/2)/2, 0,0, | |
bmp.width/2, bmp.height/2, bmp.width, bmp.height); | |
surface.foreground = skyBlue; | |
surface.outlineColor = orange; | |
surface.font = form.myFont.font; | |
surface.WriteTextf(140, 10, "Graphics are cool!"); | |
} | |
}; | |
} | |
HelloForm form {}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment