Skip to content

Commit 12e86ed

Browse files
committed
Merge remote-tracking branch 'fork/master' into vcproj
2 parents 2272321 + bb35b78 commit 12e86ed

9 files changed

Lines changed: 71 additions & 1 deletion

File tree

.gitignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,13 @@
11
/build/
2+
/dependencies/detect_compiler_x86-windows-static
3+
/dependencies/giflib_x86-windows-static
4+
/dependencies/libjpeg-turbo_x86-windows-static
5+
/dependencies/liblzma_x86-windows-static
6+
/dependencies/libpng_x86-windows-static
7+
/dependencies/luajit_x86-windows-static
8+
/dependencies/tiff_x86-windows-static
9+
/dependencies/zlib_x86-windows-static
10+
.vs
11+
/Debug/
12+
/Release/
13+
/SimpleGraphic.vcxproj.user

CONTRIBUTING.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
### Instructions to build a DLL
2+
1. Check out git to a new folder
3+
2. Open VS2019
4+
3. Choose the "Open a folder" option and choose the git checkout
5+
4. In the configurations dropdown, choose "Manage configurations..."
6+
5. Add a new x86-Release configuration and save the CMakeSettings.json file
7+
6. Choose this new x86-Release configuration in the configurations dropdown
8+
7. Go to Build->Build All and wait for the build to complete with no errors
9+
8. Find the new dll in out\build\x86-Release\SimpleGraphic.dll
10+
11+
To use this DLL, simply copy it to your Path Of Building install location and restart Path Of Building

README.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Path of Building Community SimpleGraphic.dll
2+
3+
## Introduction
4+
5+
SimpleGraphic.dll is the host environment for Lua. It contains the API used by the application's Lua logic, as well as a 2D OpenGL renderer, window management, input handling, and a debug console. It exports one symbol, RunLuaFileAsWin, which is passed a C-style argc/argv argument list, with the script path as argv[0].
6+
7+
The Windows-specific code is contained in 5 files:
8+
- win\entry.cpp: Contains the DLL export. It just creates the system main module, and runs it.
9+
- engine\system\win\sys_main.cpp: The system main module; it initialises the application, and contains generic OS interface functions, such as input and clipboard handling.
10+
- engine\system\win\sys_console.cpp: Manages the debug console window that appears during the program's initialisation.
11+
- engine\system\win\sys_video.cpp: Creates and manages the main program window.
12+
- engine\system\win\sys_opengl.cpp: Initialises OpenGL.
13+
14+
## Building
15+
16+
SimpleGraphic.dll is currently built using Visual Studio 2019.
17+
18+
The dll depends on a number of 3rd party libraries. Details and instructions for how to obtain them are in DEPENDENCIES.md.
19+
20+
Once the libraries are obtained, follow these instructions to build the DLL:
21+
1) Open SimpleGraphic.sln in Visual Studio 2019
22+
2) Choose the `Release|x86` configuration.
23+
3) Build the solution
24+
4) The resulting `SimpleGraphic.dll` can be found in the `Release` directory.
25+
5) Copy `SimpleGraphic.dll` to the Path of Building install directory, replacing the existing file.
26+
27+
## Debugging
28+
29+
Since SimpleGraphic.dll is dynamically loaded by `PathOfBuilding.exe`, to debug it, run `PathOfBuilding.exe` and then attach to that process using the `Debug->Attach to Process...` menu option in Visual Studio.
30+
31+
If debugging of the initialization is desired, then adding a MessageBox or some other pause at the start will give you time to attach and continue.

engine/render.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ class r_IRenderer {
6969
virtual void SetClearColor(const col4_t col) = 0;
7070
virtual void SetDrawLayer(int layer, int subLayer = 0) = 0;
7171
virtual void SetDrawSubLayer(int subLayer) = 0;
72+
virtual int GetDrawLayer() = 0;
7273
virtual void SetViewport(int x = 0, int y = 0, int width = 0, int height = 0) = 0;
7374
virtual void DrawColor(const col4_t col = NULL) = 0;
7475
virtual void DrawColor(dword col) = 0;

engine/render/r_main.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -600,6 +600,11 @@ void r_renderer_c::SetDrawSubLayer(int subLayer)
600600
SetDrawLayer(curLayer->layer, subLayer);
601601
}
602602

603+
int r_renderer_c::GetDrawLayer()
604+
{
605+
return curLayer->subLayer;
606+
}
607+
603608
void r_renderer_c::SetViewport(int x, int y, int width, int height)
604609
{
605610
if (height == 0) {

engine/render/r_main.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ class r_renderer_c: public r_IRenderer, public conCmdHandler_c {
6767
void SetClearColor(const col4_t col);
6868
void SetDrawLayer(int layer, int subLayer = 0);
6969
void SetDrawSubLayer(int subLayer);
70+
int GetDrawLayer();
7071
void SetViewport(int x = 0, int y = 0, int width = 0, int height = 0);
7172
void DrawColor(const col4_t col = NULL);
7273
void DrawColor(dword col);

engine/system/win/sys_local.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,6 @@ class sys_main_c: public sys_IMain {
6060
volatile bool restartFlag = false;
6161
char* exitMsg = nullptr;
6262
char* threadError = nullptr;
63-
bool errorRaised = nullptr;
63+
bool errorRaised = false;
6464
int baseTime = 0;
6565
};

engine/tiff.lib

32.7 KB
Binary file not shown.

ui_api.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
** width, height = GetScreenSize()
3434
** SetClearColor(red, green, blue[, alpha])
3535
** SetDrawLayer({layer|nil}[, subLayer)
36+
** GetDrawLayer()
3637
** SetViewport([x, y, width, height])
3738
** SetDrawColor(red, green, blue[, alpha]) / SetDrawColor("<escapeStr>")
3839
** DrawImage({imgHandle|nil}, left, top, width, height[, tcLeft, tcTop, tcRight, tcBottom])
@@ -308,6 +309,13 @@ static int l_SetDrawLayer(lua_State* L)
308309
return 0;
309310
}
310311

312+
static int l_GetDrawLayer(lua_State* L)
313+
{
314+
ui_main_c* ui = GetUIPtr(L);
315+
lua_pushinteger(L, ui->renderer->GetDrawLayer());
316+
return 1;
317+
}
318+
311319
static int l_SetViewport(lua_State* L)
312320
{
313321
ui_main_c* ui = GetUIPtr(L);
@@ -1175,6 +1183,7 @@ int ui_main_c::InitAPI(lua_State* L)
11751183
ADDFUNC(GetScreenSize);
11761184
ADDFUNC(SetClearColor);
11771185
ADDFUNC(SetDrawLayer);
1186+
ADDFUNC(GetDrawLayer);
11781187
ADDFUNC(SetViewport);
11791188
ADDFUNC(SetDrawColor);
11801189
ADDFUNC(DrawImage);

0 commit comments

Comments
 (0)