mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 02:15:43 -04:00
build on windows
This commit is contained in:
parent
44058ed433
commit
f2437ed29e
@ -94,7 +94,8 @@ initialize() {
|
||||
nout << "_root_dir = " << _root_dir << "\n";
|
||||
|
||||
#ifdef _WIN32
|
||||
_download_url = "http://10.196.143.118/~drose/p3d/";
|
||||
// _download_url = "http://10.196.143.118/~drose/p3d/";
|
||||
_download_url = "http://www.ddrose.com/~drose/p3dwin/";
|
||||
|
||||
#else
|
||||
_download_url = "http://www.ddrose.com/~drose/p3d/";
|
||||
|
@ -33,7 +33,7 @@ P3DWinProgressWindow(P3DPackage *package, P3DSession *session,
|
||||
|
||||
INIT_LOCK(_progress_lock);
|
||||
|
||||
assert(_window_type != P3D_WT_hidden);
|
||||
assert(_wparams.get_window_type() != P3D_WT_hidden);
|
||||
start_thread();
|
||||
}
|
||||
|
||||
@ -193,24 +193,24 @@ make_window() {
|
||||
|
||||
int x = CW_USEDEFAULT;
|
||||
int y = CW_USEDEFAULT;
|
||||
if (_win_x != 0 && _win_y != 0) {
|
||||
x = _win_x;
|
||||
y = _win_y;
|
||||
if (_wparams.get_win_x() != 0 && _wparams.get_win_y() != 0) {
|
||||
x = _wparams.get_win_x();
|
||||
y = _wparams.get_win_y();
|
||||
}
|
||||
|
||||
int width = 320;
|
||||
int height = 240;
|
||||
if (_win_width != 0 && _win_height != 0) {
|
||||
width = _win_width;
|
||||
height = _win_height;
|
||||
if (_wparams.get_win_width() != 0 && _wparams.get_win_height() != 0) {
|
||||
width = _wparams.get_win_width();
|
||||
height = _wparams.get_win_height();
|
||||
}
|
||||
|
||||
if (_window_type == P3D_WT_embedded) {
|
||||
if (_wparams.get_window_type() == P3D_WT_embedded) {
|
||||
// Create an embedded window.
|
||||
DWORD window_style =
|
||||
WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
|
||||
|
||||
HWND parent_hwnd = _parent_window._hwnd;
|
||||
HWND parent_hwnd = _wparams.get_parent_window()._hwnd;
|
||||
|
||||
_hwnd =
|
||||
CreateWindow("panda3d_progress", "Panda3D", window_style,
|
||||
|
@ -54,8 +54,8 @@ extern ofstream logfile;
|
||||
#endif // _WIN32, __APPLE__
|
||||
|
||||
#include "npapi.h"
|
||||
#include "npfunctions.h"
|
||||
//#include "npupp.h"
|
||||
//#include "npfunctions.h"
|
||||
#include "npupp.h"
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -16,6 +16,10 @@
|
||||
|
||||
#include "../plugin/load_plugin_src.cxx"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
|
||||
ofstream logfile;
|
||||
bool logfile_is_open = false;
|
||||
static void
|
||||
@ -34,65 +38,10 @@ open_logfile() {
|
||||
// structure containing pointers to functions implemented by the browser
|
||||
static NPNetscapeFuncs *browser;
|
||||
|
||||
// Symbol called once by the browser to initialize the plugin
|
||||
NPError
|
||||
NP_Initialize(NPNetscapeFuncs *browserFuncs) {
|
||||
// save away browser functions
|
||||
browser = browserFuncs;
|
||||
|
||||
open_logfile();
|
||||
logfile << "initializing\n" << flush;
|
||||
|
||||
logfile << "browserFuncs = " << browserFuncs << "\n" << flush;
|
||||
|
||||
string plugin_location = "/Users/drose/player/direct/built/lib/libp3d_plugin.dylib";
|
||||
|
||||
if (!load_plugin(plugin_location.c_str())) {
|
||||
logfile << "couldn't load plugin\n" << flush;
|
||||
return NPERR_INVALID_PLUGIN_ERROR;
|
||||
}
|
||||
|
||||
return NPERR_NO_ERROR;
|
||||
}
|
||||
|
||||
// Symbol called by the browser to get the plugin's function list
|
||||
NPError
|
||||
NP_GetEntryPoints(NPPluginFuncs *pluginFuncs) {
|
||||
open_logfile();
|
||||
logfile << "NP_GetEntryPoints, pluginFuncs = " << pluginFuncs << "\n"
|
||||
<< flush;
|
||||
pluginFuncs->version = 11;
|
||||
pluginFuncs->size = sizeof(pluginFuncs);
|
||||
pluginFuncs->newp = NPP_New;
|
||||
pluginFuncs->destroy = NPP_Destroy;
|
||||
pluginFuncs->setwindow = NPP_SetWindow;
|
||||
pluginFuncs->newstream = NPP_NewStream;
|
||||
pluginFuncs->destroystream = NPP_DestroyStream;
|
||||
pluginFuncs->asfile = NPP_StreamAsFile;
|
||||
pluginFuncs->writeready = NPP_WriteReady;
|
||||
pluginFuncs->write = NPP_Write;
|
||||
pluginFuncs->print = NPP_Print;
|
||||
pluginFuncs->event = NPP_HandleEvent;
|
||||
pluginFuncs->urlnotify = NPP_URLNotify;
|
||||
pluginFuncs->getvalue = NPP_GetValue;
|
||||
pluginFuncs->setvalue = NPP_SetValue;
|
||||
|
||||
return NPERR_NO_ERROR;
|
||||
}
|
||||
|
||||
// Symbol called once by the browser to shut down the plugin
|
||||
NPError
|
||||
NP_Shutdown(void) {
|
||||
logfile << "shutdown\n" << flush;
|
||||
unload_plugin();
|
||||
|
||||
return NPERR_NO_ERROR;
|
||||
}
|
||||
|
||||
// Called to create a new instance of the plugin
|
||||
NPError
|
||||
NPP_New(NPMIMEType pluginType, NPP instance, uint16_t mode,
|
||||
int16_t argc, char *argn[], char *argv[], NPSavedData *saved) {
|
||||
NPP_New(NPMIMEType pluginType, NPP instance, uint16 mode,
|
||||
int16 argc, char *argn[], char *argv[], NPSavedData *saved) {
|
||||
logfile << "new instance\n" << flush;
|
||||
|
||||
// Copy the tokens into a temporary array of P3D_token objects.
|
||||
@ -148,7 +97,7 @@ NPP_SetWindow(NPP instance, NPWindow *window) {
|
||||
|
||||
NPError
|
||||
NPP_NewStream(NPP instance, NPMIMEType type, NPStream *stream,
|
||||
NPBool seekable, uint16_t *stype) {
|
||||
NPBool seekable, uint16 *stype) {
|
||||
*stype = NP_ASFILEONLY;
|
||||
return NPERR_NO_ERROR;
|
||||
}
|
||||
@ -158,14 +107,14 @@ NPP_DestroyStream(NPP instance, NPStream *stream, NPReason reason) {
|
||||
return NPERR_NO_ERROR;
|
||||
}
|
||||
|
||||
int32_t
|
||||
int32
|
||||
NPP_WriteReady(NPP instance, NPStream *stream) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t
|
||||
NPP_Write(NPP instance, NPStream *stream, int32_t offset,
|
||||
int32_t len, void *buffer) {
|
||||
int32
|
||||
NPP_Write(NPP instance, NPStream *stream, int32 offset,
|
||||
int32 len, void *buffer) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -177,7 +126,7 @@ void
|
||||
NPP_Print(NPP instance, NPPrint *platformPrint) {
|
||||
}
|
||||
|
||||
int16_t
|
||||
int16
|
||||
NPP_HandleEvent(NPP instance, void *event) {
|
||||
return 0;
|
||||
}
|
||||
@ -196,3 +145,62 @@ NPError
|
||||
NPP_SetValue(NPP instance, NPNVariable variable, void *value) {
|
||||
return NPERR_GENERIC_ERROR;
|
||||
}
|
||||
|
||||
// Symbol called once by the browser to initialize the plugin
|
||||
NPError OSCALL
|
||||
NP_Initialize(NPNetscapeFuncs *browserFuncs) {
|
||||
// save away browser functions
|
||||
browser = browserFuncs;
|
||||
|
||||
open_logfile();
|
||||
logfile << "initializing\n" << flush;
|
||||
|
||||
logfile << "browserFuncs = " << browserFuncs << "\n" << flush;
|
||||
|
||||
#ifdef _WIN32
|
||||
string plugin_location = "c:/cygwin/home/drose/player/direct/built/lib/libp3d_plugin.dll";
|
||||
#else
|
||||
string plugin_location = "/Users/drose/player/direct/built/lib/libp3d_plugin.dylib";
|
||||
#endif
|
||||
|
||||
if (!load_plugin(plugin_location.c_str())) {
|
||||
logfile << "couldn't load plugin\n" << flush;
|
||||
return NPERR_INVALID_PLUGIN_ERROR;
|
||||
}
|
||||
|
||||
return NPERR_NO_ERROR;
|
||||
}
|
||||
|
||||
// Symbol called by the browser to get the plugin's function list
|
||||
NPError OSCALL
|
||||
NP_GetEntryPoints(NPPluginFuncs *pluginFuncs) {
|
||||
open_logfile();
|
||||
logfile << "NP_GetEntryPoints, pluginFuncs = " << pluginFuncs << "\n"
|
||||
<< flush;
|
||||
pluginFuncs->version = 11;
|
||||
pluginFuncs->size = sizeof(pluginFuncs);
|
||||
pluginFuncs->newp = NPP_New;
|
||||
pluginFuncs->destroy = NPP_Destroy;
|
||||
pluginFuncs->setwindow = NPP_SetWindow;
|
||||
pluginFuncs->newstream = NPP_NewStream;
|
||||
pluginFuncs->destroystream = NPP_DestroyStream;
|
||||
pluginFuncs->asfile = NPP_StreamAsFile;
|
||||
pluginFuncs->writeready = NPP_WriteReady;
|
||||
pluginFuncs->write = NPP_Write;
|
||||
pluginFuncs->print = NPP_Print;
|
||||
pluginFuncs->event = NPP_HandleEvent;
|
||||
pluginFuncs->urlnotify = NPP_URLNotify;
|
||||
pluginFuncs->getvalue = NPP_GetValue;
|
||||
pluginFuncs->setvalue = NPP_SetValue;
|
||||
|
||||
return NPERR_NO_ERROR;
|
||||
}
|
||||
|
||||
// Symbol called once by the browser to shut down the plugin
|
||||
NPError OSCALL
|
||||
NP_Shutdown(void) {
|
||||
logfile << "shutdown\n" << flush;
|
||||
unload_plugin();
|
||||
|
||||
return NPERR_NO_ERROR;
|
||||
}
|
||||
|
@ -20,9 +20,9 @@
|
||||
#include "../plugin/load_plugin_src.h"
|
||||
|
||||
extern "C" {
|
||||
NPError NP_Initialize(NPNetscapeFuncs *browserFuncs);
|
||||
NPError NP_GetEntryPoints(NPPluginFuncs *pluginFuncs);
|
||||
NPError NP_Shutdown(void);
|
||||
NPError OSCALL NP_Initialize(NPNetscapeFuncs *browserFuncs);
|
||||
NPError OSCALL NP_GetEntryPoints(NPPluginFuncs *pluginFuncs);
|
||||
NPError OSCALL NP_Shutdown(void);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user