X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=misc%2Fmediasource%2Fextra%2Fnetradiant-src%2Fplugins%2Fsample%2Fsample.cpp;fp=misc%2Fmediasource%2Fextra%2Fnetradiant-src%2Fplugins%2Fsample%2Fsample.cpp;h=41aa9bf86c3e473728ee1085115b9a263f2024d8;hb=9e4440a5f98c7aebaaba54c6ef80ea5178e106cc;hp=0000000000000000000000000000000000000000;hpb=bea7e24b8de9d06e9257569dbdf85fae15a07ec0;p=voretournament%2Fvoretournament.git diff --git a/misc/mediasource/extra/netradiant-src/plugins/sample/sample.cpp b/misc/mediasource/extra/netradiant-src/plugins/sample/sample.cpp new file mode 100644 index 00000000..41aa9bf8 --- /dev/null +++ b/misc/mediasource/extra/netradiant-src/plugins/sample/sample.cpp @@ -0,0 +1,95 @@ +/* +Copyright (C) 2001-2006, William Joseph. +All Rights Reserved. + +This file is part of GtkRadiant. + +GtkRadiant is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +GtkRadiant is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GtkRadiant; if not, write to the Free Software +Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include "sample.h" + +#include "debugging/debugging.h" + +#include "iplugin.h" + +#include "string/string.h" +#include "modulesystem/singletonmodule.h" +#include "typesystem.h" + +namespace Sample +{ + const char* init(void* hApp, void* pMainWidget) + { + return ""; + } + const char* getName() + { + return "Sample Plugin"; + } + const char* getCommandList() + { + return "About;Do Something"; + } + const char* getCommandTitleList() + { + return ""; + } + void dispatch(const char* command, float* vMin, float* vMax, bool bSingleBrush) + { + if(string_equal(command, "About")) + { + globalOutputStream() << "Sample Demo Plugin\n"; + } + if(string_equal(command, "Do Something")) + { + globalOutputStream() << "Sample Command\n"; + } + } + +} // namespace + +class SamplePluginModule : public TypeSystemRef +{ + _QERPluginTable m_plugin; +public: + typedef _QERPluginTable Type; + STRING_CONSTANT(Name, "sample"); + + SamplePluginModule() + { + m_plugin.m_pfnQERPlug_Init = &Sample::init; + m_plugin.m_pfnQERPlug_GetName = &Sample::getName; + m_plugin.m_pfnQERPlug_GetCommandList = &Sample::getCommandList; + m_plugin.m_pfnQERPlug_GetCommandTitleList = &Sample::getCommandTitleList; + m_plugin.m_pfnQERPlug_Dispatch = &Sample::dispatch; + } + _QERPluginTable* getTable() + { + return &m_plugin; + } +}; + +typedef SingletonModule SingletonSamplePluginModule; + +SingletonSamplePluginModule g_SamplePluginModule; + + +extern "C" void RADIANT_DLLEXPORT Radiant_RegisterModules(ModuleServer& server) +{ + initialiseModule(server); + + g_SamplePluginModule.selfRegister(); +}