PlatformSDL implementation.

This commit is contained in:
LuisAntonRebollo 2015-01-16 20:37:16 +01:00
parent 21d58bb191
commit aa35157eef
33 changed files with 3971 additions and 151 deletions

View file

@ -0,0 +1,308 @@
exec("./FileDialog.gui");
function PlatformFileDialog::buildFilters(%this)
{
%str = strreplace( %this.data.filters, "|", "\t");
%this.filterCount = getFieldCount( %str ) / 2;
//echo( "Filter count: " @ %str );
for( %i = 0; %i < %this.filterCount; %i++ )
{
%this.filterName[%i] = GetField( %str, (%i*2) + 0 );
%this.filter[%i] = strreplace( GetField( %str, (%i*2) + 1 ), ";", "\t");
//echo( "Filter: " @ %this.filterName[%i] @ " - " @ %this.filter[%i]);
}
}
function PlatformFileDialog::handleFlags(%this, %flags)
{
%this.FDS_OPEN = false;
%this.FDS_SAVE = false;
%this.FDS_OVERWRITEPROMPT = false;
%this.FDS_MUSTEXIST = false;
%this.FDS_BROWSEFOLDER = false;
%flagCount = getFieldCount( %flags );
//echo( "flag count: " @ %flagCount );
for( %i = 0; %i < %flagCount; %i++ )
{
%flag = GetField( %flags, %i );
//echo(%flag);
if( %flag $= "FDS_OPEN" )
{
%this.FDS_OPEN = true;
%this-->Button.setText( "OPEN" );
%this-->Button.command = "PlatformFileDialog.tryFile();";
%this-->window.text = "Select file to OPEN";
}
else if( %flag $= "FDS_SAVE" )
{
%this.FDS_SAVE = true;
%this-->Button.setText( "SAVE" );
%this-->Button.command = "PlatformFileDialog.tryFile();";
%this-->window.text = "Select file to Save";
}
else if( %flag $= "FDS_OVERWRITEPROMPT" )
{
%this.FDS_OVERWRITEPROMPT = true;
}
else if( %flag $= "FDS_MUSTEXIST" )
{
%this.FDS_MUSTEXIST = true;
}
else if( %flag $= "FDS_BROWSEFOLDER" )
{
%this.FDS_BROWSEFOLDER = true;
%this-->window.text = "Select folder to OPEN";
}
}
}
function OpenPlatformFileDialog(%data, %flags)
{
PlatformFileDialog.searchDir = "";
PlatformFileDialog-->fileNameEdit.setText( "" );
PlatformFileDialog.data = %data;
PlatformFileDialog.data.finished = 0;
PlatformFileDialog.handleFlags( %flags );
if( !isObject(PlatformFileDialog.freeItemSet) )
{
PlatformFileDialog.freeItemSet = new SimGroup();
}
PlatformFileDialog.buildFilters();
Canvas.pushDialog(PlatformFileDialog);
}
function PlatformFileDialog::changeDir( %this, %newDir )
{
%this.searchDir = %newDir;
%this.update();
}
function PlatformFileDialog::navigateUp( %this )
{
//echo( "PlatformFileDialog::navigateUp " @ %this.searchDir );
if( %this.searchDir !$= "" )
{
%str = strreplace( %this.searchDir, "/", "\t");
%count = getFieldCount( %str );
if ( %count == 0 )
return;
if ( %count == 1 )
%address = "";
else
%address = getFields( %str, 0, %count - 2 );
%newDir = strreplace( %address, "\t", "/" );
if( %newDir !$= "" )
%newDir = %newDir @ "/";
%this.changeDir( %newDir );
}
}
function PlatformFileDialog::cancel( %this )
{
%this.data.files[0] = "";
%this.data.fileCount = 0;
%this.data.finished = 1;
Canvas.popDialog(%this);
}
function FileDialogItem::onClick( %this )
{
PlatformFileDialog-->fileNameEdit.setText( "" );
if( %this.isDir && %this.FDS_BROWSEFOLDER)
{
PlatformFileDialog-->fileNameEdit.setText( %this.text );
}
else if( !%this.isDir && !%this.FDS_BROWSEFOLDER )
{
PlatformFileDialog-->fileNameEdit.setText( %this.text );
}
}
function FileDialogItem::onDoubleClick( %this )
{
PlatformFileDialog-->fileNameEdit.setText( "" );
if( %this.isDir )
{
PlatformFileDialog.changeDir( PlatformFileDialog.searchDir @ %this.text @ "/" );
}
}
function PlatformFileDialog::tryFile( %this )
{
%file = %this-->fileNameEdit.getText();
if( %file $= "" )
return;
if( %this.FDS_OVERWRITEPROMPT )
{
%callback = "PlatformFileDialog.onFile( \"" @ %file @ "\" );";
MessageBoxOKCancel("Confirm overwrite", "Confirm overwrite", %callback, "");
return;
}
%this.onFile( %file );
}
function PlatformFileDialog::onFile( %this, %file )
{
%this.data.files[0] = "";
%this.data.fileCount = 0;
if( %file !$= "" )
{
%file = %this.searchDir @ %file;
%this.data.fileCount = 1;
}
if( %this.FDS_BROWSEFOLDER && !isDirectory( %file ) )
{
echo("Select a directory");
return;
}
else if( !%this.FDS_BROWSEFOLDER && !isFile( %file ) )
{
echo("Select a file");
return;
}
if( %this.FDS_MUSTEXIST )
{
if( !isFile( %file ) && !isDirectory( %file ) )
{
echo("Target must exist: " @ %file );
return;
}
}
%this.data.finished = 1;
%this.data.files[0] = %file;
Canvas.popDialog(%this);
%this-->fileNameEdit.setText( "" );
}
function PlatformFileDialog::clear( %this )
{
%itemArray = %this-->itemArray;
while( %itemArray.getCount() )
{
%item = %itemArray.getObject( 0 );
%this.freeItem( %item );
}
}
function PlatformFileDialog::getNewItem( %this )
{
if( %this.freeItemSet.getCount() )
%item = %this.freeItemSet.getObject( 0 );
if( isObject(%item) )
{
%this.freeItemSet.remove( %item );
}
else
{
//create new
%item = new GuiIconButtonCtrl();
%item.className = "FileDialogItem";
%item.profile = "ToolsGuiIconButtonProfile";
%item.textLocation = "left";
%item.iconLocation = "left";
%item.iconBitmap = "";
%item.text = "";
}
return %item;
}
function PlatformFileDialog::freeItem( %this, %item )
{
%this-->itemArray.remove( %item );
//clear
%item.setText( "" );
%item.iconBitmap = "";
%item.textMargin = 0;
%item.textLocation = "left";
%item.iconLocation = "left";
%item.resetState();
PlatformFileDialog.freeItemSet.add( %item );
}
function PlatformFileDialog::addDir( %this, %dir )
{
//echo( "Dir: " @ %dir );
%item = %this.getNewItem();
%item.setText( %dir );
%item.isDir = true;
%item.iconBitmap = "core/art/gui/images/folder";
%item.textLocation = "left";
%item.iconLocation = "left";
%item.textMargin = 24;
%this-->itemArray.add( %item );
}
function PlatformFileDialog::addFile( %this, %file )
{
//echo( "File: " @ %file );
%item = %this.getNewItem();
%item.text = strreplace( %file, %this.searchDir, "" );
%item.isDir = false;
%this-->itemArray.add( %item );
}
function PlatformFileDialog::onWake( %this )
{
%this.update();
}
function PlatformFileDialog::onSleep( %this )
{
%this.data.finished = 1;
}
function PlatformFileDialog::update( %this )
{
%this.clear();
%this-->popUpMenu.text = %this.searchDir;
// dirs
%dirList = getDirectoryList( %this.searchDir, 0 );
%wordCount = getFieldCount( %dirList );
for( %i = 0; %i < %wordCount; %i++ )
{
%dirItem = GetField( %dirList, %i );
%this.addDir( %dirItem );
}
//files
%pattern = %this.filter[0];
//echo( %pattern );
%file = findFirstFileMultiExpr( %this.searchDir @ %pattern, false);
while( %file !$= "" )
{
%this.addFile( %file );
%file = findNextFileMultiExpr( %pattern );
}
}

View file

@ -0,0 +1,293 @@
//--- OBJECT WRITE BEGIN ---
%guiContent = new GuiControl(PlatformFileDialog) {
position = "0 0";
extent = "1024 768";
minExtent = "8 2";
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiDefaultProfile";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "1";
canSave = "1";
canSaveDynamicFields = "1";
new GuiWindowCtrl() {
text = "";
resizeWidth = "1";
resizeHeight = "1";
canMove = "1";
canClose = "1";
canMinimize = "1";
canMaximize = "1";
canCollapse = "0";
closeCommand = "PlatformFileDialog.cancel();";
edgeSnap = "1";
margin = "0 0 0 0";
padding = "0 0 0 0";
anchorTop = "1";
anchorBottom = "0";
anchorLeft = "1";
anchorRight = "0";
position = "135 113";
extent = "727 623";
minExtent = "8 2";
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiWindowProfile";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "1";
internalName = "window";
canSave = "1";
canSaveDynamicFields = "0";
new GuiControl() {
position = "2 16";
extent = "717 37";
minExtent = "8 2";
horizSizing = "width";
vertSizing = "bottom";
profile = "ToolsGuiDefaultProfile";
visible = "1";
active = "1";
tooltipProfile = "ToolsGuiToolTipProfile";
hovertime = "1000";
isContainer = "1";
canSave = "1";
canSaveDynamicFields = "0";
new GuiBitmapButtonCtrl() {
bitmap = "tools/gui/images/folderUp";
bitmapMode = "Stretched";
autoFitExtents = "0";
useModifiers = "0";
useStates = "1";
groupNum = "0";
buttonType = "PushButton";
useMouseEvents = "0";
position = "9 9";
extent = "20 19";
minExtent = "8 2";
horizSizing = "right";
vertSizing = "bottom";
profile = "ToolsGuiButtonProfile";
visible = "1";
active = "1";
command = "PlatformFileDialog.navigateUp();";
tooltipProfile = "ToolsGuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
internalName = "folderUpButton";
canSave = "1";
canSaveDynamicFields = "0";
};
new GuiPopUpMenuCtrl() {
maxPopupHeight = "200";
sbUsesNAColor = "0";
reverseTextList = "0";
bitmapBounds = "16 16";
maxLength = "1024";
margin = "0 0 0 0";
padding = "0 0 0 0";
anchorTop = "1";
anchorBottom = "0";
anchorLeft = "1";
anchorRight = "0";
position = "36 9";
extent = "666 18";
minExtent = "8 2";
horizSizing = "width";
vertSizing = "bottom";
profile = "ToolsGuiPopUpMenuProfile";
visible = "1";
active = "1";
tooltipProfile = "ToolsGuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
internalName = "PopupMenu";
canSave = "1";
canSaveDynamicFields = "0";
};
};
new GuiScrollCtrl() {
willFirstRespond = "1";
hScrollBar = "dynamic";
vScrollBar = "alwaysOff";
lockHorizScroll = "0";
lockVertScroll = "1";
constantThumbHeight = "0";
childMargin = "0 0";
mouseWheelScrollSpeed = "-1";
docking = "None";
margin = "0 0 0 0";
padding = "0 0 0 0";
anchorTop = "0";
anchorBottom = "1";
anchorLeft = "1";
anchorRight = "0";
position = "7 64";
extent = "712 509";
minExtent = "8 2";
horizSizing = "width";
vertSizing = "height";
profile = "GuiScrollProfile";
visible = "1";
active = "1";
tooltipProfile = "ToolsGuiToolTipProfile";
hovertime = "1000";
isContainer = "1";
canSave = "1";
canSaveDynamicFields = "0";
new GuiDynamicCtrlArrayControl() {
colCount = "1";
colSize = "64";
rowCount = "1";
rowSize = "258";
rowSpacing = "4";
colSpacing = "4";
frozen = "0";
autoCellSize = "1";
fillRowFirst = "0";
dynamicSize = "1";
padding = "0 0 0 0";
position = "1 1";
extent = "666 507";
minExtent = "8 2";
horizSizing = "width";
vertSizing = "height";
profile = "ToolsGuiTransparentProfile";
visible = "1";
active = "1";
tooltipProfile = "ToolsGuiToolTipProfile";
hovertime = "1000";
isContainer = "1";
internalName = "itemArray";
canSave = "1";
canSaveDynamicFields = "0";
};
};
new GuiContainer() {
docking = "Bottom";
margin = "0 0 0 0";
padding = "0 0 0 0";
anchorTop = "0";
anchorBottom = "1";
anchorLeft = "1";
anchorRight = "1";
position = "1 583";
extent = "725 37";
minExtent = "8 2";
horizSizing = "width";
vertSizing = "bottom";
profile = "GuiDefaultProfile";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "1";
canSave = "1";
canSaveDynamicFields = "0";
new GuiTextCtrl() {
text = "File Name";
maxLength = "1024";
margin = "0 0 0 0";
padding = "0 0 0 0";
anchorTop = "1";
anchorBottom = "0";
anchorLeft = "1";
anchorRight = "0";
position = "10 -1";
extent = "51 30";
minExtent = "8 2";
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiTextProfile";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "1";
canSave = "1";
canSaveDynamicFields = "0";
};
new GuiTextEditCtrl() {
historySize = "0";
tabComplete = "0";
sinkAllKeyEvents = "0";
password = "0";
passwordMask = "*";
maxLength = "1024";
margin = "0 0 0 0";
padding = "0 0 0 0";
anchorTop = "1";
anchorBottom = "0";
anchorLeft = "1";
anchorRight = "0";
position = "58 5";
extent = "561 18";
minExtent = "8 2";
horizSizing = "width";
vertSizing = "bottom";
profile = "GuiTextEditProfile";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "1";
internalName = "fileNameEdit";
canSave = "1";
canSaveDynamicFields = "0";
};
new GuiContainer() {
docking = "Right";
margin = "0 0 0 0";
padding = "0 0 0 0";
anchorTop = "0";
anchorBottom = "0";
anchorLeft = "0";
anchorRight = "0";
position = "630 0";
extent = "95 37";
minExtent = "8 2";
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiDefaultProfile";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "1";
canSave = "1";
canSaveDynamicFields = "0";
new GuiButtonCtrl() {
groupNum = "-1";
buttonType = "PushButton";
useMouseEvents = "1";
position = "6 1";
extent = "81 24";
minExtent = "8 2";
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiButtonProfile";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
internalName = "Button";
canSave = "1";
canSaveDynamicFields = "0";
};
};
};
};
};
//--- OBJECT WRITE END ---

View file

@ -0,0 +1,50 @@
//-----------------------------------------------------------------------------
// Copyright (c) 2012 GarageGames, LLC
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
//#define SM_Fmt_R8G8B8A8
#define pkDepthBitShft 65536.0
#define pkDepthChanMax 256.0
#define bias -0.5/255.0
#define coeff 0.9999991
//#define coeff 1.0
float4 encodeShadowMap( float depth )
{
#if defined(SM_Fmt_R8G8B8A8)
return frac( float4(1.0, 255.0, 65025.0, 160581375.0) * depth ) + bias;
//float4 packedValue = frac((depth / coeff) * float4(16777216.0, 65536.0, 256.0, 1.0));
//return (packedValue - packedValue.xxyz * float4(0, 1.0 / 256, 1.0 / 256, 1.0 / 256));
#else
return depth;
#endif
}
float decodeShadowMap( float4 smSample )
{
#if defined(SM_Fmt_R8G8B8A8)
return dot( smSample, float4(1.0, 1/255.0, 1/65025.0, 1/160581375.0) );
#else
return smSample.x;
#endif
}

View file

@ -0,0 +1 @@
exec("./guiPlatformGenericMenubar.ed.gui");

View file

@ -0,0 +1,14 @@
//--- OBJECT WRITE BEGIN ---
%guiContent = new GuiControl(PlatformGenericMenubar) {
profile = "GuiModelessDialogProfile";
new GuiPlatformGenericMenuBar()
{
internalName = "menubar";
extent = "1024 32";
minExtent = "320 32";
horizSizing = "width";
profile = "GuiMenuBarProfile";
};
};
//--- OBJECT WRITE END ---

Binary file not shown.

After

Width:  |  Height:  |  Size: 1 KiB

View file

@ -0,0 +1,308 @@
exec("./FileDialog.gui");
function PlatformFileDialog::buildFilters(%this)
{
%str = strreplace( %this.data.filters, "|", "\t");
%this.filterCount = getFieldCount( %str ) / 2;
//echo( "Filter count: " @ %str );
for( %i = 0; %i < %this.filterCount; %i++ )
{
%this.filterName[%i] = GetField( %str, (%i*2) + 0 );
%this.filter[%i] = strreplace( GetField( %str, (%i*2) + 1 ), ";", "\t");
//echo( "Filter: " @ %this.filterName[%i] @ " - " @ %this.filter[%i]);
}
}
function PlatformFileDialog::handleFlags(%this, %flags)
{
%this.FDS_OPEN = false;
%this.FDS_SAVE = false;
%this.FDS_OVERWRITEPROMPT = false;
%this.FDS_MUSTEXIST = false;
%this.FDS_BROWSEFOLDER = false;
%flagCount = getFieldCount( %flags );
//echo( "flag count: " @ %flagCount );
for( %i = 0; %i < %flagCount; %i++ )
{
%flag = GetField( %flags, %i );
//echo(%flag);
if( %flag $= "FDS_OPEN" )
{
%this.FDS_OPEN = true;
%this-->Button.setText( "OPEN" );
%this-->Button.command = "PlatformFileDialog.tryFile();";
%this-->window.text = "Select file to OPEN";
}
else if( %flag $= "FDS_SAVE" )
{
%this.FDS_SAVE = true;
%this-->Button.setText( "SAVE" );
%this-->Button.command = "PlatformFileDialog.tryFile();";
%this-->window.text = "Select file to Save";
}
else if( %flag $= "FDS_OVERWRITEPROMPT" )
{
%this.FDS_OVERWRITEPROMPT = true;
}
else if( %flag $= "FDS_MUSTEXIST" )
{
%this.FDS_MUSTEXIST = true;
}
else if( %flag $= "FDS_BROWSEFOLDER" )
{
%this.FDS_BROWSEFOLDER = true;
%this-->window.text = "Select folder to OPEN";
}
}
}
function OpenPlatformFileDialog(%data, %flags)
{
PlatformFileDialog.searchDir = "";
PlatformFileDialog-->fileNameEdit.setText( "" );
PlatformFileDialog.data = %data;
PlatformFileDialog.data.finished = 0;
PlatformFileDialog.handleFlags( %flags );
if( !isObject(PlatformFileDialog.freeItemSet) )
{
PlatformFileDialog.freeItemSet = new SimGroup();
}
PlatformFileDialog.buildFilters();
Canvas.pushDialog(PlatformFileDialog);
}
function PlatformFileDialog::changeDir( %this, %newDir )
{
%this.searchDir = %newDir;
%this.update();
}
function PlatformFileDialog::navigateUp( %this )
{
//echo( "PlatformFileDialog::navigateUp " @ %this.searchDir );
if( %this.searchDir !$= "" )
{
%str = strreplace( %this.searchDir, "/", "\t");
%count = getFieldCount( %str );
if ( %count == 0 )
return;
if ( %count == 1 )
%address = "";
else
%address = getFields( %str, 0, %count - 2 );
%newDir = strreplace( %address, "\t", "/" );
if( %newDir !$= "" )
%newDir = %newDir @ "/";
%this.changeDir( %newDir );
}
}
function PlatformFileDialog::cancel( %this )
{
%this.data.files[0] = "";
%this.data.fileCount = 0;
%this.data.finished = 1;
Canvas.popDialog(%this);
}
function FileDialogItem::onClick( %this )
{
PlatformFileDialog-->fileNameEdit.setText( "" );
if( %this.isDir && %this.FDS_BROWSEFOLDER)
{
PlatformFileDialog-->fileNameEdit.setText( %this.text );
}
else if( !%this.isDir && !%this.FDS_BROWSEFOLDER )
{
PlatformFileDialog-->fileNameEdit.setText( %this.text );
}
}
function FileDialogItem::onDoubleClick( %this )
{
PlatformFileDialog-->fileNameEdit.setText( "" );
if( %this.isDir )
{
PlatformFileDialog.changeDir( PlatformFileDialog.searchDir @ %this.text @ "/" );
}
}
function PlatformFileDialog::tryFile( %this )
{
%file = %this-->fileNameEdit.getText();
if( %file $= "" )
return;
if( %this.FDS_OVERWRITEPROMPT )
{
%callback = "PlatformFileDialog.onFile( \"" @ %file @ "\" );";
MessageBoxOKCancel("Confirm overwrite", "Confirm overwrite", %callback, "");
return;
}
%this.onFile( %file );
}
function PlatformFileDialog::onFile( %this, %file )
{
%this.data.files[0] = "";
%this.data.fileCount = 0;
if( %file !$= "" )
{
%file = %this.searchDir @ %file;
%this.data.fileCount = 1;
}
if( %this.FDS_BROWSEFOLDER && !isDirectory( %file ) )
{
echo("Select a directory");
return;
}
else if( !%this.FDS_BROWSEFOLDER && !isFile( %file ) )
{
echo("Select a file");
return;
}
if( %this.FDS_MUSTEXIST )
{
if( !isFile( %file ) && !isDirectory( %file ) )
{
echo("Target must exist: " @ %file );
return;
}
}
%this.data.finished = 1;
%this.data.files[0] = %file;
Canvas.popDialog(%this);
%this-->fileNameEdit.setText( "" );
}
function PlatformFileDialog::clear( %this )
{
%itemArray = %this-->itemArray;
while( %itemArray.getCount() )
{
%item = %itemArray.getObject( 0 );
%this.freeItem( %item );
}
}
function PlatformFileDialog::getNewItem( %this )
{
if( %this.freeItemSet.getCount() )
%item = %this.freeItemSet.getObject( 0 );
if( isObject(%item) )
{
%this.freeItemSet.remove( %item );
}
else
{
//create new
%item = new GuiIconButtonCtrl();
%item.className = "FileDialogItem";
%item.profile = "ToolsGuiIconButtonProfile";
%item.textLocation = "left";
%item.iconLocation = "left";
%item.iconBitmap = "";
%item.text = "";
}
return %item;
}
function PlatformFileDialog::freeItem( %this, %item )
{
%this-->itemArray.remove( %item );
//clear
%item.setText( "" );
%item.iconBitmap = "";
%item.textMargin = 0;
%item.textLocation = "left";
%item.iconLocation = "left";
%item.resetState();
PlatformFileDialog.freeItemSet.add( %item );
}
function PlatformFileDialog::addDir( %this, %dir )
{
//echo( "Dir: " @ %dir );
%item = %this.getNewItem();
%item.setText( %dir );
%item.isDir = true;
%item.iconBitmap = "core/art/gui/images/folder";
%item.textLocation = "left";
%item.iconLocation = "left";
%item.textMargin = 24;
%this-->itemArray.add( %item );
}
function PlatformFileDialog::addFile( %this, %file )
{
//echo( "File: " @ %file );
%item = %this.getNewItem();
%item.text = strreplace( %file, %this.searchDir, "" );
%item.isDir = false;
%this-->itemArray.add( %item );
}
function PlatformFileDialog::onWake( %this )
{
%this.update();
}
function PlatformFileDialog::onSleep( %this )
{
%this.data.finished = 1;
}
function PlatformFileDialog::update( %this )
{
%this.clear();
%this-->popUpMenu.text = %this.searchDir;
// dirs
%dirList = getDirectoryList( %this.searchDir, 0 );
%wordCount = getFieldCount( %dirList );
for( %i = 0; %i < %wordCount; %i++ )
{
%dirItem = GetField( %dirList, %i );
%this.addDir( %dirItem );
}
//files
%pattern = %this.filter[0];
//echo( %pattern );
%file = findFirstFileMultiExpr( %this.searchDir @ %pattern, false);
while( %file !$= "" )
{
%this.addFile( %file );
%file = findNextFileMultiExpr( %pattern );
}
}

View file

@ -0,0 +1,293 @@
//--- OBJECT WRITE BEGIN ---
%guiContent = new GuiControl(PlatformFileDialog) {
position = "0 0";
extent = "1024 768";
minExtent = "8 2";
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiDefaultProfile";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "1";
canSave = "1";
canSaveDynamicFields = "1";
new GuiWindowCtrl() {
text = "";
resizeWidth = "1";
resizeHeight = "1";
canMove = "1";
canClose = "1";
canMinimize = "1";
canMaximize = "1";
canCollapse = "0";
closeCommand = "PlatformFileDialog.cancel();";
edgeSnap = "1";
margin = "0 0 0 0";
padding = "0 0 0 0";
anchorTop = "1";
anchorBottom = "0";
anchorLeft = "1";
anchorRight = "0";
position = "135 113";
extent = "727 623";
minExtent = "8 2";
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiWindowProfile";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "1";
internalName = "window";
canSave = "1";
canSaveDynamicFields = "0";
new GuiControl() {
position = "2 16";
extent = "717 37";
minExtent = "8 2";
horizSizing = "width";
vertSizing = "bottom";
profile = "ToolsGuiDefaultProfile";
visible = "1";
active = "1";
tooltipProfile = "ToolsGuiToolTipProfile";
hovertime = "1000";
isContainer = "1";
canSave = "1";
canSaveDynamicFields = "0";
new GuiBitmapButtonCtrl() {
bitmap = "tools/gui/images/folderUp";
bitmapMode = "Stretched";
autoFitExtents = "0";
useModifiers = "0";
useStates = "1";
groupNum = "0";
buttonType = "PushButton";
useMouseEvents = "0";
position = "9 9";
extent = "20 19";
minExtent = "8 2";
horizSizing = "right";
vertSizing = "bottom";
profile = "ToolsGuiButtonProfile";
visible = "1";
active = "1";
command = "PlatformFileDialog.navigateUp();";
tooltipProfile = "ToolsGuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
internalName = "folderUpButton";
canSave = "1";
canSaveDynamicFields = "0";
};
new GuiPopUpMenuCtrl() {
maxPopupHeight = "200";
sbUsesNAColor = "0";
reverseTextList = "0";
bitmapBounds = "16 16";
maxLength = "1024";
margin = "0 0 0 0";
padding = "0 0 0 0";
anchorTop = "1";
anchorBottom = "0";
anchorLeft = "1";
anchorRight = "0";
position = "36 9";
extent = "666 18";
minExtent = "8 2";
horizSizing = "width";
vertSizing = "bottom";
profile = "ToolsGuiPopUpMenuProfile";
visible = "1";
active = "1";
tooltipProfile = "ToolsGuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
internalName = "PopupMenu";
canSave = "1";
canSaveDynamicFields = "0";
};
};
new GuiScrollCtrl() {
willFirstRespond = "1";
hScrollBar = "dynamic";
vScrollBar = "alwaysOff";
lockHorizScroll = "0";
lockVertScroll = "1";
constantThumbHeight = "0";
childMargin = "0 0";
mouseWheelScrollSpeed = "-1";
docking = "None";
margin = "0 0 0 0";
padding = "0 0 0 0";
anchorTop = "0";
anchorBottom = "1";
anchorLeft = "1";
anchorRight = "0";
position = "7 64";
extent = "712 509";
minExtent = "8 2";
horizSizing = "width";
vertSizing = "height";
profile = "GuiScrollProfile";
visible = "1";
active = "1";
tooltipProfile = "ToolsGuiToolTipProfile";
hovertime = "1000";
isContainer = "1";
canSave = "1";
canSaveDynamicFields = "0";
new GuiDynamicCtrlArrayControl() {
colCount = "1";
colSize = "64";
rowCount = "1";
rowSize = "258";
rowSpacing = "4";
colSpacing = "4";
frozen = "0";
autoCellSize = "1";
fillRowFirst = "0";
dynamicSize = "1";
padding = "0 0 0 0";
position = "1 1";
extent = "666 507";
minExtent = "8 2";
horizSizing = "width";
vertSizing = "height";
profile = "ToolsGuiTransparentProfile";
visible = "1";
active = "1";
tooltipProfile = "ToolsGuiToolTipProfile";
hovertime = "1000";
isContainer = "1";
internalName = "itemArray";
canSave = "1";
canSaveDynamicFields = "0";
};
};
new GuiContainer() {
docking = "Bottom";
margin = "0 0 0 0";
padding = "0 0 0 0";
anchorTop = "0";
anchorBottom = "1";
anchorLeft = "1";
anchorRight = "1";
position = "1 583";
extent = "725 37";
minExtent = "8 2";
horizSizing = "width";
vertSizing = "bottom";
profile = "GuiDefaultProfile";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "1";
canSave = "1";
canSaveDynamicFields = "0";
new GuiTextCtrl() {
text = "File Name";
maxLength = "1024";
margin = "0 0 0 0";
padding = "0 0 0 0";
anchorTop = "1";
anchorBottom = "0";
anchorLeft = "1";
anchorRight = "0";
position = "10 -1";
extent = "51 30";
minExtent = "8 2";
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiTextProfile";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "1";
canSave = "1";
canSaveDynamicFields = "0";
};
new GuiTextEditCtrl() {
historySize = "0";
tabComplete = "0";
sinkAllKeyEvents = "0";
password = "0";
passwordMask = "*";
maxLength = "1024";
margin = "0 0 0 0";
padding = "0 0 0 0";
anchorTop = "1";
anchorBottom = "0";
anchorLeft = "1";
anchorRight = "0";
position = "58 5";
extent = "561 18";
minExtent = "8 2";
horizSizing = "width";
vertSizing = "bottom";
profile = "GuiTextEditProfile";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "1";
internalName = "fileNameEdit";
canSave = "1";
canSaveDynamicFields = "0";
};
new GuiContainer() {
docking = "Right";
margin = "0 0 0 0";
padding = "0 0 0 0";
anchorTop = "0";
anchorBottom = "0";
anchorLeft = "0";
anchorRight = "0";
position = "630 0";
extent = "95 37";
minExtent = "8 2";
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiDefaultProfile";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "1";
canSave = "1";
canSaveDynamicFields = "0";
new GuiButtonCtrl() {
groupNum = "-1";
buttonType = "PushButton";
useMouseEvents = "1";
position = "6 1";
extent = "81 24";
minExtent = "8 2";
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiButtonProfile";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
internalName = "Button";
canSave = "1";
canSaveDynamicFields = "0";
};
};
};
};
};
//--- OBJECT WRITE END ---

View file

@ -0,0 +1 @@
/procedural/

View file

@ -0,0 +1,50 @@
//-----------------------------------------------------------------------------
// Copyright (c) 2012 GarageGames, LLC
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
//#define SM_Fmt_R8G8B8A8
#define pkDepthBitShft 65536.0
#define pkDepthChanMax 256.0
#define bias -0.5/255.0
#define coeff 0.9999991
//#define coeff 1.0
float4 encodeShadowMap( float depth )
{
#if defined(SM_Fmt_R8G8B8A8)
return frac( float4(1.0, 255.0, 65025.0, 160581375.0) * depth ) + bias;
//float4 packedValue = frac((depth / coeff) * float4(16777216.0, 65536.0, 256.0, 1.0));
//return (packedValue - packedValue.xxyz * float4(0, 1.0 / 256, 1.0 / 256, 1.0 / 256));
#else
return depth;
#endif
}
float decodeShadowMap( float4 smSample )
{
#if defined(SM_Fmt_R8G8B8A8)
return dot( smSample, float4(1.0, 1/255.0, 1/65025.0, 1/160581375.0) );
#else
return smSample.x;
#endif
}

View file

@ -0,0 +1 @@
exec("./guiPlatformGenericMenubar.ed.gui");

View file

@ -0,0 +1,14 @@
//--- OBJECT WRITE BEGIN ---
%guiContent = new GuiControl(PlatformGenericMenubar) {
profile = "GuiModelessDialogProfile";
new GuiPlatformGenericMenuBar()
{
internalName = "menubar";
extent = "1024 32";
minExtent = "320 32";
horizSizing = "width";
profile = "GuiMenuBarProfile";
};
};
//--- OBJECT WRITE END ---

Binary file not shown.

After

Width:  |  Height:  |  Size: 1 KiB

View file

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<EditorSettings />