{
"Name" : "Emscripten",
"Options" : {
- "Warnings" : "None",
- "NoLineNumbers" : true,
- "Optimization" : "Size",
- "PreprocessorDefinitions" : [
- "BUILDING_ECERE_COM",
- "ECERE_STATIC",
- "ECERE_VANILLA",
- "NOBLENDING"
- ],
- "TargetType" : "StaticLibrary",
- "TargetFileName" : "ecereVanilla",
- "PostbuildCommands" : [
- "$(call cpq,$(TARGET),../obj/$(PLATFORM)$(COMPILER_SUFFIX)$(DEBUG_SUFFIX)/lib/)"
- ],
- "InstallCommands" : [
- "$(if $(WINDOWS_HOST),$(call cpq,$(TARGET),\"$(DESTSLIBDIR)/\"),install $(INSTALL_FLAGS) $(TARGET) $(DESTSLIBDIR)/$(MODULE)$(A))"
- ]
- }
- },
- {
- "Name" : "Emscripten",
- "Options" : {
"Debug" : true,
"PreprocessorDefinitions" : [
"ECERE_STATIC",
}
]
},
- {
- "FileName" : "PNGFormat.ec",
- "Configurations" : [
- {
- "Name" : "Emscripten",
- "Options" : {
- "ExcludeFromBuild" : true
- }
- }
- ]
- },
+ "PNGFormat.ec",
{
"FileName" : "RGBFormat.ec",
"Configurations" : [
"TargetType" : "StaticLibrary",
"TargetFileName" : "ecereCOMStatic"
}
+ },
+ {
+ "Name" : "emjslib",
+ "Options" : {
+ "Debug" : true,
+ "Optimization" : "Size",
+ "PreprocessorDefinitions" : [
+ "ECERE_COM_ONLY"
+ ],
+ "TargetType" : "SharedLibrary"
+ }
}
],
"Files" : [
if(type)
{
OldLink link;
+#if defined(__EMSCRIPTEN__)
+ printf("FindFormat: ");
+#endif
for(link = class(BitmapFormat).derivatives.first; link; link = link.next)
{
const char ** extensions;
+#if defined(__EMSCRIPTEN__)
+ Class _class = link.data;
+#endif
format = link.data;
extensions = format.extensions;
+#if defined(__EMSCRIPTEN__)
+ printf(", c%s", _class.name);
+#endif
if(extensions)
{
int c;
for(c = 0; extensions[c] && extensions[c][0]; c++)
if(!strcmp(extensions[c], type))
+ {
+#if defined(__EMSCRIPTEN__)
+ printf(", e%s", extensions[c]);
+#endif
break;
+ }
if(extensions[c] && extensions[c][0])
+ {
+#if defined(__EMSCRIPTEN__)
+ PrintLn("------------- type: ", type);
+#endif
break;
+ }
}
}
if(!link) format = null;
}
+#if defined(__EMSCRIPTEN__)
+ printf("\n");
+#endif
return format;
}
if(!format)
typeToTry = 0;
+#if defined(__EMSCRIPTEN__)
+ PrintLn("----------- type: ", type, ", guessedType: ", guessedType, ", format: ", (uint)format);
+#endif
+
for(; typeToTry < NUM_TYPES_TO_TRY; typeToTry++)
{
if(typeToTry >= 0)
+ {
format = FindFormat(typesToTry[typeToTry]);
+#if defined(__EMSCRIPTEN__)
+ PrintLn("----------- typesToTry[typeToTry]: ", typesToTry[typeToTry], "(", typeToTry, ")");
+#endif
+ }
if(format)
{
File f = FileOpen(fileName, read);
+#if defined(__EMSCRIPTEN__)
+ PrintLn("--------------------------------------------------- fileNameLoading: ", fileName, " (", f == null ? "error" : "ok", ")");
+#endif
if(f)
{
+#if defined(__EMSCRIPTEN__)
+ PrintLn("----------------------------- format: ", (uint)format, ", Load: ", (uint)format.Load, ", this: ", (uint)this);
+#endif
if((result = format.Load(this, f)))
{
+#if defined(__EMSCRIPTEN__)
+ PrintLn("--------------------------------------------------- if((result = format.Load(this, f))): ok");
+#endif
if(displaySystem)
{
+#if defined(__EMSCRIPTEN__)
+ PrintLn("--------------------------------------------------- if(displaySystem): ok");
+#endif
if(!MakeDD(displaySystem))
{
+#if defined(__EMSCRIPTEN__)
+ PrintLn("--------------------------------------------------- if(!MakeDD(displaySystem)): ok");
+#endif
Free();
result = false;
}
import "Display"
-#if !defined(__EMSCRIPTEN__) && !defined(__pnacl__)
-
#define uint _uint
#include "png.h"
#undef uint
bool Load(Bitmap bitmap, File f)
{
bool result = false;
+#if defined(__EMSCRIPTEN__)
+ PrintLn(" ------------------------------------- getting in here ------------------------------------- ");
+#endif
png_structp png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, null, null, null);
return result;
}
}
-
-#endif // !defined(__EMSCRIPTEN__)
bool result = false;
OGLSystem oglSystem = displaySystem.driverData = OGLSystem { };
+#if defined(__EMSCRIPTEN__)
+ PrintLn("---------------> oglSystem.pow2textures = true;");
+ oglSystem.pow2textures = true;
+#endif
+
#ifdef __WIN32__
oglSystem.hwnd = CreateWindow("static", null, 0,0,0,0,0,null,null,null,null);
#elif defined(__EMSCRIPTEN__)
if(glfwInit() == GL_TRUE)
{
- const int width = 640, height = 480;
+ const int width = 1024, height = 480;
if(glfwOpenWindow(width, height, 8, 8, 8, 8, 16, 0, GLFW_WINDOW) == GL_TRUE)
{
//glfwSwapBuffers();
}
#if defined(__EMSCRIPTEN__)
+ EM_ASM
+ (
+ FS.mkdir('/persist');
+ FS.mount(IDBFS, {}, '/persist');
+
+ FS.syncfs(true, function (err)
+ {
+ assert(!err);
+ //ccall('em_idbfs_read_sync_callback', 'v');
+ });
+ );
+ PrintLn("============================================================== Main(); -- emscripten_set_main_loop(em_main_loop_callback, 1/-*60*-/, 1);");
emscripten_set_main_loop(em_main_loop_callback, 0/*1*//*60*/, 1);
#endif
{
interfaceDriver.Terminate();
}
+#if defined(__EMSCRIPTEN__)
+ PrintLn("============================================================== inter.Initialize();");
+#endif
result = inter.Initialize();
}
else
guiApp.Cycle(false);
guiApp.UpdateDisplay();
}
+
+/*private *//*void em_idbfs_read_sync_callback()
+{
+ PrintLn("private void em_idbfs_read_sync_callback()");
+}*/
#endif
canvasX = e->canvasX;
canvasY = e->canvasY;
+#if 0
printf("%s, screen: (%ld,%ld), client: (%ld,%ld),%s%s%s%s button: %hu, buttons: %hu, movement: (%ld,%ld), canvas: (%ld,%ld)\n",
emscripten_event_type_to_string(eventType), e->screenX, e->screenY, e->clientX, e->clientY,
e->ctrlKey ? " CTRL" : "", e->shiftKey ? " SHIFT" : "", e->altKey ? " ALT" : "", e->metaKey ? " META" : "",
e->button, e->buttons, e->movementX, e->movementY, e->canvasX, e->canvasY);
+#endif
if(e->shiftKey) mods.shift = true;
if(e->ctrlKey) mods.ctrl = true;
}
break;
case EMSCRIPTEN_EVENT_MOUSEMOVE: method = __ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnMouseMove; break;
- //case EMSCRIPTEN_EVENT_MOUSEENTER: method = 0; break;
- //case EMSCRIPTEN_EVENT_MOUSELEAVE: method = 0; break;
+ case EMSCRIPTEN_EVENT_MOUSEENTER: method = 0; break;
+ case EMSCRIPTEN_EVENT_MOUSELEAVE: method = 0; break;
case EMSCRIPTEN_EVENT_MOUSEOVER: method = __ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnMouseMove; break;
- //case EMSCRIPTEN_EVENT_MOUSEOUT: method = 0; break;
+ case EMSCRIPTEN_EVENT_MOUSEOUT: method = 0; break;
default: method = 0;
}
void ::StartMoving(Window window, int x, int y, bool fromKeyBoard)
{
- sflnprintf("class(EmscriptenInterface) ::StartMoving [STUB!]\n");
+ // sflnprintf("class(EmscriptenInterface) ::StartMoving [STUB!]\n");
}
void ::StopMoving(Window window)
{
- sflnprintf("class(EmscriptenInterface) ::StopMoving [STUB!]\n");
+ // sflnprintf("class(EmscriptenInterface) ::StopMoving [STUB!]\n");
}
void ::SetMousePosition(int x, int y)
{
- sflnprintf("class(EmscriptenInterface) ::SetMousePosition [STUB!]\n");
+ // sflnprintf("class(EmscriptenInterface) ::SetMousePosition [STUB!]\n");
}
void ::SetMouseRange(Window window, Box box)
{
- sflnprintf("class(EmscriptenInterface) ::SetMouseRange [STUB!]\n");
+ // sflnprintf("class(EmscriptenInterface) ::SetMouseRange [STUB!]\n");
}
void ::SetMouseCapture(Window window)
{
- sflnprintf("class(EmscriptenInterface) ::SetMouseCapture [STUB!]\n");
+ // sflnprintf("class(EmscriptenInterface) ::SetMouseCapture [STUB!]\n");
}
void ::SetMouseCursor(Window window, SystemCursor cursor)
{
- sflnprintf("class(EmscriptenInterface) ::SetMouseCursor [STUB!]\n");
+ // sflnprintf("class(EmscriptenInterface) ::SetMouseCursor [STUB!]\n");
}
sflnprintf("class(EmscriptenInterface) ::GetScreenArea [STUB!]\n");
}
}
-
#endif
static File EAROpenArchive(const char * archive, EARHeader header)
{
File f = null;
+ char moduleName[MAX_LOCATION];
+ moduleName[0] = '\0';
if(archive[0] == ':')
{
- char moduleName[MAX_LOCATION];
const char * name = archive + 1;
#if defined(__ANDROID__) || defined(__EMSCRIPTEN__)
+ PrintLn("************************************************************", " archive: ", archive);
if(!name[0])
name = ((SubModule)__thisModule.application.modules.first).next.module.name;
#endif
#if defined(__EMSCRIPTEN__)
- //sprintf(moduleName, "__%s.ear", name);
+ //sprintf(moduleName, "%s.data", name);
sprintf(moduleName, "__%s.ear", "HelloForm");
f = FileOpen(moduleName, read);
+ PrintLn("************************************************************", f == null ? " ERROR: " : " we have moduleName: ", moduleName, " | ", name);
#else
if(LocateModule(name, moduleName))
f = FileOpen(moduleName, read);
// First attempt to treat this as an archive file
if(f.Read(header, sizeof(EARHeader), 1) == 1 &&
!memcmp(header.recognition, earRecognition, sizeof(earRecognition)))
+ {
+#if defined(__EMSCRIPTEN__)
+ PrintLn("************************************************************", " confirm archive moduleName: ", moduleName);
+#endif
return f;
+ }
// Then try to see if an archive is at the end of the file
f.Seek(-(int)sizeof(uint), end);
!memcmp(header.recognition, earRecognition, sizeof(earRecognition)))
return f;
+#if defined(__EMSCRIPTEN__)
+ PrintLn("************************************************************", " ERROR ARCHIVE moduleName: ", moduleName);
+#endif
delete f;
}
return null;
namespace sys;
default:
+
+#if defined(__EMSCRIPTEN__)
+#include <emscripten.h>
+#endif
+
#define set _set
#define uint _uint
#define File _File
openCount--;
fclose(input);
}
+#if defined(__EMSCRIPTEN__)
+ EM_ASM
+ (
+ FS.syncfs(function (err)
+ {
+ assert(!err);
+ //ccall('em_idbfs_write_sync_callback', 'v');
+ });
+ );
+#endif
input = null;
output = null;
}
MakeSlashPath(d);
return d;
}
+
+#if defined(__EMSCRIPTEN__)
+//default:
+/*private *//*void em_idbfs_write_sync_callback()
+{
+ PrintLn("private void em_idbfs_write_sync_callback()");
+}*/
+#endif
],
"FastMath" : false
}
+ },
+ {
+ "Name" : "Emscripten"
}
],
"Files" : [
class HelloForm : Window
{
- text = "My First eC Application";
+ caption = $"My First eC Application";
borderStyle = sizable;
- size = { 280, 100 };
hasClose = true;
+ size = { 280, 100 };
- Label label
+ /*Label label
{
this, position = { 10, 10 }, font = { "Arial", 30 },
text = "Hello, World!!"
+ };*/
+
+ Button button1
+ {
+ this, caption = $"button1";
+ size = { 50, 50 };
+ anchor = { right = 0, bottom = 0 };
+
+ bool NotifyClicked(Button button, int x, int y, Modifiers mods)
+ {
+#if 0
+ File f = FileOpen("/persist/test.txt", read);
+ PrintLn("NotifyClicked");
+ PrintLn(f == null ? "error: " : "ok: ", "File f = FileOpen(\"/persist/test.txt\", read);");
+ if(f)
+ {
+ PrintLn("PrintLn(f);");
+ PrintLn(f);
+ PrintLn("delete f;");
+ delete f;
+ }
+#endif
+ picture.image = null;
+ picture.image = { ":ecere.png" };
+ return true;
+ }
};
+
+ Picture picture
+ {
+ this, size = { 80, 80 }, anchor = { top = 0 }//, image = { ":ecere.png" };
+ };
+
+ bool OnPostCreate()
+ {
+ //picture.image = { ":ecere.png" };
+
+#if 0
+ /*PrintLn("if(FileExists(\"/persist/test.txt\"))");
+ if(1)//if(FileExists("/persist/test.txt"))
+ {
+ PrintLn("File f = FileOpen(\"/persist/test.txt\", read);");
+ File f = FileOpen("/persist/test.txt", read);
+ if(f)
+ {
+ PrintLn("PrintLn(f);");
+ PrintLn(f);
+ delete f;
+ }
+ }
+ else*/
+ {
+ File f = FileOpen("/persist/test.txt", write);
+ PrintLn(f == null ? "error: " : "ok: ", "File f = FileOpen(\"/persist/test.txt\", write);");
+ if(f)
+ {
+ PrintLn("f.PrintLn(\"yo!\");");
+ f.PrintLn("yo!");
+ PrintLn("delete f;");
+ delete f;
+ }
+ }
+#endif
+ return true;
+ }
};
HelloForm hello { };
"Libraries" : [
"ecereStatic",
"freetype",
+ "png",
"z"
- ],
- "LibraryDirs" : [
- "../../../ecere/obj/emscripten.linux.emscripten.x32"
]
}
}
],
"ResourcesPath" : "",
"Resources" : [
-
+ "../../../share/pixmaps/ecere.png"
]
}