Skip to content

Commit d7542c3

Browse files
committed
- add stubbed functions, compiling and launching
1 parent d83d970 commit d7542c3

File tree

8 files changed

+205
-38
lines changed

8 files changed

+205
-38
lines changed

core/pen/project.lua

Lines changed: 33 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ local function setup_win32()
44
{
55
"$(VK_SDK_PATH)/Include"
66
}
7-
elseif renderer_dir == "opengl" then
7+
elseif renderer_dir == "opengl" then
88
includedirs
99
{
1010
"../../third_party/glew/include",
@@ -16,31 +16,31 @@ local function setup_win32()
1616
end
1717

1818
local function setup_ios()
19-
files
20-
{
19+
files
20+
{
2121
"source/posix/**.cpp",
2222
"source/mach/**.cpp"
2323
}
2424
end
2525

2626
local function setup_osx()
27-
files
28-
{
27+
files
28+
{
2929
"source/posix/**.cpp",
3030
"source/mach/**.cpp"
3131
}
3232
end
3333

3434
local function setup_linux()
35-
files
36-
{
35+
files
36+
{
3737
"source/posix/**.cpp"
3838
}
3939
end
4040

4141
local function setup_web()
42-
files
43-
{
42+
files
43+
{
4444
"source/posix/**.cpp",
4545
"source/linux/timer.cpp",
4646
"source/single_threaded/**.cpp"
@@ -52,9 +52,12 @@ local function setup_web()
5252
end
5353

5454
local function setup_android()
55-
files
56-
{
57-
"source/posix/**.cpp"
55+
files
56+
{
57+
"source/posix/pen_string.cpp",
58+
"source/posix/threads.cpp",
59+
60+
"source/linux/timer.cpp",
5861
}
5962
end
6063

@@ -74,58 +77,58 @@ local function setup_platform()
7477
end
7578
end
7679

77-
-- Project
80+
-- Project
7881
project "pen"
7982
setup_env()
8083
setup_platform_defines()
81-
setup_platform()
84+
setup_platform()
8285
location ("build/" .. platform_dir)
8386
kind "StaticLib"
8487
language "C++"
85-
86-
files
88+
89+
files
8790
{
8891
"include/*.h",
8992
"source/*.cpp",
90-
91-
"include/" .. platform_dir .. "/**.h",
93+
94+
"include/" .. platform_dir .. "/**.h",
9295

9396
"source/" .. platform_dir .. "/**.cpp",
9497
"source/" .. platform_dir .. "/**.mm",
95-
96-
"../../third_party/str/*.cpp",
98+
99+
"../../third_party/str/*.cpp",
97100
}
98-
99-
includedirs
101+
102+
includedirs
100103
{
101104
"include",
102-
"include/" .. platform_dir,
103-
104-
"../../third_party",
105+
"include/" .. platform_dir,
106+
107+
"../../third_party",
105108
"../../third_party/libstem_gamepad/source"
106109
}
107-
110+
108111
-- rendere selection, and allow for no renderer
109112
if string.len(renderer_dir) > 0 then
110113
files
111-
{
114+
{
112115
"include/" .. renderer_dir .. "/**.h",
113116
"source/" .. renderer_dir .. "/**.cpp",
114117
"source/" .. renderer_dir .. "/**.mm",
115118
}
116-
includedirs
119+
includedirs
117120
{
118121
"include/" .. renderer_dir,
119122
}
120123
end
121-
124+
122125
filter "configurations:Release"
123126
defines { "NDEBUG" }
124127
entrypoint "WinMainCRTStartup"
125128
optimize "Speed"
126129
targetdir ("lib/" .. platform_dir .. "/release")
127130
targetname "pen"
128-
131+
129132
filter "configurations:Debug"
130133
defines { "DEBUG" }
131134
entrypoint "WinMainCRTStartup"
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
// file_system.cpp
2+
// Copyright 2014 - 2023 Alex Dixon.
3+
// License: https://github.com/polymonster/pmtech/blob/master/license.md
4+
5+
#include "file_system.h"
6+
#include "memory.h"
7+
#include "os.h"
8+
#include "pen.h"
9+
#include "pen_string.h"
10+
11+
namespace pen
12+
{
13+
bool filesystem_file_exists(const c8* filename)
14+
{
15+
return false;
16+
}
17+
18+
pen_error filesystem_read_file_to_buffer(const c8* filename, void** p_buffer, u32& buffer_size)
19+
{
20+
return PEN_ERR_FILE_NOT_FOUND;
21+
}
22+
23+
pen_error filesystem_enum_volumes(fs_tree_node& results)
24+
{
25+
return PEN_ERR_OK;
26+
}
27+
28+
void filesystem_toggle_hidden_files()
29+
{
30+
31+
}
32+
33+
bool match_file(struct dirent* ent, s32 num_wildcards, va_list wildcards)
34+
{
35+
return false;
36+
}
37+
38+
pen_error filesystem_enum_directory(const c8* directory, fs_tree_node& results, s32 num_wildcards, ...)
39+
{
40+
return PEN_ERR_OK;
41+
}
42+
43+
pen_error filesystem_enum_directory(const c8* directory, fs_tree_node& results, s32 num_wildcards, va_list wildcards)
44+
{
45+
return PEN_ERR_OK;
46+
}
47+
48+
pen_error filesystem_enum_free_mem(fs_tree_node& tree)
49+
{
50+
return PEN_ERR_OK;
51+
}
52+
53+
pen_error filesystem_getmtime(const c8* filename, u32& mtime_out)
54+
{
55+
return PEN_ERR_OK;
56+
}
57+
58+
size_t filesystem_getsize(const c8* filename)
59+
{
60+
return 0;
61+
}
62+
63+
const c8* filesystem_get_user_directory()
64+
{
65+
return nullptr;
66+
}
67+
68+
const c8** filesystem_get_user_directory(s32& directory_depth)
69+
{
70+
return nullptr;
71+
}
72+
73+
s32 filesystem_exclude_slash_depth()
74+
{
75+
// directory depth 0 can be a slash
76+
return 0;
77+
}
78+
} // namespace pen

core/pen/source/android/os.cpp

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,33 @@
22
// Copyright 2014 - 2023 Alex Dixon.
33
// License: https://github.com/polymonster/pmtech/blob/master/license.md
44

5+
#include "os.h"
6+
57
#include "threads.h"
8+
69
#include <jni.h>
710

11+
// global externs
12+
pen::user_info pen_user_info;
13+
pen::window_creation_params pen_window;
14+
815
int main()
916
{
1017
}
1118

19+
void pen_make_gl_context_current()
20+
{
21+
22+
}
23+
24+
void pen_gl_swap_buffers()
25+
{
26+
27+
}
28+
1229
namespace pen
1330
{
31+
/*
1432
void semaphore_post(pen::semaphore*, unsigned int)
1533
{
1634
}
@@ -23,4 +41,35 @@ namespace pen
2341
{
2442
return true;
2543
}
44+
*/
45+
46+
hash_id window_get_id()
47+
{
48+
return 0;
49+
}
50+
51+
const c8* window_get_title()
52+
{
53+
return "pmtech_window";
54+
}
55+
56+
const Str os_path_for_resource(const c8* filename)
57+
{
58+
return "todo";
59+
}
60+
61+
bool os_update()
62+
{
63+
return true;
64+
}
65+
66+
void os_terminate(u32 return_code)
67+
{
68+
69+
}
70+
71+
void window_get_size(s32& width, s32& height)
72+
{
73+
74+
}
2675
} // namespace pen

core/pen/source/input.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ namespace pen
239239
// Gamepad
240240
//
241241

242-
#if !PEN_PLATFORM_IOS && !PEN_PLATFORM_WEB
242+
#if !PEN_PLATFORM_IOS && !PEN_PLATFORM_WEB && !PEN_PLATFORM_ANDROID
243243

244244
#define API_RAW_INPUT 0
245245
#define API_XINPUT 1

core/pen/source/opengl/renderer_opengl.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,16 @@
2222
#include <vector>
2323

2424
#ifdef __linux__
25+
#if !PEN_PLATFORM_ANDROID
2526
#include "GL/glew.h"
27+
#else
28+
#define PEN_GLES3 1
29+
#include <GLES3/gl3.h>
30+
#include <GLES3/gl31.h>
31+
#include <GLES3/gl32.h>
32+
#include <GLES2/gl2ext.h>
33+
#include <EGL/egl.h>
34+
#endif
2635
#elif _WIN32
2736
#define GLEW_STATIC
2837
#include "GL/glew.h"
@@ -181,6 +190,7 @@ namespace
181190

182191
u32 to_gl_polygon_mode(u32 pen_polygon_mode)
183192
{
193+
#if !PEN_PLATFORM_ANDROID
184194
switch (pen_polygon_mode)
185195
{
186196
case PEN_FILL_SOLID:
@@ -190,6 +200,8 @@ namespace
190200
}
191201
PEN_ASSERT(0);
192202
return GL_FILL;
203+
#endif
204+
return 0;
193205
}
194206

195207
u32 to_gl_cull_mode(u32 pen_cull_mode)

core/pen/source/posix/file_system.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
#else
3838
#define WRITE_FILE_DEPENDENCIES(fn)
3939
#endif
40-
40+
#if 0
4141
namespace
4242
{
4343
// utility function to output file dependencies use by a pmtech app to trim data sizes in wasm .data bundles
@@ -343,3 +343,4 @@ namespace pen
343343
return 0;
344344
}
345345
} // namespace pen
346+
#endif

examples/premake5.lua

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ solution ("pmtech_examples_" .. platform)
1919
}
2020

2121
if platform == "android" then
22+
defines {
23+
"PEN_PLATFORM_ANDROID"
24+
}
2225
androidnamespace "com.pmtech.examples"
2326
androidabis { "armeabi-v7a", "arm64-v8a" }
2427
gradleversion "com.android.tools.build:gradle:8.2.2"
@@ -30,9 +33,9 @@ solution ("pmtech_examples_" .. platform)
3033
"mavenCentral()"
3134
}
3235
androiddependencies {
33-
"com.android.support:appcompat-v7:+",
34-
"com.android.support:support-v4:25.0.0",
35-
"com.android.support:design:25.0.0"
36+
--"com.android.support:appcompat-v7:+",
37+
--"com.android.support:support-v4:25.0.0",
38+
--"com.android.support:design:25.0.0"
3639
}
3740
gradleproperties {
3841
"org.gradle.jvmargs=-Xmx4608m --add-exports=java.base/sun.nio.ch=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-exports=jdk.unsupported/sun.misc=ALL-UNNAMED",

0 commit comments

Comments
 (0)