Improve documentation for C++ plugins (Thanks xnotx123)

Also get icon working on windows 98
This commit is contained in:
UnknownShadow200 2021-01-22 21:27:54 +11:00
parent 18b2fcc9c8
commit d5226a023f
2 changed files with 14 additions and 5 deletions

View File

@ -61,8 +61,8 @@ All plugins require this boilerplate, so feel free to copy and paste it.
---
### Writing plugins in other languages
When writing plugins with C++, game headers must be surroundined with `extern "C"`, i.e.
### Writing plugins in C++
When including game headers, they must be surrounded with `extern "C"`, i.e.
```C
extern "C" {
#include "src/Chat.h"
@ -71,6 +71,15 @@ extern "C" {
```
Otherwise you will get obscure `Undefined reference` errors when compiling.
Exported plugin functions must be surrounded with `extern "C"`, i.e.
```C
extern "C" {
EXPORT int Plugin_ApiVersion = 1;
EXPORT struct IGameComponent Plugin_Component = { TestPlugin_Init };
}
```
Otherwise your plugin will not load. (you'll see `error getting plugin version` in-game)
---
### Linux

View File

@ -706,9 +706,9 @@ static ATOM DoRegisterClass(void) {
wc.lpfnWndProc = Window_Procedure;
wc.lpszClassName = CC_WIN_CLASSNAME;
wc.hIcon = (HICON)LoadImage(win_instance, MAKEINTRESOURCE(1), IMAGE_ICON,
wc.hIcon = (HICON)LoadImageA(win_instance, MAKEINTRESOURCEA(1), IMAGE_ICON,
GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON), 0);
wc.hIconSm = (HICON)LoadImage(win_instance, MAKEINTRESOURCE(1), IMAGE_ICON,
wc.hIconSm = (HICON)LoadImageA(win_instance, MAKEINTRESOURCEA(1), IMAGE_ICON,
GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0);
wc.hCursor = LoadCursorA(NULL, IDC_ARROW);
@ -741,7 +741,7 @@ static void DoCreateWindow(ATOM atom, int width, int height) {
void Window_Create(int width, int height) {
ATOM atom;
win_instance = GetModuleHandle(NULL);
win_instance = GetModuleHandleA(NULL);
/* TODO: UngroupFromTaskbar(); */
width = Display_ScaleX(width);
height = Display_ScaleY(height);