Skip to content

Commit

Permalink
Merge pull request #28 from TorqueGameEngines/development
Browse files Browse the repository at this point in the history
T2D 4.0 EA 1
  • Loading branch information
greenfire27 committed Aug 10, 2021
2 parents b4cc882 + a670ffb commit be8ca31
Show file tree
Hide file tree
Showing 1,298 changed files with 95,054 additions and 66,477 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Torque2D_DEBUG.exe
Torque2DGame.app
Torque2DGame_Debug.app
linkmap.txt
**/.vs/**

# Compiled source #
###################
Expand Down
42 changes: 24 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,25 @@
![Torque Logo](modules/Sandbox/1/assets/t2d.png)
## Torque 2D 3.5
![Torque Logo](images/banner1.png)
## Torque2D 4.0 Early Access 1

MIT Licensed Open Source version of Torque 2D from GarageGames. Maintained by the T2D Steering Committee and contributions from the community.
MIT Licensed Open Source version of Torque2D from GarageGames. Maintained by the Torque Game Engines team and contributions from the community.

Dedicated to 2D game development, Torque 2D is an extremely powerful, flexible, and fast C++ engine which has been used in hundreds of professional games. It is a true cross platform solution providing you access to Windows, OSX, Linux, iOS, Android, and the web - all from one codebase. It includes an OpenGL batched rendering system, Box2D physics, OpenAL audio, skeletal and spritesheet animation, automated asset management, a modular project structure, TAML object persistence, and a C-like scripting language.

### What's New?

Torque2D 4.0: Rocket Edition is currently in progress. The major change with 4.0 is the addition of editors! At this time there is a working Asset Manager that allows a user to create, edit, and remove images, animations, particle effects, bitmap fonts, and audio assets. This represents a major step forward from editing xml files by hand. This is especially useful in the case of particle effects which are nearly impossible to create without an interactive tool. Expect additional refinement of this tool over the coming releases.

The Asset Manager can be reached by opening the console using the console button in the Toybox or by pressing Tilde(~) + Ctrl. You will then notice tabs along that top that include the Asset Manager.

You may also notice that we have several toys such as the Gui Editor Toy and Scene Editor Toy that are in-progress versions of future editors. These toys are not very useful yet, but we plan to develop them into full editors in coming releases.

The Rocket Edition also features a revamped Gui System! Until now it has been a common practice among those seriously using T2D to avoid the Gui System as much as possible. We aim to fix that with the Rocket Edition. Explanation of how to use the updated Gui System can be found in the wiki in the [Gui Guide](https://github.com/TorqueGameEngines/Torque2D/wiki/GUI-Guide).

More features and editors are coming before 4.0 is official done, but new projects should make use of the Early Access version to avoid future conflicts.

### Branches

Here is an overview of the branches found in the Torque 2D repository:
Here is an overview of the branches found in the Torque2D repository:

* **master:** this branch contains the current stable release code that can be used in a production environment.
* **development:** this branch is dedicated to active development. It contains the latest bug fixes, new features, and other updates. All pull requests need to go to the development branch. While we try our best to test all incoming changes, it is possible for mistakes to slip in therefore this branch should always be considered unstable.
Expand All @@ -21,7 +33,7 @@ If you do not wish to compile the source code yourself, precompiled binary files

After downloading a copy of the source code, the following project files for each platform are provided for you and can be found in the `engine/compilers` folder.

* **Windows:** Visual Studio 2017 (works with the free Community Edition)
* **Windows:** Visual Studio 2017 (works with the free Community Edition) and 2019
* **OSX:** Xcode
* **Linux:** Make
* **iOS:** Xcode_iOS
Expand All @@ -32,37 +44,31 @@ See the [wiki](https://github.com/TorqueGameEngines/Torque2D/wiki) for available

### Batteries Included

Running Torque 2D for the first time out of the box will start you off in the Sandbox. The Sandbox is a collection of over 30 simple "toys" (or modules) which demonstrate various features in T2D. The default toy is a side scrolling level with a monster truck. To see a list of the available modules/toys to choose from, click on the `Show Tools` button in the lower right corner of the screen.
Running Torque2D for the first time out of the box will start you off in the Toybox. The Toybox is a collection of over 30 simple "toys" (or modules) which demonstrate various features in T2D. The default toy is a side scrolling level with a monster truck. To see a list of the available modules/toys to choose from, click on the `Show Tools` button in the lower right corner of the screen.

Naturally all of the script code and assets for each toy are available to you in the modules folder to use as practical examples while learning T2D.

The Sandbox is also an excellent framework for rapidly prototyping your own game ideas - it allows for easy integration of additional modules and provides numerous debugging features, like console access and real-time metrics.
The Toybox is also an excellent framework for rapidly prototyping your own game ideas - it allows for easy integration of additional modules and provides numerous debugging features, like console access and real-time metrics.

### Documentation

All documentation for the open source version of Torque 2D can be found on our [Github wiki page](https://github.com/TorqueGameEngines/Torque2D/wiki). It contains many tutorials, detailed technical information on engine systems, a script reference guide automatically generated from the source code, and articles on how to contribute to our open source development.
All documentation for the Torque2D can be found on our [Github wiki page](https://github.com/TorqueGameEngines/Torque2D/wiki). It contains many tutorials, detailed technical information on engine systems, a script reference guide automatically generated from the source code, and articles on how to contribute to our open source development.

### Community

Don't go it alone! Join the active Torque community. Ask questions, talk about T2D and general game development topics, learn the latest news, or post a blog promoting your game or showing off additional engine features in your T2D fork.

* [Torque 2D Forums on the Torque 3D Website](https://forums.torque3d.org/viewforum.php?f=31)
* [Torque 2D Forums on the Torque Game Engines Website](https://torque3d.org/forums/forum/26-general/)
* [Torque Game Engines on Discord](https://discord.com/invite/qdAZxT4)

You also might be able to find useful information on the less active GarageGames website.
GarageGames is mostly gone, but their website still contains valuable information for those willing to search.

* [Torque 2D Beginner Forum](http://www.garagegames.com/community/forums/84)
* [Torque 2D Professional Forum](http://www.garagegames.com/community/forums/85)
* [GarageGames Community Blogs](http://www.garagegames.com/community/blogs)

### Support

Torque 2D is completely free to use, but like all things, it takes time and energy to maintain and develop. You can support T2D by becoming a sponsor on Patreon. Doing so ensures that T2D will continue receiving the attention it needs to remain competitive.

[Become a Patron](https://www.patreon.com/bePatron?u=15485520)

You can also support development directly by submitting pull requests or joining the steering committee! See the wiki for details.

# License

Copyright (c) 2012 GarageGames, LLC

Permission is hereby granted, free of charge, to any person obtaining a copy
Expand Down
224 changes: 224 additions & 0 deletions editor/AssetAdmin/AssetAdmin.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,224 @@
//-----------------------------------------------------------------------------
// Copyright (c) 2013 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.
//-----------------------------------------------------------------------------

function AssetAdmin::create(%this)
{
exec("./AssetDictionary.cs");
exec("./AssetWindow.cs");
exec("./AssetDictionaryButton.cs");
exec("./AssetInspector.cs");
exec("./AssetAudioPlayButton.cs");
exec("./NewAssetButton.cs");
exec("./NewImageAssetDialog.cs");
exec("./NewAnimationAssetDialog.cs");
exec("./NewParticleAssetDialog.cs");
exec("./NewFontAssetDialog.cs");
exec("./NewAudioAssetDialog.cs");
exec("./DeleteAssetDialog.cs");
exec("./ParticleEditor/exec.cs");

%this.guiPage = EditorCore.RegisterEditor("Asset Manager", %this);
%this.guiPage.add(%this.buildAssetWindow());
%this.guiPage.add(%this.buildAudioPlayButton());
%this.guiPage.add(%this.buildLibrary());
%this.guiPage.add(%this.buildInspector());

EditorCore.FinishRegistration(%this.guiPage);

%this.isOpen = false;
}

function AssetAdmin::buildLibrary(%this)
{
%this.libScroller = new GuiScrollCtrl()
{
HorizSizing="left";
VertSizing="height";
Position="700 0";
Extent="324 768";
MinExtent="162 384";
hScrollBar="dynamic";
vScrollBar="alwaysOn";
constantThumbHeight="0";
showArrowButtons="1";
scrollBarThickness="14";
};
ThemeManager.setProfile(%this.libScroller, "scrollingPanelProfile");
ThemeManager.setProfile(%this.libScroller, "scrollingPanelThumbProfile", ThumbProfile);
ThemeManager.setProfile(%this.libScroller, "scrollingPanelTrackProfile", TrackProfile);
ThemeManager.setProfile(%this.libScroller, "scrollingPanelArrowProfile", ArrowProfile);

%this.dictionaryList = new GuiChainCtrl()
{
HorizSizing="right";
VertSizing="bottom";
Position="0 0";
Extent="310 768";
MinExtent="220 200";
};
ThemeManager.setProfile(%this.dictionaryList, "emptyProfile");
%this.libScroller.add(%this.dictionaryList);

%this.dictionaryList.add(%this.buildDictionary("Images", "ImageAsset"));
%this.dictionaryList.add(%this.buildDictionary("Animations", "AnimationAsset"));
%this.dictionaryList.add(%this.buildDictionary("Particle Effects", "ParticleAsset"));
%this.dictionaryList.add(%this.buildDictionary("Fonts", "FontAsset"));
%this.dictionaryList.add(%this.buildDictionary("Audio", "AudioAsset"));
//%this.dictionaryList.add(%this.buildDictionary("Spines", "SpineAsset"));

return %this.libScroller;
}

function AssetAdmin::buildDictionary(%this, %title, %type)
{
%this.Dictionary[%type] = new GuiPanelCtrl()
{
Class = AssetDictionary;
Text=%title;
command="";
HorizSizing="right";
VertSizing="bottom";
Position="0 0";
Extent="310 22";
MinExtent="80 22";
Type = %type;
};
%this.Dictionary[%type].setExpandEase("EaseInOut", 1000);
ThemeManager.setProfile(%this.Dictionary[%type], "panelProfile");

return %this.Dictionary[%type];
}

function AssetAdmin::buildInspector(%this)
{
%this.inspector = new GuiControl()
{
class = "AssetInspector";
HorizSizing="width";
VertSizing="top";
Position="0 444";
Extent="700 324";
MinExtent="350 222";
};
ThemeManager.setProfile(%this.inspector, "overlayProfile");

return %this.inspector;
}

function AssetAdmin::buildAssetWindow(%this)
{
%this.assetScene = new Scene();
%this.assetScene.setScenePause(true);

%this.assetWindow = new SceneWindow()
{
class = AssetWindow;
profile = ThemeManager.activeTheme.overlayProfile;
position = "0 0";
extent = "700 444";
HorizSizing="width";
VertSizing="height";
minExtent = "0 0";
cameraPosition = "0 0";
cameraSize = "175 111";
useWindowInputEvents = true;
useObjectInputEvents = true;
constantThumbHeight = false;
scrollBarThickness = 14;
showArrowButtons = false;
};
ThemeManager.setProfile(%this.assetWindow, "thumbProfile", ThumbProfile);
ThemeManager.setProfile(%this.assetWindow, "trackProfile", TrackProfile);
ThemeManager.setProfile(%this.assetWindow, "scrollArrowProfile", ArrowProfile);

%this.assetWindow.setScene(%this.assetScene);
%this.assetWindow.setViewLimitOn("-87.5 -55.5 87.5 55.5");
%this.assetWindow.setShowScrollBar(true);
%this.assetWindow.setMouseWheelScrolls(false);

return %this.assetWindow;
}

function AssetAdmin::buildAudioPlayButton(%this)
{
%this.audioPlayButtonContainer = new GuiControl()
{
position = "0 0";
extent = "700 444";
HorizSizing="width";
VertSizing="height";
Visible="0";
};
ThemeManager.setProfile(%this.audioPlayButtonContainer, "emptyProfile");

%this.audioPlayButton = new GuiButtonCtrl()
{
class="AssetAudioPlayButton";
HorizSizing="center";
VertSizing="center";
Extent="100 48";
Text = "Play";
};
ThemeManager.setProfile(%this.audioPlayButton, "buttonProfile");
%this.audioPlayButtonContainer.add(%this.audioPlayButton);

return %this.audioPlayButtonContainer;
}

function AssetAdmin::destroy(%this)
{

}

function AssetAdmin::open(%this)
{
%this.Dictionary["ImageAsset"].load();
%this.Dictionary["AnimationAsset"].load();
%this.Dictionary["ParticleAsset"].load();
%this.Dictionary["FontAsset"].load();
%this.Dictionary["AudioAsset"].load();
//%this.Dictionary["SpineAsset"].load();

%this.assetScene.setScenePause(false);
%this.isOpen = true;
}

function AssetAdmin::close(%this)
{
%this.Dictionary["ImageAsset"].unload();
%this.Dictionary["AnimationAsset"].unload();
%this.Dictionary["ParticleAsset"].unload();
%this.Dictionary["FontAsset"].unload();
%this.Dictionary["AudioAsset"].unload();
//%this.Dictionary["SpineAsset"].unload();

%this.assetScene.setScenePause(true);
%this.isOpen = false;
}

function AssetBase::onRefresh(%this)
{
if(AssetAdmin.isOpen && isObject(AssetAdmin.chosenButton))
{
AssetAdmin.chosenButton.onClick();
}
}
40 changes: 40 additions & 0 deletions editor/AssetAdmin/AssetAudioPlayButton.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@

function AssetAudioPlayButton::onClick(%this)
{
if(alxIsPlaying(%this.sound))
{
%this.resetSound();
}
else
{
%this.sound = alxPlay(%this.assetID);
%this.setText("Stop");

if(!%this.asset.Looping)
{
%this.soundSchedule = %this.schedule(100, "testSound");
}
}
}

function AssetAudioPlayButton::testSound(%this)
{
if(alxIsPlaying(%this.sound))
{
%this.soundSchedule = %this.schedule(100, "testSound");
}
else
{
%this.setText("Play");
}
}

function AssetAudioPlayButton::resetSound(%this)
{
if(alxIsPlaying(%this.sound))
{
alxStop(%this.sound);
%this.setText("Play");
cancel(%this.soundSchedule);
}
}
Loading

0 comments on commit be8ca31

Please sign in to comment.