mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-16 02:56:09 -04:00
Improve documentation for C++ plugins (Thanks xnotx123)
Also get icon working on windows 98
This commit is contained in:
parent
18b2fcc9c8
commit
d5226a023f
@ -61,8 +61,8 @@ All plugins require this boilerplate, so feel free to copy and paste it.
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### Writing plugins in other languages
|
### Writing plugins in C++
|
||||||
When writing plugins with C++, game headers must be surroundined with `extern "C"`, i.e.
|
When including game headers, they must be surrounded with `extern "C"`, i.e.
|
||||||
```C
|
```C
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include "src/Chat.h"
|
#include "src/Chat.h"
|
||||||
@ -71,6 +71,15 @@ extern "C" {
|
|||||||
```
|
```
|
||||||
Otherwise you will get obscure `Undefined reference` errors when compiling.
|
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
|
### Linux
|
||||||
|
@ -706,9 +706,9 @@ static ATOM DoRegisterClass(void) {
|
|||||||
wc.lpfnWndProc = Window_Procedure;
|
wc.lpfnWndProc = Window_Procedure;
|
||||||
wc.lpszClassName = CC_WIN_CLASSNAME;
|
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);
|
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);
|
GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0);
|
||||||
wc.hCursor = LoadCursorA(NULL, IDC_ARROW);
|
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) {
|
void Window_Create(int width, int height) {
|
||||||
ATOM atom;
|
ATOM atom;
|
||||||
win_instance = GetModuleHandle(NULL);
|
win_instance = GetModuleHandleA(NULL);
|
||||||
/* TODO: UngroupFromTaskbar(); */
|
/* TODO: UngroupFromTaskbar(); */
|
||||||
width = Display_ScaleX(width);
|
width = Display_ScaleX(width);
|
||||||
height = Display_ScaleY(height);
|
height = Display_ScaleY(height);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user