mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-13 15:44:36 +00:00
Tools directory for ticket #1
This commit is contained in:
parent
ecfd936095
commit
8337cad7ee
207 changed files with 25761 additions and 0 deletions
|
|
@ -0,0 +1,34 @@
|
|||
HKCR
|
||||
{
|
||||
__WEBGAME_PLUGINNAME__.__WEBGAME_CTRLNAME__.1 = s '__WEBGAME_CTRLNAME__ Class'
|
||||
{
|
||||
CLSID = s '{__WEBGAMELIB_UUID__}'
|
||||
}
|
||||
__WEBGAME_PLUGINNAME__.__WEBGAME_CTRLNAME__ = s '__WEBGAME_CTRLNAME__ Class'
|
||||
{
|
||||
CLSID = s '{__WEBGAMELIB_UUID__}'
|
||||
CurVer = s '__WEBGAME_PLUGINNAME__.__WEBGAME_CTRLNAME__.1'
|
||||
}
|
||||
NoRemove CLSID
|
||||
{
|
||||
ForceRemove {__WEBGAMELIB_UUID__} = s '__WEBGAME_CTRLNAME__ Class'
|
||||
{
|
||||
ProgID = s '__WEBGAME_PLUGINNAME__.__WEBGAME_CTRLNAME__.1'
|
||||
VersionIndependentProgID = s '__WEBGAME_PLUGINNAME__.__WEBGAME_CTRLNAME__'
|
||||
ForceRemove 'Programmable'
|
||||
InprocServer32 = s '%MODULE%'
|
||||
{
|
||||
val ThreadingModel = s 'Apartment'
|
||||
}
|
||||
val AppID = s '%APPID%'
|
||||
ForceRemove 'Control'
|
||||
ForceRemove 'ToolboxBitmap32' = s '%MODULE%, 102'
|
||||
'MiscStatus' = s '0'
|
||||
{
|
||||
'1' = s '%OLEMISC%'
|
||||
}
|
||||
'TypeLib' = s '{__WEBGAME_UUID__}'
|
||||
'Version' = s '1.0'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
/* this file contains the actual definitions of */
|
||||
/* the IIDs and CLSIDs */
|
||||
|
||||
/* link this file in with the server and any clients */
|
||||
|
||||
|
||||
/* File created by MIDL compiler */
|
||||
|
|
@ -0,0 +1 @@
|
|||
/* MIDL: this ALWAYS GENERATED file contains the definitions for the interfaces */
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
// IEWebGamePlugin.idl : IDL source for IEWebGamePlugin
|
||||
//
|
||||
|
||||
// This file will be processed by the MIDL tool to
|
||||
// produce the type library (IEWebGamePlugin.tlb) and marshalling code.
|
||||
|
||||
#include "olectl.h"
|
||||
import "oaidl.idl";
|
||||
import "ocidl.idl";
|
||||
|
||||
[
|
||||
object,
|
||||
uuid(__WEBGAME_UUID__),
|
||||
dual,
|
||||
nonextensible,
|
||||
helpstring("IIEWebGameCtrl Interface"),
|
||||
pointer_default(unique)
|
||||
]
|
||||
interface IIEWebGameCtrl : IDispatch{
|
||||
[propget, bindable, requestedit, id(DISPID_HWND)]
|
||||
HRESULT HWND([out, retval]LONG_PTR* pHWND);
|
||||
[id(1), helpstring("method getVariable")] HRESULT getVariable([in] BSTR name, [out, retval] BSTR* value);
|
||||
[id(2), helpstring("method setVariable")] HRESULT setVariable([in] BSTR name, [in] BSTR value);
|
||||
[id(3), helpstring("method export")] HRESULT exportFunction([in] BSTR callback, [in] LONG numArguments);
|
||||
[id(4), helpstring("method callScript")] HRESULT callScript([in] BSTR code, [out, retval] BSTR* retValue);
|
||||
[id(5), helpstring("method startup")] HRESULT startup();
|
||||
};
|
||||
|
||||
[
|
||||
uuid(__IWEBGAMECTRL_UUID__),
|
||||
version(1.0),
|
||||
helpstring("__WEBGAME_PLUGINNAME__ 1.0 Type Library")
|
||||
]
|
||||
library __WEBGAME_PLUGINNAME__Lib
|
||||
{
|
||||
importlib("stdole2.tlb");
|
||||
[
|
||||
uuid(__WEBGAMELIB_UUID__),
|
||||
control,
|
||||
helpstring("IEWebGameCtrl Class")
|
||||
]
|
||||
coclass IEWebGameCtrl
|
||||
{
|
||||
[default] interface IIEWebGameCtrl;
|
||||
};
|
||||
};
|
||||
|
|
@ -0,0 +1,135 @@
|
|||
// Microsoft Visual C++ generated resource script.
|
||||
//
|
||||
#include "resource.h"
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 2 resource.
|
||||
//
|
||||
#ifndef APSTUDIO_INVOKED
|
||||
#include "targetver.h"
|
||||
#endif
|
||||
#include "winres.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// English (U.S.) resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
#pragma code_page(1252)
|
||||
#endif //_WIN32
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// TEXTINCLUDE
|
||||
//
|
||||
|
||||
1 TEXTINCLUDE
|
||||
BEGIN
|
||||
"resource.h\0"
|
||||
END
|
||||
|
||||
2 TEXTINCLUDE
|
||||
BEGIN
|
||||
"#ifndef APSTUDIO_INVOKED\r\n"
|
||||
"#include ""targetver.h""\r\n"
|
||||
"#endif\r\n"
|
||||
"#include ""winres.h""\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
3 TEXTINCLUDE
|
||||
BEGIN
|
||||
"1 TYPELIB ""IEWebGamePlugin.tlb""\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Version
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 1,0,0,1
|
||||
PRODUCTVERSION __PLUGIN_VERSION_COMMA_DELIMITED__
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
#else
|
||||
FILEFLAGS 0x0L
|
||||
#endif
|
||||
FILEOS 0x4L
|
||||
FILETYPE 0x2L
|
||||
FILESUBTYPE 0x0L
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "040904e4"
|
||||
BEGIN
|
||||
VALUE "PluginType", "ActiveX"
|
||||
VALUE "CompanyName", "My Game Company"
|
||||
VALUE "FileDescription", "ActiveX Web Game Plugin"
|
||||
VALUE "FileVersion", "1.0.0.1"
|
||||
VALUE "LegalCopyright", "(c) My Game Company. All rights reserved."
|
||||
VALUE "InternalName", "__PLUGIN_DLL__"
|
||||
VALUE "OriginalFilename", "__PLUGIN_DLL__"
|
||||
VALUE "ProductName", "My Web Game"
|
||||
VALUE "ProductVersion", "__PLUGIN_VERSION_STRING__"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x409, 1252
|
||||
END
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// REGISTRY
|
||||
//
|
||||
|
||||
IDR_IEWEBGAMEPLUGIN REGISTRY "IEWebGamePlugin.rgs"
|
||||
IDR_IEWEBGAMECTRL REGISTRY "IEWebGameCtrl.rgs"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Bitmap
|
||||
//
|
||||
|
||||
IDB_IEWEBGAMECTRL BITMAP "IEWebGameCtrl.bmp"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// String Table
|
||||
//
|
||||
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
IDS_PROJNAME "__WEBGAME_PLUGINNAME__"
|
||||
END
|
||||
|
||||
#endif // English (U.S.) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
#ifndef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 3 resource.
|
||||
//
|
||||
1 TYPELIB "IEWebGamePlugin.tlb"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#endif // not APSTUDIO_INVOKED
|
||||
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
HKCR
|
||||
{
|
||||
NoRemove AppID
|
||||
{
|
||||
'%APPID%' = s '__WEBGAME_PLUGINNAME__'
|
||||
'__WEBGAME_PLUGINNAME__.DLL'
|
||||
{
|
||||
val AppID = s '%APPID%'
|
||||
}
|
||||
}
|
||||
}
|
||||
10
Tools/projectGenerator/templates/web/activex_dllmain_h.tpl
Normal file
10
Tools/projectGenerator/templates/web/activex_dllmain_h.tpl
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
// dllmain.h : Declaration of module class.
|
||||
|
||||
class CIEWebGamePluginModule : public CAtlDllModuleT< CIEWebGamePluginModule >
|
||||
{
|
||||
public :
|
||||
DECLARE_LIBID(LIBID___WEBGAME_PLUGINNAME__Lib)
|
||||
DECLARE_REGISTRY_APPID_RESOURCEID(IDR_IEWEBGAMEPLUGIN, "{__REGISTRY_APPID_RESOURCEID__}")
|
||||
};
|
||||
|
||||
extern class CIEWebGamePluginModule _AtlModule;
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
<!-- saved from url=(0013)about:internet -->
|
||||
<!-- see, http://technet.microsoft.com/en-us/library/bb457150.aspx#EHAA for how, why, this works for local controls --!>
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>Test page for IEWebGamePlugin</TITLE>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
|
||||
|
||||
<OBJECT ID="IEWebGameCtrl" CLASSID="CLSID:__CLASSID__" WIDTH="100%" HEIGHT="100%"></OBJECT>
|
||||
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
106
Tools/projectGenerator/templates/web/firefox_rc.tpl
Normal file
106
Tools/projectGenerator/templates/web/firefox_rc.tpl
Normal file
|
|
@ -0,0 +1,106 @@
|
|||
// Microsoft Visual C++ generated resource script.
|
||||
//
|
||||
#include "resource.h"
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 2 resource.
|
||||
//
|
||||
#include "windows.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// English (U.S.) resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
#pragma code_page(1252)
|
||||
#endif //_WIN32
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Version
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION __PRODUCTVERSION__
|
||||
PRODUCTVERSION __PRODUCTVERSION__
|
||||
FILEFLAGSMASK 0x17L
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
#else
|
||||
FILEFLAGS 0x0L
|
||||
#endif
|
||||
FILEOS 0x4L
|
||||
FILETYPE 0x2L
|
||||
FILESUBTYPE 0x0L
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "040904e4"
|
||||
BEGIN
|
||||
VALUE "PluginType", "Mozilla"
|
||||
VALUE "FileDescription", "__FILEDESCRIPTION__"
|
||||
VALUE "FileExtents", "*"
|
||||
VALUE "FileVersion", "__PRODUCTVERSION__"
|
||||
VALUE "InternalName", "__INTERNALNAME__"
|
||||
VALUE "MIMEType", "__MIMETYPE__"
|
||||
VALUE "OriginalFilename", "__ORIGINALFILENAME__"
|
||||
VALUE "ProductName", "__PRODUCTNAME__"
|
||||
VALUE "ProductVersion", "__PRODUCTVERSION__"
|
||||
VALUE "CompanyName", "__COMPANY__"
|
||||
VALUE "CompanyKey", "__COMPANYKEY__"
|
||||
VALUE "Plugin", "__PLUGIN__"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x409, 1252
|
||||
END
|
||||
END
|
||||
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// TEXTINCLUDE
|
||||
//
|
||||
|
||||
1 TEXTINCLUDE
|
||||
BEGIN
|
||||
"resource.h\0"
|
||||
END
|
||||
|
||||
2 TEXTINCLUDE
|
||||
BEGIN
|
||||
"#include ""windows.h""\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
3 TEXTINCLUDE
|
||||
BEGIN
|
||||
"\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
#endif // English (U.S.) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
#ifndef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 3 resource.
|
||||
//
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#endif // not APSTUDIO_INVOKED
|
||||
|
||||
42
Tools/projectGenerator/templates/web/safari_Info_plist.tpl
Normal file
42
Tools/projectGenerator/templates/web/safari_Info_plist.tpl
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>__CFBundleExecutable__</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string></string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>__CFBundleIdentifier__</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>BRPL</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.01</string>
|
||||
<key>CSResourcesFileMapped</key>
|
||||
<true/>
|
||||
<key>WebPluginDescription</key>
|
||||
<string>__WebPluginDescription__</string>
|
||||
<key>WebPluginMIMETypes</key>
|
||||
<dict>
|
||||
<key>__WebPluginMIMEType__</key>
|
||||
<dict>
|
||||
<key>WebPluginTypeDescription</key>
|
||||
<string>1.0</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>WebPluginName</key>
|
||||
<string>__WebPluginName__</string>
|
||||
<key>GameName</key>
|
||||
<string>__GameName__</string>
|
||||
<key>GameInstallPath</key>
|
||||
<string>__GameInstallPath__</string>
|
||||
</dict>
|
||||
</plist>
|
||||
259
Tools/projectGenerator/templates/web/sample_html.tpl
Normal file
259
Tools/projectGenerator/templates/web/sample_html.tpl
Normal file
|
|
@ -0,0 +1,259 @@
|
|||
<!-- saved from url=(0013)about:internet -->
|
||||
<!-- see, http://technet.microsoft.com/en-us/library/bb457150.aspx#EHAA for how, why, this works for local controls -->
|
||||
<!-- Please note that the saved from line must end in CR LF. Some HTML editors only insert a LF. (Thanks Microsoft) -->
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="description" content="Web Game Template" />
|
||||
<script type="text/javascript" src="jquery-1.3.2.min.js"></script>
|
||||
<link rel="stylesheet" href="styles.css" type="text/css" />
|
||||
|
||||
<script type="text/javascript" language="javascript">
|
||||
|
||||
// Relative path on web server to installer
|
||||
var installerPath = "MyGameInstaller"
|
||||
|
||||
ua = navigator.userAgent.toLowerCase();
|
||||
if( ua.indexOf('os x') != -1 || ua.indexOf('osx') != -1)
|
||||
installerPath += ".pkg";
|
||||
else
|
||||
installerPath += ".exe";
|
||||
|
||||
// Firefox/Chrome/Safari
|
||||
var mimeType = "application/__MIMETYPE__";
|
||||
|
||||
// Internet Explorer
|
||||
var projId = "__PROJID__";
|
||||
var clsId = "__CLSID__";
|
||||
|
||||
var pluginInstalled = false;
|
||||
var minimumPluginVersion = 1.0;
|
||||
|
||||
// You can set this to true if you want the page to automatically reload
|
||||
// once the plugin is installed. However, this can be better handled by
|
||||
// the installer process in most cases (by opening up web page at end of
|
||||
// install process, setting up desktop/start menu shortcuts to launch web page
|
||||
// etc
|
||||
var autoReload = false;
|
||||
|
||||
// Default client screen (overridden below from actual browser window)
|
||||
var cscreenW = 800;
|
||||
var cscreenH = 600;
|
||||
|
||||
function getClientScreenSize() {
|
||||
if( typeof( window.innerWidth ) == 'number' ) {
|
||||
//Non-IE
|
||||
cscreenW = window.innerWidth;
|
||||
cscreenH = window.innerHeight;
|
||||
} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
|
||||
//IE 6+ in 'standards compliant mode'
|
||||
cscreenW = document.documentElement.clientWidth;
|
||||
cscreenH = document.documentElement.clientHeight;
|
||||
} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
|
||||
//IE 4 compatible
|
||||
cscreenW = document.body.clientWidth;
|
||||
cscreenH = document.body.clientHeight;
|
||||
}
|
||||
}
|
||||
|
||||
function gameObjectResize(){
|
||||
if (!pluginInstalled)
|
||||
return;
|
||||
|
||||
getClientScreenSize();
|
||||
var aspectRatio = 800.0/600.0;
|
||||
var w = cscreenW - 50;
|
||||
var h = cscreenH - 125;
|
||||
if( w/h > aspectRatio )
|
||||
w = h*aspectRatio;
|
||||
else
|
||||
h = w/aspectRatio;
|
||||
var minW = 640;
|
||||
if( w < minW ){
|
||||
w = minW;
|
||||
h = w/aspectRatio;
|
||||
}
|
||||
$('#gameobject').width( Math.floor(w) );
|
||||
$('#gameobject').height( Math.floor(h) );
|
||||
$('#main').width( Math.floor(w + 2) );
|
||||
var mygame = document.getElementById("MyGame");
|
||||
mygame.width = Math.floor(w);
|
||||
mygame.height = Math.floor(h);
|
||||
}
|
||||
|
||||
$(window).resize( gameObjectResize );
|
||||
|
||||
$(document).ready(function(){
|
||||
if (pluginInstalled)
|
||||
{
|
||||
var mygame = document.getElementById("MyGame");
|
||||
// Let the game object know the page is all loaded
|
||||
// This is important to register any TorqueScript <-> JavaScript callbacks, etc
|
||||
mygame.startup();
|
||||
// Export the TorqueScript -> JavaScript bridge test function
|
||||
mygame.exportFunction("bridgeCallback",3);
|
||||
// Enable the bridge test button now that we're all set
|
||||
var bridgetest = document.getElementById("bridgetest");
|
||||
bridgetest.disabled = false;
|
||||
gameObjectResize();
|
||||
}
|
||||
});
|
||||
|
||||
// Returns the version of Internet Explorer
|
||||
// or -1 for non-IE browser
|
||||
// or -2 for 64 bit IE browser
|
||||
// (indicating the use of another browser).
|
||||
function getInternetExplorerVersion()
|
||||
{
|
||||
var rv = -1; // Return value for non-IE browser
|
||||
|
||||
if (navigator.appName == 'Microsoft Internet Explorer')
|
||||
{
|
||||
var ua = navigator.userAgent;
|
||||
|
||||
if (ua.search("Win64") != -1 || ua.search("x64") != -1)
|
||||
return -2; // Return value for IE 64 bit
|
||||
|
||||
var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
|
||||
if (re.exec(ua) != null)
|
||||
rv = parseFloat( RegExp.$1 );
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
// Checks whether the NPPlugin is installed (under Firefox/Chrome/Safari)
|
||||
function nppluginIsInstalled() {
|
||||
|
||||
if (!navigator || !navigator.mimeTypes) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
var mt = navigator.mimeTypes[mimeType];
|
||||
if (mt && mt.enabledPlugin)
|
||||
{
|
||||
var desc = mt.enabledPlugin.description;
|
||||
var descArray = desc.split(" ");
|
||||
var version = descArray[descArray.length - 1]
|
||||
return Number(version);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
function nppluginReload () {
|
||||
navigator.plugins.refresh();
|
||||
if (nppluginIsInstalled() < 0)
|
||||
window.location.reload();
|
||||
setTimeout('nppluginReload()', 500);
|
||||
}
|
||||
|
||||
function activexReload () {
|
||||
|
||||
if (activexIsInstalled() < 0)
|
||||
window.location.reload();
|
||||
setTimeout('activexReload()', 500);
|
||||
}
|
||||
|
||||
function onTestBridge()
|
||||
{
|
||||
var mygame = document.getElementById("MyGame");
|
||||
|
||||
// set/get console variables test
|
||||
// variables are automatically stored Torque 3D side in the Javascript:: namespace
|
||||
// for security reasons.
|
||||
mygame.setVariable("$TestBridge", 42);
|
||||
var everything = mygame.getVariable("$TestBridge");
|
||||
|
||||
// this tests bidirectional calling of JavaScript <-> TorqueScript including arguments and return values
|
||||
// note that testJavaScriptBridge must be specified in webConfig.h as a secure function
|
||||
var result = mygame.callScript("testJavaScriptBridge('one', 'two', 'three');");
|
||||
if (parseInt(everything) != 42)
|
||||
alert("JavaScript <-> TorqueScript: Failed, get/set console variable doesn't match");
|
||||
else if (result == "0")
|
||||
alert("JavaScript <-> TorqueScript: All Tests Passed!");
|
||||
else if (result == "1")
|
||||
alert("JavaScript -> TorqueScript: Failed, incorrect number of arguments");
|
||||
else if (result == "2")
|
||||
alert("JavaScript -> TorqueScript: Failed, incorrect argument");
|
||||
else if (result == "3")
|
||||
alert("TorqueScript -> JavaScript: Failed, incorrect return");
|
||||
else
|
||||
alert("JavaScript -> TorqueScript: Failed, unknown error");
|
||||
}
|
||||
|
||||
// Called from TorqueScript console -> JavaScript during bridge test
|
||||
function bridgeCallback(arg1, arg2, arg3)
|
||||
{
|
||||
if (arg1 != "one" || arg2 != "two" || arg3 != "three")
|
||||
{
|
||||
alert("TorqueScript -> JavaScript: Failed, incorrect argument");
|
||||
return "0";
|
||||
}
|
||||
return "42";
|
||||
}
|
||||
</script>
|
||||
|
||||
<script language='VBScript'>
|
||||
function activexIsInstalled()
|
||||
on error resume next
|
||||
dim gameControl
|
||||
dim version
|
||||
version = -1
|
||||
set gameControl = CreateObject(projId)
|
||||
if IsObject(gameControl) then
|
||||
version = CDbl(gameControl.getVariable("$version"))
|
||||
end if
|
||||
activexIsInstalled = version
|
||||
end function
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<img id = "torqueLogo" src = "./torque3D_logo.jpg">
|
||||
<div id="main">
|
||||
<div style = "height: 20px;"></div>
|
||||
<center>Web Game Template</center>
|
||||
<div id="gameobject">
|
||||
<script type="text/javascript" language="javascript">
|
||||
|
||||
// ActiveX
|
||||
var ie = getInternetExplorerVersion();
|
||||
|
||||
if ( ie == -2) {
|
||||
document.write('<center><h3>This plugin is not currently supported on Internet Explorer 64 bit<br><br>Please use Internet Explorer 32 bit to access this site.</h3><centre>');
|
||||
}
|
||||
else if ( ie != -1) {
|
||||
if (activexIsInstalled() >= minimumPluginVersion) {
|
||||
pluginInstalled = true;
|
||||
document.write('<OBJECT ID="MyGame" CLASSID="CLSID:'+clsId+'" WIDTH="100%" HEIGHT="100%"></OBJECT>');
|
||||
}
|
||||
else {
|
||||
document.write('<center><a href="'+installerPath+'"><img src="getplugin.jpg" /></a></center>');
|
||||
if (autoReload)
|
||||
activexReload();
|
||||
}
|
||||
}
|
||||
// Firefox/Chrome/Safari
|
||||
else {
|
||||
|
||||
//we do an initial refresh in case the plugin information has changed (new DLL location, newly installed, etc)
|
||||
navigator.plugins.refresh();
|
||||
|
||||
if (nppluginIsInstalled() >= minimumPluginVersion) {
|
||||
pluginInstalled = true;
|
||||
document.write('<object id="MyGame" type="'+mimeType+'" width="100% height="100%" ></object>');
|
||||
}
|
||||
else {
|
||||
document.write('<center><a href="'+installerPath+'"><img src="getplugin.jpg" /></a></center>');
|
||||
if (autoReload)
|
||||
nppluginReload();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</div>
|
||||
<center>(Press ESC to show the mouse cursor if hidden)</center>
|
||||
<center><button id="bridgetest" disabled="true" onclick="onTestBridge();">Test JavaScript <-> TorqueScript Bridge</button></center>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Loading…
Add table
Add a link
Reference in a new issue