--- /dev/null
+from cffi import FFI
+ffi = FFI()
+ffi.cdef(open('cffi-ecere.h').read())
+ffi.set_source("_pyEcere",
+ '#include "ecere.h"',
+ sources = [ "../c/eC.c", "../c/ecere.c" ],
+ include_dirs = ["../c"],
+ libraries = ["ecere"],
+ library_dirs = ["C:/Program Files/Ecere SDK/bin"])
+if __name__ == "__main__":
+ ffi.compile(verbose=True)
--- /dev/null
+typedef struct class_members_Instance * Instance;
+typedef Instance Module;
+typedef Module Application;
+typedef struct Class Class;
+typedef uint32_t bool;
+
+//struct Class { ...; };
+
+Instance Instance_new(Class * _class);
+Instance Instance_newEx(Class * _class, bool bindingsAlloc);
+
+void Instance_evolve(Instance *instancePtr, Class * _class);
+
+Application eC_init(bool guiApp, int argc, char * argv[]);
+Module ecere_init(Module fromModule);
+
+extern void (*PrintLn)(Class * class_object, const void * object, ...);
+
+extern Class * class_String;
+extern Class * class_Window;
+extern Class * class_GuiApplication;
+
+#define false 0
+#define true 1
+
+typedef struct Size Size;
+struct Size { int w, h; };
+
+typedef Instance FontResource;
+
+typedef Instance Window;
+typedef int64_t DialogResult;
+
+extern DialogResult (* Window_modal)(Window);
+extern void (* FontResource_set_size)(FontResource f, float v);
+
+extern void (* Window_set_size)(Window w, const Size * v);
+
+extern void (* Window_set_hasClose)(Window w, bool hasClose);
+extern bool (* Window_get_hasClose)(Window w);
--- /dev/null
+{
+ "Version" : 0.2,
+ "ModuleName" : "cffiEcere",
+ "Options" : {
+ "Warnings" : "All",
+ "IncludeDirs" : [
+ "c"
+ ],
+ "TargetType" : "SharedLibrary",
+ "TargetFileName" : "_pyEcere",
+ "Libraries" : [
+ "ecere",
+ "python3"
+ ]
+ },
+ "Configurations" : [
+ {
+ "Name" : "Debug",
+ "Options" : {
+ "Debug" : true,
+ "Optimization" : "None",
+ "PreprocessorDefinitions" : [
+ "_DEBUG"
+ ],
+ "FastMath" : false,
+ "PostbuildCommands" : [
+ "$(call cp,obj/debug.$(PLATFORM)$(COMPILER_SUFFIX)/_pyEcere.dll,_pyEcere.pyd)"
+ ]
+ }
+ },
+ {
+ "Name" : "Release",
+ "Options" : {
+ "Debug" : false,
+ "Optimization" : "Speed",
+ "FastMath" : true
+ }
+ }
+ ],
+ "Files" : [
+ {
+ "Folder" : "c",
+ "Files" : [
+ "eC.h",
+ "ecere.h",
+ "ecere.c",
+ "eC.c"
+ ]
+ },
+ {
+ "Folder" : "generated",
+ "Files" : [
+ "./_pyEcere.c"
+ ]
+ },
+ "build_ecere.py",
+ "ex1.py",
+ "cffi-ecere.h",
+ "pyEcere.py"
+ ],
+ "ResourcesPath" : "",
+ "Resources" : [
+
+ ]
+}
--- /dev/null
+import sys
+from _pyEcere import *
+
+# lib.PrintLn(lib.class_String, fun.encode('utf8'), ffi.NULL)
+
+def app_init():
+ app = lib.eC_init(True, len(sys.argv), [ffi.new("char[]", i.encode('utf8')) for i in sys.argv])
+ lib.ecere_init(app)
+ rApp = ffi.new("Instance *"); rApp[0] = app; lib.Instance_evolve(rApp, lib.class_GuiApplication); app = rApp[0]
+
+class Size:
+ def __init__(self, w = 0, h = 0):
+ self.this = ffi.new("Size *")
+ self.this.w = w
+ self.this.h = h
+
+class Instance(object):
+ def __init__(self): self.this = ffi.NULL
+
+class Window(Instance):
+ def __init__(self, hasClose = None, clientSize = None):
+ self.this = lib.Instance_new(lib.class_Window)
+ if hasClose != None: self.hasClose = hasClose
+ if clientSize != None: self.clientSize = clientSize
+
+ def create(self): lib.Window_create(self.this)
+ def modal(self): lib.Window_modal(self.this)
+
+ @property
+ def clientSize(self): value = Size(); lib.Window_get_size(self.this, value.this); return value
+ @clientSize.setter
+ def clientSize(self, value): lib.Window_set_size(self.this, value.this)
+
+ @property
+ def hasClose(self): value = ffi.new("bool *"); lib.Window_get_hasClose(self.this, value); return value
+ @hasClose.setter
+ def hasClose(self, value): lib.Window_set_hasClose(self.this, value)
--- /dev/null
+# -*- coding: utf-8 -*-
+from pyEcere import *
+app_init()
+Window(hasClose = True, clientSize = Size(640, 480)).modal()