From 92ebf506dd73824563d10d9626ea8bb3259af7cd Mon Sep 17 00:00:00 2001 From: Lea Anthony Date: Sat, 20 Mar 2021 18:32:09 +1100 Subject: [PATCH] Get app compiling --- v2/internal/ffenestri/common.h | 4 -- v2/internal/ffenestri/ffenestri_windows.c | 78 ++++++++++++++++++++++ v2/internal/ffenestri/ffenestri_windows.go | 14 ++++ v2/internal/ffenestri/ffenestri_windows.h | 5 ++ v2/internal/system/system_windows.go | 5 -- v2/pkg/commands/build/build.go | 4 +- 6 files changed, 99 insertions(+), 11 deletions(-) create mode 100644 v2/internal/ffenestri/ffenestri_windows.c create mode 100644 v2/internal/ffenestri/ffenestri_windows.go create mode 100644 v2/internal/ffenestri/ffenestri_windows.h diff --git a/v2/internal/ffenestri/common.h b/v2/internal/ffenestri/common.h index c0256935..7f6e3a50 100644 --- a/v2/internal/ffenestri/common.h +++ b/v2/internal/ffenestri/common.h @@ -5,10 +5,6 @@ #ifndef COMMON_H #define COMMON_H -#define OBJC_OLD_DISPATCH_PROTOTYPES 1 -#include -#include - #include #include #include "string.h" diff --git a/v2/internal/ffenestri/ffenestri_windows.c b/v2/internal/ffenestri/ffenestri_windows.c new file mode 100644 index 00000000..b72e52a1 --- /dev/null +++ b/v2/internal/ffenestri/ffenestri_windows.c @@ -0,0 +1,78 @@ + +typedef struct { +} Application; + +struct Application *NewApplication(const char *title, int width, int height, int resizable, int devtools, int fullscreen, int startHidden, int logLevel, int hideWindowOnClose) { +} +void SetMinWindowSize(struct Application* app, int minWidth, int minHeight) { +} +void SetMaxWindowSize(struct Application* app, int maxWidth, int maxHeight) { +} +void Run(struct Application* app, int argc, char **argv) { +} +void DestroyApplication(struct Application* app) { +} +void SetDebug(struct Application* app, int flag) { +} +void SetBindings(struct Application* app, const char *bindings) { +} +void ExecJS(struct Application* app, const char *script) { +} +void Hide(struct Application* app) { +} +void Show(struct Application* app) { +} +void Center(struct Application* app) { +} +void Maximise(struct Application* app) { +} +void Unmaximise(struct Application* app) { +} +void ToggleMaximise(struct Application* app) { +} +void Minimise(struct Application* app) { +} +void Unminimise(struct Application* app) { +} +void ToggleMinimise(struct Application* app) { +} +void SetColour(struct Application* app, int red, int green, int blue, int alpha) { +} +void SetSize(struct Application* app, int width, int height) { +} +void SetPosition(struct Application* app, int x, int y) { +} +void Quit(struct Application* app) { +} +void SetTitle(struct Application* app, const char *title) { +} +void Fullscreen(struct Application* app) { +} +void UnFullscreen(struct Application* app) { +} +void ToggleFullscreen(struct Application* app) { +} +void DisableFrame(struct Application* app) { +} +void OpenDialog(struct Application* app, char *callbackID, char *title, char *filters, char *defaultFilename, char *defaultDir, int allowFiles, int allowDirs, int allowMultiple, int showHiddenFiles, int canCreateDirectories, int resolvesAliases, int treatPackagesAsDirectories) { +} +void SaveDialog(struct Application* app, char *callbackID, char *title, char *filters, char *defaultFilename, char *defaultDir, int showHiddenFiles, int canCreateDirectories, int treatPackagesAsDirectories) { +} +void MessageDialog(struct Application* app, char *callbackID, char *type, char *title, char *message, char *icon, char *button1, char *button2, char *button3, char *button4, char *defaultButton, char *cancelButton) { +} +void DarkModeEnabled(struct Application* app, char *callbackID) { +} +void SetApplicationMenu(struct Application* app, const char *applicationMenuJSON) { +} +void AddTrayMenu(struct Application* app, const char *menuTrayJSON) { +} +void SetTrayMenu(struct Application* app, const char *menuTrayJSON) { +} +void DeleteTrayMenuByID(struct Application* app, const char *id) { +} +void UpdateTrayMenuLabel(struct Application* app, const char* JSON) { +} +void AddContextMenu(struct Application* app, char *contextMenuJSON) { +} +void UpdateContextMenu(struct Application* app, char *contextMenuJSON) { +} \ No newline at end of file diff --git a/v2/internal/ffenestri/ffenestri_windows.go b/v2/internal/ffenestri/ffenestri_windows.go new file mode 100644 index 00000000..3edf2482 --- /dev/null +++ b/v2/internal/ffenestri/ffenestri_windows.go @@ -0,0 +1,14 @@ +package ffenestri + +/* + +#include "ffenestri.h" +#include "ffenestri_windows.h" + +*/ +import "C" + +func (a *Application) processPlatformSettings() error { + + return nil +} diff --git a/v2/internal/ffenestri/ffenestri_windows.h b/v2/internal/ffenestri/ffenestri_windows.h new file mode 100644 index 00000000..9360f629 --- /dev/null +++ b/v2/internal/ffenestri/ffenestri_windows.h @@ -0,0 +1,5 @@ + +#ifndef _FFENESTRI_WINDOWS_ +#define _FFENESTRI_WINDOWS_ + +#endif \ No newline at end of file diff --git a/v2/internal/system/system_windows.go b/v2/internal/system/system_windows.go index b3d530bc..f1315d32 100644 --- a/v2/internal/system/system_windows.go +++ b/v2/internal/system/system_windows.go @@ -12,10 +12,5 @@ func (i *Info) discover() error { return err } i.OS = osinfo - - // dll := syscall.MustLoadDLL("kernel32.dll") - // p := dll.MustFindProc("GetVersion") - // v, _, _ := p.Call() - // fmt.Printf("Windows version %d.%d (Build %d)\n", byte(v), uint8(v>>8), uint16(v>>16)) return nil } diff --git a/v2/pkg/commands/build/build.go b/v2/pkg/commands/build/build.go index b5163da1..88086f36 100644 --- a/v2/pkg/commands/build/build.go +++ b/v2/pkg/commands/build/build.go @@ -59,9 +59,9 @@ func Build(options *Options) (string, error) { } // Check platform - validPlatforms := slicer.String([]string{"linux", "darwin"}) + validPlatforms := slicer.String([]string{"linux", "darwin", "windows"}) if !validPlatforms.Contains(options.Platform) { - return "", fmt.Errorf("platform %s not supported", options.Platform) + return "", fmt.Errorf("platform %s is not supported", options.Platform) } // Load project