mirror of
https://github.com/4ian/GDevelop.git
synced 2025-10-15 10:19:04 +00:00
Compare commits
9 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
5612333c55 | ||
![]() |
05551c4d43 | ||
![]() |
f6a55188c6 | ||
![]() |
b5ec6e8deb | ||
![]() |
970bc3b0f0 | ||
![]() |
876a7fecb5 | ||
![]() |
3ac292ec18 | ||
![]() |
1ff06d4c9c | ||
![]() |
4a84e5048a |
@@ -4,7 +4,7 @@
|
||||
namespace AutoVersion{
|
||||
|
||||
//Date Version Types
|
||||
static const char GDCore_DATE[] = "10";
|
||||
static const char GDCore_DATE[] = "13";
|
||||
static const char GDCore_MONTH[] = "09";
|
||||
static const char GDCore_YEAR[] = "2015";
|
||||
|
||||
@@ -15,12 +15,12 @@ namespace AutoVersion{
|
||||
//Standard Version Type
|
||||
static const long GDCore_MAJOR = 4;
|
||||
static const long GDCore_MINOR = 0;
|
||||
static const long GDCore_BUILD = 86;
|
||||
static const long GDCore_BUILD = 87;
|
||||
static const long GDCore_REVISION = 0;
|
||||
|
||||
//Miscellaneous Version Types
|
||||
#define GDCore_RC_FILEVERSION 4,0,86,0
|
||||
#define GDCore_RC_FILEVERSION_STRING "4, 0, 86, 0\0"
|
||||
static const char GDCore_FULLVERSION_STRING[] = "4.0.86.0";
|
||||
#define GDCore_RC_FILEVERSION 4,0,87,0
|
||||
#define GDCore_RC_FILEVERSION_STRING "4, 0, 87, 0\0"
|
||||
static const char GDCore_FULLVERSION_STRING[] = "4.0.87.0";
|
||||
}
|
||||
#endif //GDCORE_VERSION_H
|
||||
|
@@ -5,7 +5,7 @@ Copyright (c) 2008-2015 Florian Rival (Florian.Rival@gmail.com)
|
||||
This project is released under the MIT License.
|
||||
*/
|
||||
|
||||
if (typeof AdMob !== "undefined")
|
||||
if (typeof AdMob !== "undefined")
|
||||
console.warn("AdMob plugin for Cordova is not installed - no ads will be displayed. Ensure you have installed com.google.cordova.admob or cordova-plugin-admobpro.");
|
||||
|
||||
/**
|
||||
@@ -21,8 +21,6 @@ gdjs.AdMobRuntimeObject = function(runtimeScene, objectData)
|
||||
{
|
||||
gdjs.RuntimeObject.call(this, runtimeScene, objectData);
|
||||
|
||||
this._runtimeScene = runtimeScene;
|
||||
|
||||
this._androidBannerId = objectData.androidBannerId;
|
||||
this._androidInterstitialId = objectData.androidInterstitialId;
|
||||
this._iosBannerId = objectData.iosBannerId;
|
||||
@@ -56,12 +54,12 @@ gdjs.AdMobRuntimeObject.getPlatformName = function() {
|
||||
};
|
||||
|
||||
gdjs.AdMobRuntimeObject.prototype._onAdPresent = function(data) {
|
||||
if (data.adType == 'interstitial')
|
||||
if (data.adType == 'interstitial')
|
||||
this._interstitialReady = false;
|
||||
};
|
||||
|
||||
gdjs.AdMobRuntimeObject.prototype._onAdDismiss = function(data) {
|
||||
if (data.adType == 'interstitial')
|
||||
if (data.adType == 'interstitial')
|
||||
this._interstitialReady = false;
|
||||
};
|
||||
|
||||
@@ -145,9 +143,10 @@ gdjs.AdMobRuntimeObject.prototype.isInterstitialReady = function() {
|
||||
};
|
||||
|
||||
gdjs.AdMobRuntimeObject.prototype.onDeletedFromScene = function(runtimeScene) {
|
||||
gdjs.RuntimeObject.prototype.onDeletedFromScene.call(this, runtimeScene);
|
||||
if (typeof AdMob === "undefined") return;
|
||||
|
||||
document.removeEventListener('onAdPresent', this._onAdPresent, false);
|
||||
document.removeEventListener('onAdDismiss', this._onAdDismiss, false);
|
||||
if (this._bannerDisplayed) this.hideBanner();
|
||||
};
|
||||
};
|
||||
|
@@ -23,7 +23,7 @@ gdjs.DestroyOutsideRuntimeBehavior.thisIsARuntimeBehaviorConstructor = "DestroyO
|
||||
gdjs.DestroyOutsideRuntimeBehavior.prototype.doStepPostEvents = function(runtimeScene) {
|
||||
|
||||
var ow = this.owner.getWidth();
|
||||
var oh = this.owner.getWidth();
|
||||
var oh = this.owner.getHeight();
|
||||
var ocx = this.owner.getDrawableX()+this.owner.getCenterX();
|
||||
var ocy = this.owner.getDrawableY()+this.owner.getCenterY();
|
||||
var layer = runtimeScene.getLayer(this.owner.getLayer());
|
||||
|
@@ -57,6 +57,7 @@ void PanelSpriteObject::DoUnserializeFrom(gd::Project & project, const gd::Seria
|
||||
topMargin = element.GetIntAttribute("topMargin");
|
||||
rightMargin = element.GetIntAttribute("rightMargin");
|
||||
bottomMargin = element.GetIntAttribute("bottomMargin");
|
||||
tiled = element.GetBoolAttribute("tiled");
|
||||
}
|
||||
|
||||
#if defined(GD_IDE_ONLY)
|
||||
@@ -69,6 +70,7 @@ void PanelSpriteObject::DoSerializeTo(gd::SerializerElement & element) const
|
||||
element.SetAttribute("topMargin", topMargin);
|
||||
element.SetAttribute("rightMargin", rightMargin);
|
||||
element.SetAttribute("bottomMargin", bottomMargin);
|
||||
element.SetAttribute("tiled", tiled);
|
||||
}
|
||||
|
||||
void PanelSpriteObject::LoadResources(gd::Project & project, gd::Layout & layout)
|
||||
|
@@ -61,13 +61,12 @@ public :
|
||||
float GetBottomMargin() const { return bottomMargin; };
|
||||
void SetBottomMargin(float newMargin) { bottomMargin = newMargin; };
|
||||
|
||||
bool IsSmooth() const { return smooth; };
|
||||
void SetSmooth(bool enable) { smooth = enable; };
|
||||
bool IsTiled() const { return tiled; };
|
||||
void SetTiled(bool enable = true) { tiled = enable; };
|
||||
|
||||
gd::String textureName;
|
||||
|
||||
private:
|
||||
|
||||
virtual void DoUnserializeFrom(gd::Project & project, const gd::SerializerElement & element);
|
||||
#if defined(GD_IDE_ONLY)
|
||||
virtual void DoSerializeTo(gd::SerializerElement & element) const;
|
||||
@@ -81,7 +80,7 @@ private:
|
||||
float rightMargin;
|
||||
float bottomMargin;
|
||||
|
||||
bool smooth;
|
||||
bool tiled;
|
||||
|
||||
std::shared_ptr<SFMLTextureWrapper> texture;
|
||||
};
|
||||
@@ -138,7 +137,6 @@ private:
|
||||
float bottomMargin;
|
||||
|
||||
float angle;
|
||||
bool smooth;
|
||||
|
||||
std::shared_ptr<SFMLTextureWrapper> texture;
|
||||
};
|
||||
|
@@ -28,6 +28,7 @@ const long PanelSpriteObjectEditor::ID_STATICTEXT7 = wxNewId();
|
||||
const long PanelSpriteObjectEditor::ID_TEXTCTRL7 = wxNewId();
|
||||
const long PanelSpriteObjectEditor::ID_STATICTEXT8 = wxNewId();
|
||||
const long PanelSpriteObjectEditor::ID_TEXTCTRL8 = wxNewId();
|
||||
const long PanelSpriteObjectEditor::ID_CHECKBOX1 = wxNewId();
|
||||
const long PanelSpriteObjectEditor::ID_STATICTEXT2 = wxNewId();
|
||||
const long PanelSpriteObjectEditor::ID_TEXTCTRL3 = wxNewId();
|
||||
const long PanelSpriteObjectEditor::ID_STATICTEXT1 = wxNewId();
|
||||
@@ -39,7 +40,6 @@ const long PanelSpriteObjectEditor::ID_STATICTEXT4 = wxNewId();
|
||||
const long PanelSpriteObjectEditor::ID_TEXTCTRL5 = wxNewId();
|
||||
const long PanelSpriteObjectEditor::ID_TEXTCTRL1 = wxNewId();
|
||||
const long PanelSpriteObjectEditor::ID_BITMAPBUTTON1 = wxNewId();
|
||||
const long PanelSpriteObjectEditor::ID_CHECKBOX1 = wxNewId();
|
||||
const long PanelSpriteObjectEditor::ID_STATICLINE1 = wxNewId();
|
||||
const long PanelSpriteObjectEditor::ID_BUTTON3 = wxNewId();
|
||||
const long PanelSpriteObjectEditor::ID_BUTTON1 = wxNewId();
|
||||
@@ -67,6 +67,7 @@ object(object_)
|
||||
wxFlexGridSizer* FlexGridSizer9;
|
||||
wxFlexGridSizer* FlexGridSizer2;
|
||||
wxFlexGridSizer* FlexGridSizer7;
|
||||
wxStaticBoxSizer* StaticBoxSizer3;
|
||||
wxGridSizer* GridSizer1;
|
||||
wxFlexGridSizer* FlexGridSizer8;
|
||||
wxFlexGridSizer* FlexGridSizer12;
|
||||
@@ -102,6 +103,11 @@ object(object_)
|
||||
StaticBoxSizer2->Add(FlexGridSizer6, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0);
|
||||
FlexGridSizer5->Add(StaticBoxSizer2, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
|
||||
FlexGridSizer4->Add(FlexGridSizer5, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0);
|
||||
StaticBoxSizer3 = new wxStaticBoxSizer(wxHORIZONTAL, Core, _("Texture configuration (for HTML5 games only)"));
|
||||
tileCheck = new wxCheckBox(Core, ID_CHECKBOX1, _("Repeat borders and center textures (instead of stretching them)"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_CHECKBOX1"));
|
||||
tileCheck->SetValue(false);
|
||||
StaticBoxSizer3->Add(tileCheck, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
|
||||
FlexGridSizer4->Add(StaticBoxSizer3, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
|
||||
FlexGridSizer8 = new wxFlexGridSizer(0, 1, 0, 0);
|
||||
FlexGridSizer8->AddGrowableCol(0);
|
||||
FlexGridSizer8->AddGrowableRow(0);
|
||||
@@ -153,9 +159,6 @@ object(object_)
|
||||
FlexGridSizer3->Add(frontTextureEdit, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
|
||||
frontAddFromBt = new wxBitmapButton(Core, ID_BITMAPBUTTON1, wxBitmap(wxImage(_T("res/addfromimagebanque.png"))), wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW, wxDefaultValidator, _T("ID_BITMAPBUTTON1"));
|
||||
FlexGridSizer3->Add(frontAddFromBt, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
|
||||
smoothCheckBox = new wxCheckBox(Core, ID_CHECKBOX1, _("Smooth texture"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_CHECKBOX1"));
|
||||
smoothCheckBox->SetValue(false);
|
||||
FlexGridSizer3->Add(smoothCheckBox, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
|
||||
StaticBoxSizer1->Add(FlexGridSizer3, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0);
|
||||
FlexGridSizer4->Add(StaticBoxSizer1, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
|
||||
FlexGridSizer2->Add(FlexGridSizer4, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0);
|
||||
@@ -191,7 +194,7 @@ object(object_)
|
||||
topMarginTextCtrl->ChangeValue(gd::String::From(object.GetTopMargin()));
|
||||
rightMarginTextCtrl->ChangeValue(gd::String::From(object.GetRightMargin()));
|
||||
bottomMarginTextCtrl->ChangeValue(gd::String::From(object.GetBottomMargin()));
|
||||
smoothCheckBox->SetValue(object.IsSmooth());
|
||||
tileCheck->SetValue(object.IsTiled());
|
||||
|
||||
//Init the image bank editor
|
||||
resourcesEditor = new ResourcesEditor( this, game, mainFrameWrapper );
|
||||
@@ -239,7 +242,7 @@ void PanelSpriteObjectEditor::OnokBtClick(wxCommandEvent& event)
|
||||
object.SetTopMargin(gd::String(topMarginTextCtrl->GetValue()).To<float>());
|
||||
object.SetRightMargin(gd::String(rightMarginTextCtrl->GetValue()).To<float>());
|
||||
object.SetBottomMargin(gd::String(bottomMarginTextCtrl->GetValue()).To<float>());
|
||||
object.SetSmooth(smoothCheckBox->GetValue());
|
||||
object.SetTiled(tileCheck->GetValue());
|
||||
|
||||
EndModal(1);
|
||||
}
|
||||
|
@@ -43,13 +43,13 @@ class PanelSpriteObjectEditor: public wxDialog
|
||||
wxStaticText* StaticText1;
|
||||
wxStaticText* StaticText3;
|
||||
wxButton* cancelBt;
|
||||
wxCheckBox* tileCheck;
|
||||
wxButton* imageBankBt;
|
||||
wxTextCtrl* bottomMarginTextCtrl;
|
||||
wxStaticText* StaticText5;
|
||||
wxStaticText* StaticText7;
|
||||
wxStaticLine* StaticLine1;
|
||||
wxTextCtrl* rightMarginTextCtrl;
|
||||
wxCheckBox* smoothCheckBox;
|
||||
wxBitmapButton* frontAddFromBt;
|
||||
wxStaticText* StaticText4;
|
||||
wxTextCtrl* leftMarginTextCtrl;
|
||||
@@ -65,6 +65,7 @@ class PanelSpriteObjectEditor: public wxDialog
|
||||
static const long ID_TEXTCTRL7;
|
||||
static const long ID_STATICTEXT8;
|
||||
static const long ID_TEXTCTRL8;
|
||||
static const long ID_CHECKBOX1;
|
||||
static const long ID_STATICTEXT2;
|
||||
static const long ID_TEXTCTRL3;
|
||||
static const long ID_STATICTEXT1;
|
||||
@@ -76,7 +77,6 @@ class PanelSpriteObjectEditor: public wxDialog
|
||||
static const long ID_TEXTCTRL5;
|
||||
static const long ID_TEXTCTRL1;
|
||||
static const long ID_BITMAPBUTTON1;
|
||||
static const long ID_CHECKBOX1;
|
||||
static const long ID_STATICLINE1;
|
||||
static const long ID_BUTTON3;
|
||||
static const long ID_BUTTON1;
|
||||
|
@@ -16,16 +16,20 @@ gdjs.PanelSpriteRuntimeObject = function(runtimeScene, objectData)
|
||||
|
||||
if ( this._spritesContainer === undefined ) {
|
||||
var texture = runtimeScene.getGame().getImageManager().getPIXITexture(objectData.texture);
|
||||
|
||||
var StretchedSprite = !objectData.tiled ?
|
||||
PIXI.Sprite : PIXI.extras.TilingSprite;
|
||||
|
||||
this._spritesContainer = new PIXI.Container();
|
||||
this._centerSprite = new PIXI.Sprite(new PIXI.Texture(texture));
|
||||
this._centerSprite = new StretchedSprite(new PIXI.Texture(texture));
|
||||
this._borderSprites = [
|
||||
new PIXI.Sprite(new PIXI.Texture(texture)), //Right
|
||||
new StretchedSprite(new PIXI.Texture(texture)), //Right
|
||||
new PIXI.Sprite(texture), //Top-Right
|
||||
new PIXI.Sprite(new PIXI.Texture(texture)), //Top
|
||||
new StretchedSprite(new PIXI.Texture(texture)), //Top
|
||||
new PIXI.Sprite(texture), //Top-Left
|
||||
new PIXI.Sprite(new PIXI.Texture(texture)), //Left
|
||||
new StretchedSprite(new PIXI.Texture(texture)), //Left
|
||||
new PIXI.Sprite(texture), //Bottom-Left
|
||||
new PIXI.Sprite(new PIXI.Texture(texture)), //Bottom
|
||||
new StretchedSprite(new PIXI.Texture(texture)), //Bottom
|
||||
new PIXI.Sprite(texture) //Bottom-Right
|
||||
];
|
||||
this._borderMasks = [
|
||||
@@ -36,9 +40,7 @@ gdjs.PanelSpriteRuntimeObject = function(runtimeScene, objectData)
|
||||
];
|
||||
}
|
||||
|
||||
this._centerSprite.anchor.x = this._centerSprite.anchor.y = 0.5;
|
||||
for (var i = 0;i < this._borderSprites.length;++i) {
|
||||
this._borderSprites[i].anchor.x = this._borderSprites[i].anchor.y = 0.5;
|
||||
|
||||
if (i % 2 !== 0) {
|
||||
this._borderSprites[i].mask = this._borderMasks[(i - 1) / 2];
|
||||
@@ -49,7 +51,7 @@ gdjs.PanelSpriteRuntimeObject = function(runtimeScene, objectData)
|
||||
this._lBorder = objectData.leftMargin;
|
||||
this._tBorder = objectData.topMargin;
|
||||
this._bBorder = objectData.bottomMargin;
|
||||
this._runtimeScene = runtimeScene;
|
||||
this._tiled = objectData.tiled;
|
||||
this.setTexture(objectData.texture, runtimeScene);
|
||||
this.setWidth(objectData.width);
|
||||
this.setHeight(objectData.height);
|
||||
@@ -68,10 +70,18 @@ gdjs.PanelSpriteRuntimeObject = function(runtimeScene, objectData)
|
||||
gdjs.PanelSpriteRuntimeObject.prototype = Object.create( gdjs.RuntimeObject.prototype );
|
||||
gdjs.PanelSpriteRuntimeObject.thisIsARuntimeObjectConstructor = "PanelSpriteObject::PanelSprite";
|
||||
|
||||
gdjs.PanelSpriteRuntimeObject.prototype.onDeletedFromScene = function(runtimeScene) {
|
||||
runtimeScene.getLayer(this.layer).removePIXIContainerChild(this._spritesContainer);
|
||||
gdjs.PanelSpriteRuntimeObject.prototype.exposePIXIDisplayObject = function(cb) {
|
||||
cb(this._spritesContainer);
|
||||
};
|
||||
|
||||
gdjs.PanelSpriteRuntimeObject.prototype.updateTime = function() {
|
||||
if (this._spritesContainer.visible && this._wasRendered) {
|
||||
this._spritesContainer.cacheAsBitmap = true;
|
||||
}
|
||||
|
||||
this._wasRendered = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize the extra parameters that could be set for an instance.
|
||||
*/
|
||||
@@ -86,34 +96,36 @@ gdjs.PanelSpriteRuntimeObject.prototype._updateSpritePositions = function() {
|
||||
this._spritesContainer.position.x = this.x + this._width / 2;
|
||||
this._spritesContainer.position.y = this.y + this._height / 2;
|
||||
|
||||
this._centerSprite.position.x = (this._width - this._lBorder - this._rBorder) / 2 + this._lBorder;
|
||||
this._centerSprite.position.y = (this._height - this._tBorder - this._bBorder) / 2 + this._tBorder;
|
||||
this._borderSprites[0].position.x = this._width - this._borderSprites[0].width / 2;
|
||||
this._borderSprites[0].position.y = (this._height - this._tBorder - this._bBorder) / 2 + this._tBorder;
|
||||
var extraPixels = this._tiled ? 1 : 0;
|
||||
|
||||
this._borderSprites[1].position.x = this._width - this._borderSprites[1].width / 2;
|
||||
this._borderSprites[1].position.y = this._borderSprites[1].height / 2;
|
||||
this._centerSprite.position.x = this._lBorder;
|
||||
this._centerSprite.position.y = this._tBorder;
|
||||
this._borderSprites[0].position.x = this._width - this._rBorder - extraPixels * 2;
|
||||
this._borderSprites[0].position.y = this._tBorder;
|
||||
|
||||
this._borderSprites[1].position.x = this._width - this._borderSprites[1].width - extraPixels * 2;
|
||||
this._borderSprites[1].position.y = 0;
|
||||
this._borderMasks[0].position = this._borderSprites[1].position;
|
||||
|
||||
this._borderSprites[2].position.x = (this._width - this._lBorder - this._rBorder) / 2 + this._lBorder;
|
||||
this._borderSprites[2].position.y = this._borderSprites[2].height / 2;
|
||||
this._borderSprites[2].position.x = this._lBorder;
|
||||
this._borderSprites[2].position.y = 0;
|
||||
|
||||
this._borderSprites[3].position.x = this._borderSprites[3].width / 2;
|
||||
this._borderSprites[3].position.y = this._borderSprites[3].height / 2;
|
||||
this._borderSprites[3].position.x = 0;
|
||||
this._borderSprites[3].position.y = 0;
|
||||
this._borderMasks[1].position = this._borderSprites[3].position;
|
||||
|
||||
this._borderSprites[4].position.x = this._borderSprites[4].width / 2;
|
||||
this._borderSprites[4].position.y = (this._height - this._tBorder - this._bBorder) / 2 + this._tBorder;
|
||||
this._borderSprites[4].position.x = 0;
|
||||
this._borderSprites[4].position.y = this._tBorder;
|
||||
|
||||
this._borderSprites[5].position.x = this._borderSprites[5].width / 2;
|
||||
this._borderSprites[5].position.y = this._height - this._borderSprites[5].height / 2;
|
||||
this._borderSprites[5].position.x = 0;
|
||||
this._borderSprites[5].position.y = this._height - this._borderSprites[5].height - extraPixels * 2;
|
||||
this._borderMasks[2].position = this._borderSprites[5].position;
|
||||
|
||||
this._borderSprites[6].position.x = (this._width - this._lBorder - this._rBorder) / 2 + this._lBorder;
|
||||
this._borderSprites[6].position.y = this._height - this._borderSprites[6].height / 2;
|
||||
this._borderSprites[6].position.x = this._lBorder;
|
||||
this._borderSprites[6].position.y = this._height - this._bBorder - extraPixels * 2;
|
||||
|
||||
this._borderSprites[7].position.x = this._width - this._borderSprites[7].width / 2;
|
||||
this._borderSprites[7].position.y = this._height - this._borderSprites[7].height / 2;
|
||||
this._borderSprites[7].position.x = this._width - this._borderSprites[7].width - extraPixels * 2;
|
||||
this._borderSprites[7].position.y = this._height - this._borderSprites[7].height - extraPixels * 2;
|
||||
this._borderMasks[3].position = this._borderSprites[7].position;
|
||||
};
|
||||
|
||||
@@ -141,14 +153,17 @@ gdjs.PanelSpriteRuntimeObject.prototype._updateSpritesAndTexturesSize = function
|
||||
this._borderMasks[i].beginFill(0xFFFFFF,0);
|
||||
}
|
||||
|
||||
this._borderMasks[0].drawRect(this._borderSprites[1].width / 2 - this._rBorder, -this._borderSprites[1].height / 2, this._rBorder, this._tBorder);
|
||||
this._borderMasks[1].drawRect(-this._borderSprites[3].width / 2, -this._borderSprites[3].height / 2, this._lBorder, this._tBorder);
|
||||
this._borderMasks[2].drawRect(-this._borderSprites[5].width / 2, this._borderSprites[5].height / 2 - this._bBorder, this._lBorder, this._bBorder);
|
||||
this._borderMasks[3].drawRect(this._borderSprites[7].width / 2 - this._rBorder, this._borderSprites[7].height / 2 - this._bBorder, this._rBorder, this._bBorder);
|
||||
this._borderMasks[0].drawRect(this._borderSprites[1].width - this._rBorder, 0, this._rBorder, this._tBorder);
|
||||
this._borderMasks[1].drawRect(0, 0, this._lBorder, this._tBorder);
|
||||
this._borderMasks[2].drawRect(0, this._borderSprites[5].height - this._bBorder, this._lBorder, this._bBorder);
|
||||
this._borderMasks[3].drawRect(this._borderSprites[7].width - this._rBorder, this._borderSprites[7].height - this._bBorder, this._rBorder, this._bBorder);
|
||||
|
||||
for (var i = 0;i < this._borderMasks.length;++i) {
|
||||
this._borderMasks[i].endFill();
|
||||
}
|
||||
|
||||
this._wasRendered = true;
|
||||
this._spritesContainer.cacheAsBitmap = false;
|
||||
};
|
||||
|
||||
gdjs.PanelSpriteRuntimeObject.prototype.setX = function(x) {
|
||||
@@ -184,15 +199,15 @@ gdjs.PanelSpriteRuntimeObject.prototype.setTexture = function(textureName, runti
|
||||
|
||||
//Top, Bottom, Right, Left borders:
|
||||
this._borderSprites[0].texture = new PIXI.Texture(texture,
|
||||
makeInsideTexture(new PIXI.Rectangle(texture.width - this._rBorder, this._tBorder, this._rBorder,
|
||||
makeInsideTexture(new PIXI.Rectangle(texture.width - this._rBorder - 1, this._tBorder, this._rBorder + 1,
|
||||
texture.height - this._tBorder - this._bBorder)));
|
||||
this._borderSprites[2].texture = new PIXI.Texture(texture,
|
||||
makeInsideTexture(new PIXI.Rectangle(this._lBorder, 0, texture.width - this._lBorder - this._rBorder, this._tBorder)));
|
||||
makeInsideTexture(new PIXI.Rectangle(this._lBorder, 0, texture.width - this._lBorder - this._rBorder, this._tBorder + 1)));
|
||||
this._borderSprites[4].texture = new PIXI.Texture(texture,
|
||||
makeInsideTexture(new PIXI.Rectangle(0, this._tBorder, this._lBorder, texture.height - this._tBorder - this._bBorder)));
|
||||
makeInsideTexture(new PIXI.Rectangle(0, this._tBorder, this._lBorder + 1, texture.height - this._tBorder - this._bBorder)));
|
||||
this._borderSprites[6].texture = new PIXI.Texture(texture,
|
||||
makeInsideTexture(new PIXI.Rectangle(this._lBorder, texture.height - this._bBorder,
|
||||
texture.width - this._lBorder - this._rBorder, this._bBorder)));
|
||||
makeInsideTexture(new PIXI.Rectangle(this._lBorder, texture.height - this._bBorder - 1,
|
||||
texture.width - this._lBorder - this._rBorder, this._bBorder + 1)));
|
||||
|
||||
//Corners:
|
||||
this._borderSprites[1].texture = texture;
|
||||
@@ -209,13 +224,6 @@ gdjs.PanelSpriteRuntimeObject.prototype.setAngle = function(angle) {
|
||||
this._spritesContainer.rotation = gdjs.toRad(angle);
|
||||
};
|
||||
|
||||
gdjs.PanelSpriteRuntimeObject.prototype.setLayer = function(name) {
|
||||
//We need to move the object from the pixi container of the layer
|
||||
this._runtimeScene.getLayer(this.layer).removePIXIContainerChild(this._spritesContainer);
|
||||
this.layer = name;
|
||||
this._runtimeScene.getLayer(this.layer).addChildToPIXIContainer(this._spritesContainer, this.zOrder);
|
||||
};
|
||||
|
||||
gdjs.PanelSpriteRuntimeObject.prototype.getWidth = function() {
|
||||
return this._width;
|
||||
};
|
||||
@@ -237,10 +245,3 @@ gdjs.PanelSpriteRuntimeObject.prototype.setHeight = function(height) {
|
||||
this._updateSpritesAndTexturesSize();
|
||||
this._updateSpritePositions();
|
||||
};
|
||||
|
||||
gdjs.PanelSpriteRuntimeObject.prototype.setZOrder = function(z) {
|
||||
if ( z !== this.zOrder ) {
|
||||
this._runtimeScene.getLayer(this.layer).changePIXIContainerChildZOrder(this._spritesContainer, z);
|
||||
this.zOrder = z;
|
||||
}
|
||||
};
|
||||
|
@@ -75,6 +75,22 @@
|
||||
<flag>wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL</flag>
|
||||
<option>1</option>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
<object class="wxStaticBoxSizer" variable="StaticBoxSizer3" member="no">
|
||||
<label>Texture configuration (for HTML5 games only)</label>
|
||||
<object class="sizeritem">
|
||||
<object class="wxCheckBox" name="ID_CHECKBOX1" variable="tileCheck" member="yes">
|
||||
<label>Repeat borders and center textures (instead of stretching them)</label>
|
||||
</object>
|
||||
<flag>wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL</flag>
|
||||
<border>5</border>
|
||||
<option>1</option>
|
||||
</object>
|
||||
</object>
|
||||
<flag>wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL</flag>
|
||||
<border>5</border>
|
||||
<option>1</option>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
<object class="wxFlexGridSizer" variable="FlexGridSizer8" member="no">
|
||||
<cols>1</cols>
|
||||
@@ -252,14 +268,6 @@
|
||||
<border>5</border>
|
||||
<option>1</option>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
<object class="wxCheckBox" name="ID_CHECKBOX1" variable="smoothCheckBox" member="yes">
|
||||
<label>Smooth texture</label>
|
||||
</object>
|
||||
<flag>wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL</flag>
|
||||
<border>5</border>
|
||||
<option>1</option>
|
||||
</object>
|
||||
</object>
|
||||
<flag>wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL</flag>
|
||||
<option>1</option>
|
||||
|
@@ -25,15 +25,14 @@ gdjs.ShapePainterRuntimeObject = function(runtimeScene, objectData)
|
||||
this._outlineSize = objectData.outlineSize;
|
||||
this._absoluteCoordinates = objectData.absoluteCoordinates;
|
||||
|
||||
this._runtimeScene = runtimeScene;
|
||||
runtimeScene.getLayer("").addChildToPIXIContainer(this._graphics, this.zOrder);
|
||||
};
|
||||
|
||||
gdjs.ShapePainterRuntimeObject.prototype = Object.create( gdjs.RuntimeObject.prototype );
|
||||
gdjs.ShapePainterRuntimeObject.thisIsARuntimeObjectConstructor = "PrimitiveDrawing::Drawer";
|
||||
|
||||
gdjs.ShapePainterRuntimeObject.prototype.onDeletedFromScene = function(runtimeScene) {
|
||||
runtimeScene.getLayer(this.layer).removePIXIContainerChild(this._graphics);
|
||||
gdjs.ShapePainterRuntimeObject.prototype.exposePIXIDisplayObject = function(cb) {
|
||||
cb(this._graphics);
|
||||
};
|
||||
|
||||
gdjs.ShapePainterRuntimeObject.prototype.stepBehaviorsPreEvents = function(runtimeScene) {
|
||||
@@ -126,13 +125,6 @@ gdjs.ShapePainterRuntimeObject.prototype.setY = function(y) {
|
||||
}
|
||||
};
|
||||
|
||||
gdjs.ShapePainterRuntimeObject.prototype.setLayer = function(name) {
|
||||
//We need to move the object from the pixi container of the layer
|
||||
this._runtimeScene.getLayer(this.layer).removePIXIContainerChild(this._graphics);
|
||||
this.layer = name;
|
||||
this._runtimeScene.getLayer(this.layer).addChildToPIXIContainer(this._graphics, this.zOrder);
|
||||
};
|
||||
|
||||
gdjs.ShapePainterRuntimeObject.prototype.getWidth = function() {
|
||||
return 32;
|
||||
};
|
||||
@@ -140,10 +132,3 @@ gdjs.ShapePainterRuntimeObject.prototype.getWidth = function() {
|
||||
gdjs.ShapePainterRuntimeObject.prototype.getHeight = function() {
|
||||
return 32;
|
||||
};
|
||||
|
||||
gdjs.ShapePainterRuntimeObject.prototype.setZOrder = function(z) {
|
||||
if ( z !== this.zOrder ) {
|
||||
this._runtimeScene.getLayer(this.layer).changePIXIContainerChildZOrder(this._graphics, z);
|
||||
this.zOrder = z;
|
||||
}
|
||||
};
|
||||
|
@@ -68,6 +68,8 @@ gdjs.TextEntryRuntimeObject.prototype = Object.create( gdjs.RuntimeObject.protot
|
||||
gdjs.TextEntryRuntimeObject.thisIsARuntimeObjectConstructor = "TextEntryObject::TextEntry";
|
||||
|
||||
gdjs.TextEntryRuntimeObject.prototype.onDeletedFromScene = function(runtimeScene) {
|
||||
gdjs.RuntimeObject.prototype.onDeletedFromScene.call(this, runtimeScene);
|
||||
|
||||
document.removeEventListener('keypress', this._pressHandler);
|
||||
document.removeEventListener('keyup', this._upHandler);
|
||||
document.removeEventListener('keydown', this._downHandler);
|
||||
|
@@ -15,7 +15,6 @@ gdjs.TextRuntimeObject = function(runtimeScene, objectData)
|
||||
{
|
||||
gdjs.RuntimeObject.call(this, runtimeScene, objectData);
|
||||
|
||||
this._runtimeScene = runtimeScene;
|
||||
this._characterSize = objectData.characterSize;
|
||||
this._fontName = "Arial";
|
||||
this._bold = objectData.bold;
|
||||
@@ -42,8 +41,8 @@ gdjs.TextRuntimeObject = function(runtimeScene, objectData)
|
||||
gdjs.TextRuntimeObject.prototype = Object.create( gdjs.RuntimeObject.prototype );
|
||||
gdjs.TextRuntimeObject.thisIsARuntimeObjectConstructor = "TextObject::Text";
|
||||
|
||||
gdjs.TextRuntimeObject.prototype.onDeletedFromScene = function(runtimeScene) {
|
||||
runtimeScene.getLayer(this.layer).removePIXIContainerChild(this._text);
|
||||
gdjs.TextRuntimeObject.prototype.exposePIXIDisplayObject = function(cb) {
|
||||
cb(this._text);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -205,29 +204,6 @@ gdjs.TextRuntimeObject.prototype.setItalic = function(enable) {
|
||||
this._updateTextStyle();
|
||||
};
|
||||
|
||||
/**
|
||||
* Hide or show the object
|
||||
* @method hide
|
||||
* @param enable {Boolean} Set it to true to hide the object, false to show it.
|
||||
*/
|
||||
gdjs.TextRuntimeObject.prototype.hide = function(enable) {
|
||||
if ( enable === undefined ) enable = true;
|
||||
this._hidden = enable;
|
||||
this._text.visible = !enable;
|
||||
};
|
||||
|
||||
/**
|
||||
* Set the layer of the object.
|
||||
* @method setLayer
|
||||
* @param {String} The new layer of the object
|
||||
*/
|
||||
gdjs.TextRuntimeObject.prototype.setLayer = function(name) {
|
||||
//We need to move the object from the pixi container of the layer
|
||||
this._runtimeScene.getLayer(this.layer).removePIXIContainerChild(this._text);
|
||||
this.layer = name;
|
||||
this._runtimeScene.getLayer(this.layer).addChildToPIXIContainer(this._text, this.zOrder);
|
||||
};
|
||||
|
||||
/**
|
||||
* Get width for your object text.
|
||||
* @method getWidth
|
||||
@@ -258,15 +234,3 @@ gdjs.TextRuntimeObject.prototype.setColor = function(str) {
|
||||
this._color[2] = parseInt(color[2], 10);
|
||||
this._updateTextStyle();
|
||||
};
|
||||
|
||||
/**
|
||||
* Set the Z order of the object.
|
||||
* @method setZOrder
|
||||
* @param z {Number} The new Z order position of the object
|
||||
*/
|
||||
gdjs.TextRuntimeObject.prototype.setZOrder = function(z) {
|
||||
if ( z !== this.zOrder ) {
|
||||
this._runtimeScene.getLayer(this.layer).changePIXIContainerChildZOrder(this._text, z);
|
||||
this.zOrder = z;
|
||||
}
|
||||
};
|
||||
|
@@ -26,15 +26,14 @@ gdjs.TiledSpriteRuntimeObject = function(runtimeScene, objectData)
|
||||
this._xOffset = 0;
|
||||
this._yOffset = 0;
|
||||
|
||||
this._runtimeScene = runtimeScene;
|
||||
runtimeScene.getLayer("").addChildToPIXIContainer(this._tiledSprite, this.zOrder);
|
||||
};
|
||||
|
||||
gdjs.TiledSpriteRuntimeObject.prototype = Object.create( gdjs.RuntimeObject.prototype );
|
||||
gdjs.TiledSpriteRuntimeObject.thisIsARuntimeObjectConstructor = "TiledSpriteObject::TiledSprite";
|
||||
|
||||
gdjs.TiledSpriteRuntimeObject.prototype.onDeletedFromScene = function(runtimeScene) {
|
||||
runtimeScene.getLayer(this.layer).removePIXIContainerChild(this._tiledSprite);
|
||||
gdjs.TiledSpriteRuntimeObject.prototype.exposePIXIDisplayObject = function(cb) {
|
||||
cb(this._tiledSprite);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -73,13 +72,6 @@ gdjs.TiledSpriteRuntimeObject.prototype.setAngle = function(angle) {
|
||||
this._tiledSprite.rotation = gdjs.toRad(angle);
|
||||
};
|
||||
|
||||
gdjs.TiledSpriteRuntimeObject.prototype.setLayer = function(name) {
|
||||
//We need to move the object from the pixi container of the layer
|
||||
this._runtimeScene.getLayer(this.layer).removePIXIContainerChild(this._tiledSprite);
|
||||
this.layer = name;
|
||||
this._runtimeScene.getLayer(this.layer).addChildToPIXIContainer(this._tiledSprite, this.zOrder);
|
||||
};
|
||||
|
||||
gdjs.TiledSpriteRuntimeObject.prototype.getWidth = function() {
|
||||
return this._tiledSprite.width;
|
||||
};
|
||||
@@ -117,10 +109,3 @@ gdjs.TiledSpriteRuntimeObject.prototype.getXOffset = function() {
|
||||
gdjs.TiledSpriteRuntimeObject.prototype.getYOffset = function() {
|
||||
return this._yOffset;
|
||||
};
|
||||
|
||||
gdjs.TiledSpriteRuntimeObject.prototype.setZOrder = function(z) {
|
||||
if ( z !== this.zOrder ) {
|
||||
this._runtimeScene.getLayer(this.layer).changePIXIContainerChildZOrder(this._tiledSprite, z);
|
||||
this.zOrder = z;
|
||||
}
|
||||
};
|
||||
|
@@ -450,11 +450,14 @@ gdjs.RuntimeGame.prototype.startStandardGameLoop = function() {
|
||||
|
||||
//Uncomment to profile the first x frames of the game.
|
||||
/*var x = 250;
|
||||
var startTime = Date.now();
|
||||
console.profile("Stepping for " + x + " frames")
|
||||
for(var i = 0; i < x; ++i) {
|
||||
currentScene.renderAndStep();
|
||||
this._sceneStack.step();
|
||||
}
|
||||
console.profileEnd();
|
||||
var time = Date.now() - startTime;
|
||||
console.log("Took", time, "ms");
|
||||
return;*/
|
||||
|
||||
requestAnimationFrame(gameLoop);
|
||||
|
@@ -33,6 +33,7 @@ gdjs.RuntimeObject = function(runtimeScene, objectData)
|
||||
this.layer = "";
|
||||
this.livingOnScene = true;
|
||||
this.id = runtimeScene.createNewUniqueId();
|
||||
this._runtimeScene = runtimeScene; //This could/should be avoided.
|
||||
|
||||
//Hit boxes:
|
||||
if ( this._defaultHitBoxes === undefined ) {
|
||||
@@ -138,6 +139,22 @@ gdjs.RuntimeObject.prototype.deleteFromScene = function(runtimeScene) {
|
||||
* @param runtimeScene The RuntimeScene owning the object.
|
||||
*/
|
||||
gdjs.RuntimeObject.prototype.onDeletedFromScene = function(runtimeScene) {
|
||||
var theLayer = runtimeScene.getLayer(this.layer);
|
||||
this.exposePIXIDisplayObject(function(displayObject) {
|
||||
theLayer.removePIXIContainerChild(displayObject);
|
||||
});
|
||||
};
|
||||
|
||||
//Rendering:
|
||||
|
||||
/**
|
||||
* Called with a callback function that should be called for
|
||||
* each PIXI.DisplayObject used by the object
|
||||
*
|
||||
* @method exposePIXIDisplayObject
|
||||
* @param cb The callback to be called with a PIXI.DisplayObject
|
||||
*/
|
||||
gdjs.RuntimeObject.prototype.exposePIXIDisplayObject = function(cb) {
|
||||
};
|
||||
|
||||
//Common properties:
|
||||
@@ -285,26 +302,6 @@ gdjs.RuntimeObject.prototype.rotate = function(speed, runtimeScene) {
|
||||
this.setAngle(this.getAngle()+speed*runtimeScene.getElapsedTime()/1000);
|
||||
};
|
||||
|
||||
/**
|
||||
* Set the Z order of the object.
|
||||
*
|
||||
* @method setZOrder
|
||||
* @param z {Number} The new Z order position of the object
|
||||
*/
|
||||
gdjs.RuntimeObject.prototype.setZOrder = function(z) {
|
||||
this.zOrder = z;
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the Z order of the object.
|
||||
*
|
||||
* @method getZOrder
|
||||
* @return {Number} The Z order of the object
|
||||
*/
|
||||
gdjs.RuntimeObject.prototype.getZOrder = function() {
|
||||
return this.zOrder;
|
||||
};
|
||||
|
||||
/**
|
||||
* Set the angle of the object.
|
||||
*
|
||||
@@ -335,7 +332,15 @@ gdjs.RuntimeObject.prototype.getAngle = function() {
|
||||
* @return {String} The new layer of the object
|
||||
*/
|
||||
gdjs.RuntimeObject.prototype.setLayer = function(layer) {
|
||||
if (layer === this.layer) return;
|
||||
this.layer = layer;
|
||||
|
||||
var theLayer = this._runtimeScene.getLayer(this.layer);
|
||||
var that = this;
|
||||
this.exposePIXIDisplayObject(function (displayObject) {
|
||||
theLayer.removePIXIContainerChild(displayObject);
|
||||
theLayer.addChildToPIXIContainer(displayObject, that.zOrder);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -359,6 +364,33 @@ gdjs.RuntimeObject.prototype.isOnLayer = function(layer) {
|
||||
return this.layer === layer;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Set the Z order of the object.
|
||||
*
|
||||
* @method setZOrder
|
||||
* @param z {Number} The new Z order position of the object
|
||||
*/
|
||||
gdjs.RuntimeObject.prototype.setZOrder = function(z) {
|
||||
if ( z === this.zOrder ) return;
|
||||
this.zOrder = z;
|
||||
|
||||
var theLayer = this._runtimeScene.getLayer(this.layer);
|
||||
this.exposePIXIDisplayObject(function(displayObject) {
|
||||
theLayer.changePIXIContainerChildZOrder(displayObject, z);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the Z order of the object.
|
||||
*
|
||||
* @method getZOrder
|
||||
* @return {Number} The Z order of the object
|
||||
*/
|
||||
gdjs.RuntimeObject.prototype.getZOrder = function() {
|
||||
return this.zOrder;
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the container of the object variables
|
||||
* @method getVariables
|
||||
@@ -453,6 +485,7 @@ gdjs.RuntimeObject.prototype.hasVariable = function(name) {
|
||||
* @param enable {Boolean} Set it to true to hide the object, false to show it.
|
||||
*/
|
||||
gdjs.RuntimeObject.prototype.hide = function(enable) {
|
||||
if (enable === undefined) enable = true;
|
||||
this.hidden = enable;
|
||||
};
|
||||
|
||||
@@ -1017,13 +1050,6 @@ gdjs.RuntimeObject.collisionTest = function(obj1, obj2) {
|
||||
if ( Math.sqrt(x*x+y*y) > obj1BoundingRadius + obj2BoundingRadius )
|
||||
return false;
|
||||
|
||||
//Or if in circle are colliding
|
||||
var obj1MinEdge = Math.min(o1w, o1h)/2.0;
|
||||
var obj2MinEdge = Math.min(o2w, o2h)/2.0;
|
||||
|
||||
if ( x*x+y*y < obj1MinEdge*obj1MinEdge+2*obj1MinEdge*obj2MinEdge+obj2MinEdge*obj2MinEdge )
|
||||
return true;
|
||||
|
||||
//Do a real check if necessary.
|
||||
var hitBoxes1 = obj1.getHitBoxes();
|
||||
var hitBoxes2 = obj2.getHitBoxes();
|
||||
|
@@ -35,7 +35,6 @@ gdjs.RuntimeScene = function(runtimeGame, pixiRenderer)
|
||||
this._gameStopRequested = false;
|
||||
this._requestedScene = "";
|
||||
this._isLoaded = false; // True if loadFromScene was called and the scene is being played.
|
||||
this.layers = this._layers;
|
||||
this._allInstancesList = []; //An array used to create a list of all instance when necessary ( see _constructListOfAllInstances )
|
||||
this._instancesRemoved = []; //The instances removed from the scene and waiting to be sent to the cache.
|
||||
|
||||
@@ -201,6 +200,7 @@ gdjs.RuntimeScene.prototype.renderAndStep = function() {
|
||||
this._updateObjectsPreEvents();
|
||||
this._eventsFunction(this, this._eventsContext);
|
||||
this._updateObjects();
|
||||
this._updateObjectsVisibility();
|
||||
this.render();
|
||||
|
||||
this._firstFrame = false;
|
||||
@@ -240,6 +240,69 @@ gdjs.RuntimeScene.prototype._updateTime = function() {
|
||||
this._timeFromStart += this._elapsedTime;
|
||||
};
|
||||
|
||||
/**
|
||||
* Called to update visilibity of PIXI.DisplayObject of objects
|
||||
* rendered on the scene.
|
||||
*
|
||||
* Visibility is set to false if object is hidden, or if
|
||||
* object is too far from the camera of its layer ("culling").
|
||||
* @method _updateObjectsVisibility
|
||||
* @private
|
||||
*/
|
||||
gdjs.RuntimeScene.prototype._updateObjectsVisibility = function() {
|
||||
function hide(displayObject) {
|
||||
displayObject.visible = false;
|
||||
}
|
||||
|
||||
function show(displayObject) {
|
||||
displayObject.visible = true;
|
||||
}
|
||||
|
||||
if (this.isFirstFrame()) {
|
||||
this._constructListOfAllInstances();
|
||||
for( var i = 0, len = this._allInstancesList.length;i<len;++i) {
|
||||
var object = this._allInstancesList[i];
|
||||
|
||||
object.exposePIXIDisplayObject(object.isHidden() ? hide : show);
|
||||
}
|
||||
|
||||
return;
|
||||
} else {
|
||||
//After first frame, optimise rendering by setting only objects
|
||||
//near camera as visible.
|
||||
var allLayers = this._layers.entries();
|
||||
var layersCameraCoordinates = {};
|
||||
for(var i = 0;i < allLayers.length;++i) {
|
||||
var theLayer = allLayers[i][1];
|
||||
layersCameraCoordinates[allLayers[i][0]] =
|
||||
[theLayer.getCameraX() - theLayer.getCameraWidth(),
|
||||
theLayer.getCameraY() - theLayer.getCameraHeight(),
|
||||
theLayer.getCameraX() + theLayer.getCameraWidth(),
|
||||
theLayer.getCameraY() + theLayer.getCameraHeight()];
|
||||
}
|
||||
|
||||
this._constructListOfAllInstances();
|
||||
for( var i = 0, len = this._allInstancesList.length;i<len;++i) {
|
||||
var object = this._allInstancesList[i];
|
||||
var cameraCoords = layersCameraCoordinates[object.getLayer()];
|
||||
|
||||
if (!cameraCoords) continue;
|
||||
|
||||
if (object.isHidden()) {
|
||||
object.exposePIXIDisplayObject(hide);
|
||||
} else {
|
||||
var aabb = object.getAABB();
|
||||
if (aabb.min[0] > cameraCoords[2] || aabb.min[1] > cameraCoords[3] ||
|
||||
aabb.max[0] < cameraCoords[0] || aabb.max[1] < cameraCoords[1]) {
|
||||
object.exposePIXIDisplayObject(hide);
|
||||
} else {
|
||||
object.exposePIXIDisplayObject(show);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Empty the list of the removed objects:<br>
|
||||
* When an object is removed from the scene, it is still kept in the _instancesRemoved member
|
||||
|
@@ -160,7 +160,6 @@ gdjs.SpriteRuntimeObject = function(runtimeScene, objectData)
|
||||
this._blendMode = 0;
|
||||
this._flippedX = false;
|
||||
this._flippedY = false;
|
||||
this._runtimeScene = runtimeScene;
|
||||
this.opacity = 255;
|
||||
|
||||
//Animations:
|
||||
@@ -302,8 +301,8 @@ gdjs.SpriteRuntimeObject.prototype.updateTime = function(elapsedTime) {
|
||||
if ( this._spriteDirty ) this._updatePIXISprite();
|
||||
};
|
||||
|
||||
gdjs.SpriteRuntimeObject.prototype.onDeletedFromScene = function(runtimeScene) {
|
||||
runtimeScene.getLayer(this.layer).removePIXIContainerChild(this._sprite);
|
||||
gdjs.SpriteRuntimeObject.prototype.exposePIXIDisplayObject = function(cb) {
|
||||
cb(this._sprite);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -647,14 +646,6 @@ gdjs.SpriteRuntimeObject.prototype.hide = function(enable) {
|
||||
this._sprite.alpha = this._sprite.visible ? this.opacity / 255 : 0;
|
||||
};
|
||||
|
||||
gdjs.SpriteRuntimeObject.prototype.setLayer = function(name) {
|
||||
//We need to move the object from the pixi container of the layer
|
||||
//TODO: Pass the runtimeScene as parameter ?
|
||||
this._runtimeScene.getLayer(this.layer).removePIXIContainerChild(this._sprite);
|
||||
this.layer = name;
|
||||
this._runtimeScene.getLayer(this.layer).addChildToPIXIContainer(this._sprite, this.zOrder);
|
||||
};
|
||||
|
||||
/**
|
||||
* Change the tint of the sprite object.
|
||||
*
|
||||
@@ -759,20 +750,6 @@ gdjs.SpriteRuntimeObject.prototype.getScaleX = function() {
|
||||
|
||||
//Other :
|
||||
|
||||
/**
|
||||
* Set the Z order of the object.
|
||||
*
|
||||
* @method setZOrder
|
||||
* @param z {Number} The new Z order position of the object
|
||||
*/
|
||||
gdjs.SpriteRuntimeObject.prototype.setZOrder = function(z) {
|
||||
if ( z !== this.zOrder ) {
|
||||
//TODO: Pass the runtimeScene as parameter ?
|
||||
this._runtimeScene.getLayer(this.layer).changePIXIContainerChildZOrder(this._sprite, z);
|
||||
this.zOrder = z;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @method turnTowardObject
|
||||
* @param obj The target object
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1" ?>
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<project firstLayout="">
|
||||
<gdVersion build="76" major="3" minor="6" revision="0" />
|
||||
<properties linuxExecutableFilename="" macExecutableFilename="" useExternalSourceFiles="false" winExecutableFilename="" winExecutableIconFile="">
|
||||
<gdVersion build="86" major="4" minor="0" revision="0" />
|
||||
<properties folderProject="false" linuxExecutableFilename="" macExecutableFilename="" packageName="" useExternalSourceFiles="false" winExecutableFilename="" winExecutableIconFile="">
|
||||
<name>Project</name>
|
||||
<author></author>
|
||||
<windowWidth>800</windowWidth>
|
||||
@@ -42,6 +42,7 @@
|
||||
<resources>
|
||||
<resource alwaysLoaded="false" file="gem2z.png" kind="image" name="gem2z.png" smoothed="true" userAdded="false" />
|
||||
<resource alwaysLoaded="false" file="Block-Gel.png" kind="image" name="Block-Gel.png" smoothed="true" userAdded="true" />
|
||||
<resource alwaysLoaded="false" file="panelSprite.png" kind="image" name="panelSprite.png" smoothed="true" userAdded="true" />
|
||||
</resources>
|
||||
<resourceFolders />
|
||||
</resources>
|
||||
@@ -89,6 +90,16 @@
|
||||
<stringProperties />
|
||||
<initialVariables />
|
||||
</instance>
|
||||
<instance angle="0.000000" customSize="true" height="69.999969" layer="" locked="false" name="NewObject3" width="736.000000" x="29.000000" y="516.000000" zOrder="3">
|
||||
<numberProperties />
|
||||
<stringProperties />
|
||||
<initialVariables />
|
||||
</instance>
|
||||
<instance angle="0.000000" customSize="true" height="128.000000" layer="" locked="false" name="NewObject3" width="160.000000" x="612.000000" y="10.000000" zOrder="3">
|
||||
<numberProperties />
|
||||
<stringProperties />
|
||||
<initialVariables />
|
||||
</instance>
|
||||
</instances>
|
||||
<objects>
|
||||
<object bottomMargin="10.000000" height="64.000000" leftMargin="50.000000" name="NewObject" rightMargin="7.000000" texture="gem2z.png" topMargin="30.000000" type="PanelSpriteObject::PanelSprite" width="64.000000">
|
||||
@@ -99,6 +110,10 @@
|
||||
<variables />
|
||||
<behaviors />
|
||||
</object>
|
||||
<object bottomMargin="32.000000" height="32.000000" leftMargin="32.000000" name="NewObject3" rightMargin="32.000000" texture="panelSprite.png" topMargin="32.000000" type="PanelSpriteObject::PanelSprite" width="32.000000">
|
||||
<variables />
|
||||
<behaviors />
|
||||
</object>
|
||||
</objects>
|
||||
<events>
|
||||
<event disabled="false" folded="false">
|
||||
@@ -109,8 +124,8 @@
|
||||
<type inverted="false" value="AddForceVersPos" />
|
||||
<parameters>
|
||||
<parameter>NewObject2</parameter>
|
||||
<parameter>MouseX()</parameter>
|
||||
<parameter>MouseY()</parameter>
|
||||
<parameter>MouseX("",0)</parameter>
|
||||
<parameter>MouseY("",0)</parameter>
|
||||
<parameter>100</parameter>
|
||||
<parameter>0</parameter>
|
||||
</parameters>
|
||||
@@ -120,8 +135,8 @@
|
||||
<type inverted="false" value="RotateTowardPosition" />
|
||||
<parameters>
|
||||
<parameter>NewObject2</parameter>
|
||||
<parameter>MouseX()</parameter>
|
||||
<parameter>MouseY()</parameter>
|
||||
<parameter>MouseX("",0)</parameter>
|
||||
<parameter>MouseY("",0)</parameter>
|
||||
<parameter>90</parameter>
|
||||
<parameter></parameter>
|
||||
</parameters>
|
||||
|
BIN
GDJS/tests/games/panelSprite.png
Normal file
BIN
GDJS/tests/games/panelSprite.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.3 KiB |
Reference in New Issue
Block a user