PainterAppDev
description: 鍦?D涓栫晫涓敤鐢荤瑪缁樺埗鍥炬鍜岃创鍥撅細鍙互鍦ㄥ彲鎹㈣创鍥剧殑3D妯″瀷涓婄粯鍒讹紝鍙互鐢ㄥ閮ㄥ浘鐗囷紝鐢靛奖锛孎lash鏂囦欢鍋氭ā鍨嬭创鍥
Painter app for Paraworld
Title |
Painter app for Paraworld |
Author(s) |
LiXizhi |
Date |
2008/1/28 |
File |
script/kids/3DMapSystemUI/Painter/app_main.lua |
Description
[API]
@param params: is a table of following optional field. if table is nil the current parameter is used.
Map3DSystem.App.Commands.Call("File.Painter", {
painter_width = 320,
imagesize = 256,
OnCloseCallBack = nil,
OnSaveCallBack = nil,
LoadFromTexture = "Texture/whitedot.png",
});
db registration insert script
INSERT INTO apps VALUES (NULL, 'Painter_GUID', 'Painter', '1.0.0', 'http://www.paraengine.com/apps/Painter_v1.zip', 'YourCompany', 'enUS', 'script/kids/3DMapSystemUI/Painter/IP.xml', '', 'script/kids/3DMapSystemUI/Painter/app_main.lua', 'Map3DSystem.App.Painter.MSGProc', 1);
Sample Code
NPL.load("(gl)script/kids/3DMapSystemUI/Painter/app_main.lua");
Member Functions
Map3DSystem.App.Painter.OnConnection
requires
create class
commonlib.setfield("Map3DSystem.App.Painter", {});
event handlers
OnConnection method is the obvious point to place your UI (menus, mainbars, tool buttons) through which the user will communicate to the app.
This method is also the place to put your validation code if you are licensing the add-in. You would normally do this before putting up the UI.
If the user is not a valid user, you would not want to put the UI into the IDE.
- param app : the object representing the current application in the IDE.
- param connectMode : type of ConnectMode.
syntax
function Map3DSystem.App.Painter.OnConnection(app, connectMode)
parameters
app |
the object representing the current application in the IDE. |
connectMode |
|
Map3DSystem.App.Painter.OnDisconnection
Receives notification that the Add-in is being unloaded.
syntax
function Map3DSystem.App.Painter.OnDisconnection(app, disconnectMode)
parameters
Map3DSystem.App.Painter.OnQueryStatus
This is called when the command's availability is updated
When the user clicks a command (menu or mainbar button), the
QueryStatus event is fired.
The
QueryStatus event returns the current status of the specified named command, whether it is enabled, disabled,
or hidden in the
CommandStatus parameter, which is passed to the msg by reference (or returned in the event handler).
- param commandName : The name of the command to determine state for. Usually in the string format "Category.SubCate.Name".
- param statusWanted : what status of the command is queried. it is of type CommandStatusWanted
- return __ : returns according to statusWanted. it may return an integer by adding values in CommandStatus.
syntax
function Map3DSystem.App.Painter.OnQueryStatus(app, commandName, statusWanted)
parameters
app |
|
commandName |
The name of the command to determine state for. Usually in the string format "Category.SubCate.Name". |
statusWanted |
|
return |
returns according to statusWanted. it may return an integer by adding values in CommandStatus. |
Map3DSystem.App.Painter.OnExec
This is called when the command is invoked.The Exec is fired after the
QueryStatus event is fired, assuming that the return to the statusOption parameter of
QueryStatus is supported and enabled.
This is the event where you place the actual code for handling the response to the user click on the command.
- param commandName : The name of the command to determine state for. Usually in the string format "Category.SubCate.Name".
syntax
function Map3DSystem.App.Painter.OnExec(app, commandName, params)
parameters
app |
|
commandName |
The name of the command to determine state for. Usually in the string format "Category.SubCate.Name". |
params |
|
Map3DSystem.App.Painter.OnRenderBox
Change and render the 3D world with mcml data that is usually retrieved from the current user's profile page for this application.
syntax
function Map3DSystem.App.Painter.OnRenderBox(mcmlData)
parameters
Map3DSystem.App.Painter.Navigate
called when the user wants to nagivate to the 3D world location relavent to this application
syntax
function Map3DSystem.App.Painter.Navigate()
Map3DSystem.App.Painter.GotoHomepage
called when user clicks to check out the homepage of this application. Homepage usually includes:
developer info, support, developer worlds information, app global news, app updates, all community user rating, active users, trade, currency transfer, etc.
syntax
function Map3DSystem.App.Painter.GotoHomepage()
Map3DSystem.App.Painter.DoQuickAction
called when user clicks the quick action for this application.
syntax
function Map3DSystem.App.Painter.DoQuickAction()
Map3DSystem.App.Painter.MSGProc
client world database function helpers.
all related messages
APPS can be invoked in many ways:
Through app Manager
mainbar or menu command or buttons
Command Line
3D World installed apps
syntax
function Map3DSystem.App.Painter.MSGProc(window, msg)
parameters
Painter App wrapper.
Title |
Painter App wrapper. |
Author(s) |
LiXizhi |
Date |
2008/1/28 |
File |
script/kids/3DMapSystemUI/Painter/Painter.lua |
Description
Sample Code
NPL.load("(gl)script/kids/3DMapSystemUI/Painter/Painter.lua");
Map3DSystem.App.Painter.PainterAppWnd.ShowWnd(app);
Map3DSystem.App.Painter.PainterAppWnd.Show(bShow, _parent, parentWindow)
Member Functions
Map3DSystem.App.Painter.PainterAppWnd.ShowWnd
common control library
NPL.load("(gl)script/ide/common_control.lua");
NPL.load("(gl)script/kids/3DMapSystemUI/Painter/PainterManager.lua");
commonlib.setfield("Map3DSystem.App.Painter.PainterAppWnd", {});
display the main inventory window for the current user.
syntax
function Map3DSystem.App.Painter.PainterAppWnd.ShowWnd(_app)
parameters
Map3DSystem.App.Painter.PainterAppWnd.Show
- param bShow : boolean to show or hide. if nil, it will toggle current setting.
- param __ :_parent: parent window inside which the content is displayed. it can be nil.
syntax
function Map3DSystem.App.Painter.PainterAppWnd.Show(bShow,_parent,parentWindow)
parameters
bShow |
boolean to show or hide. if nil, it will toggle current setting. |
parent |
|
parentWindow |
|
Title |
|
Author(s) |
Leio, revised 2008.1.29 by LiXizhi, revised 2008.6.15 by LiXizhi |
Date |
2007/11/7 |
File |
script/kids/3DMapSystemUI/Painter/PainterManager.lua |
Description
Member Functions
PainterManager.ShowPainter
show or hide the kids painter control
- param alignment :, left, top: can be nil. default to "_lt",0,0
syntax
function PainterManager.ShowPainter(bShow, alignment, left, top,_parentWnd)
parameters
bShow |
|
alignment |
, left, top: can be nil. default to "_lt",0,0 |
left |
|
top |
|
parentWnd |
|
Map3DSystem.UI.PainterManager.OnClose
this function should be called when window is closed.
syntax
function Map3DSystem.UI.PainterManager.OnClose()
PainterManager.SelectEraser
select a eraser
syntax
function PainterManager.SelectEraser()
PainterManager.ScalePainter
set the painter width to scale times the current size.
syntax
function PainterManager.ScalePainter(scale)
parameters
PainterManager.LoadFromTexture
load the painter with a given image
syntax
function PainterManager.LoadFromTexture(filename)
parameters
PainterManager.OnClickSave
called when user click the save button
syntax
function PainterManager.OnClickSave()
PainterManager.SaveAs
save file to disk. undo operations will not be valid any more.
syntax
function PainterManager.SaveAs(filename)
parameters
PainterManager.SetCurrentPen
set the current pen
all parameters can be nil
- param color : e.g."255 0 0"
- param width : in pixel such as 1,4,8
- param texture : if this is "", no texture will be used.
syntax
function PainterManager.SetCurrentPen(color, width, texture)
parameters
color |
e.g."255 0 0" |
width |
|
texture |
if this is "", no texture will be used. |
PainterManager.GetImagePosition
get the image position from the screen space mouse position
syntax
function PainterManager.GetImagePosition(screen_x, screen_y)
parameters
PainterManager.SmoothPath
filterweight[0] = 0.4, filterweight[1] = 0.4
syntax
function PainterManager.SmoothPath(filterweight)
parameters