mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-21 01:36:02 +08:00
So close, but alas must sleep :( 5am!
This commit is contained in:
parent
596b515e66
commit
9a0085c36b
@ -30,9 +30,10 @@
|
|||||||
<option id="gnu.cpp.compiler.mingw.exe.debug.option.optimization.level.1284147695" name="Optimization Level" superClass="gnu.cpp.compiler.mingw.exe.debug.option.optimization.level" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>
|
<option id="gnu.cpp.compiler.mingw.exe.debug.option.optimization.level.1284147695" name="Optimization Level" superClass="gnu.cpp.compiler.mingw.exe.debug.option.optimization.level" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>
|
||||||
<option id="gnu.cpp.compiler.mingw.exe.debug.option.debugging.level.1570084302" name="Debug Level" superClass="gnu.cpp.compiler.mingw.exe.debug.option.debugging.level" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/>
|
<option id="gnu.cpp.compiler.mingw.exe.debug.option.debugging.level.1570084302" name="Debug Level" superClass="gnu.cpp.compiler.mingw.exe.debug.option.debugging.level" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/>
|
||||||
<option id="gnu.cpp.compiler.option.include.paths.934414518" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath">
|
<option id="gnu.cpp.compiler.option.include.paths.934414518" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath">
|
||||||
<listOptionValue builtIn="false" value=""C:\Users\Nate\Desktop\SFML-2.0-rc\include""/>
|
<listOptionValue builtIn="false" value=""${workspace_loc:/spine-sfml/src}""/>
|
||||||
<listOptionValue builtIn="false" value=""${workspace_loc:/spine-c/include}""/>
|
|
||||||
<listOptionValue builtIn="false" value=""${workspace_loc:/spine-c/src}""/>
|
<listOptionValue builtIn="false" value=""${workspace_loc:/spine-c/src}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/spine-c/include}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""C:\Users\Nate\Desktop\SFML-2.0-rc\include""/>
|
||||||
</option>
|
</option>
|
||||||
<option id="gnu.cpp.compiler.option.warnings.allwarn.2053349441" name="All warnings (-Wall)" superClass="gnu.cpp.compiler.option.warnings.allwarn" value="true" valueType="boolean"/>
|
<option id="gnu.cpp.compiler.option.warnings.allwarn.2053349441" name="All warnings (-Wall)" superClass="gnu.cpp.compiler.option.warnings.allwarn" value="true" valueType="boolean"/>
|
||||||
<option id="gnu.cpp.compiler.option.preprocessor.def.1463772359" name="Defined symbols (-D)" superClass="gnu.cpp.compiler.option.preprocessor.def"/>
|
<option id="gnu.cpp.compiler.option.preprocessor.def.1463772359" name="Defined symbols (-D)" superClass="gnu.cpp.compiler.option.preprocessor.def"/>
|
||||||
|
|||||||
@ -24,7 +24,7 @@
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <spine/spine.h>
|
#include <spine/spine-sfml.h>
|
||||||
#include <SFML/Graphics.hpp>
|
#include <SFML/Graphics.hpp>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
@ -56,7 +56,7 @@ int main () {
|
|||||||
while (window.pollEvent(event))
|
while (window.pollEvent(event))
|
||||||
if (event.type == sf::Event::Closed) window.close();
|
if (event.type == sf::Event::Closed) window.close();
|
||||||
window.clear();
|
window.clear();
|
||||||
//window.draw(*skeleton);
|
window.draw(Skeleton_getDrawable(skeleton));
|
||||||
window.display();
|
window.display();
|
||||||
|
|
||||||
float delta = deltaClock.getElapsedTime().asSeconds();
|
float delta = deltaClock.getElapsedTime().asSeconds();
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
#include <spine/spine-sfml.h>
|
||||||
#include <spine/spine.h>
|
#include <spine/spine.h>
|
||||||
#include <spine/extension.h>
|
#include <spine/extension.h>
|
||||||
#include <spine/util.h>
|
#include <spine/util.h>
|
||||||
@ -17,11 +18,6 @@ using sf::VertexArray;
|
|||||||
|
|
||||||
namespace spine {
|
namespace spine {
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
AtlasPage super;
|
|
||||||
Texture *texture;
|
|
||||||
} SfmlAtlasPage;
|
|
||||||
|
|
||||||
void _SfmlAtlasPage_dispose (AtlasPage* page) {
|
void _SfmlAtlasPage_dispose (AtlasPage* page) {
|
||||||
SfmlAtlasPage* self = (SfmlAtlasPage*)page;
|
SfmlAtlasPage* self = (SfmlAtlasPage*)page;
|
||||||
_AtlasPage_deinit(&self->super);
|
_AtlasPage_deinit(&self->super);
|
||||||
@ -42,14 +38,13 @@ AtlasPage* AtlasPage_create (const char* name) {
|
|||||||
|
|
||||||
/**/
|
/**/
|
||||||
|
|
||||||
typedef struct {
|
void _SfmlSkeleton_dispose (Skeleton* skeleton) {
|
||||||
Skeleton super;
|
SfmlSkeleton* self = (SfmlSkeleton*)skeleton;
|
||||||
VertexArray* vertexArray;
|
_Skeleton_deinit(&self->super);
|
||||||
Texture* texture; // All region attachments must use the same texture.
|
|
||||||
} SfmlSkeleton;
|
delete self->vertexArray;
|
||||||
|
delete self->drawable;
|
||||||
|
|
||||||
void _SfmlSkeleton_dispose (Skeleton* self) {
|
|
||||||
_Skeleton_deinit(self);
|
|
||||||
FREE(self)
|
FREE(self)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,18 +53,30 @@ Skeleton* Skeleton_create (SkeletonData* data) {
|
|||||||
_Skeleton_init(&self->super, data);
|
_Skeleton_init(&self->super, data);
|
||||||
self->super._dispose = _SfmlSkeleton_dispose;
|
self->super._dispose = _SfmlSkeleton_dispose;
|
||||||
|
|
||||||
|
self->drawable = new SkeletonDrawable(&self->super);
|
||||||
self->vertexArray = new VertexArray(Quads, data->boneCount * 4);
|
self->vertexArray = new VertexArray(Quads, data->boneCount * 4);
|
||||||
|
|
||||||
return &self->super;
|
return &self->super;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**/
|
SkeletonDrawable& Skeleton_getDrawable (const Skeleton* self) {
|
||||||
|
return *((SfmlSkeleton*)self)->drawable;
|
||||||
|
}
|
||||||
|
|
||||||
typedef struct {
|
SkeletonDrawable::SkeletonDrawable (Skeleton* self) {
|
||||||
RegionAttachment super;
|
skeleton = (SfmlSkeleton*)self;
|
||||||
Vertex vertices[4];
|
}
|
||||||
Texture *texture;
|
|
||||||
} SfmlRegionAttachment;
|
void SkeletonDrawable::draw (RenderTarget& target, RenderStates states) const {
|
||||||
|
skeleton->vertexArray->clear();
|
||||||
|
for (int i = 0; i < skeleton->super.slotCount; ++i)
|
||||||
|
if (skeleton->super.slots[i]->attachment) ; //skeleton->slots[i]->attachment->draw(slots[i]);
|
||||||
|
// BOZO - Draw the slots!
|
||||||
|
states.texture = skeleton->texture;
|
||||||
|
target.draw(*skeleton->vertexArray, states);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**/
|
||||||
|
|
||||||
void _SfmlRegionAttachment_dispose (Attachment* self) {
|
void _SfmlRegionAttachment_dispose (Attachment* self) {
|
||||||
_RegionAttachment_deinit((RegionAttachment*)self);
|
_RegionAttachment_deinit((RegionAttachment*)self);
|
||||||
@ -109,7 +116,7 @@ RegionAttachment* RegionAttachment_create (const char* name, AtlasRegion* region
|
|||||||
return &self->super;
|
return &self->super;
|
||||||
}
|
}
|
||||||
|
|
||||||
void _RegionAttachment_draw (SfmlRegionAttachment* self, Slot *slot) {
|
void _RegionAttachment_draw (SfmlRegionAttachment* self, Slot* slot) {
|
||||||
SfmlSkeleton* skeleton = (SfmlSkeleton*)slot->skeleton;
|
SfmlSkeleton* skeleton = (SfmlSkeleton*)slot->skeleton;
|
||||||
Uint8 r = skeleton->super.r * slot->r * 255;
|
Uint8 r = skeleton->super.r * slot->r * 255;
|
||||||
Uint8 g = skeleton->super.g * slot->g * 255;
|
Uint8 g = skeleton->super.g * slot->g * 255;
|
||||||
|
|||||||
42
spine-sfml/src/spine/spine-sfml.h
Normal file
42
spine-sfml/src/spine/spine-sfml.h
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
#include <spine/spine.h>
|
||||||
|
#include <SFML/Graphics/Vertex.hpp>
|
||||||
|
#include <SFML/Graphics/VertexArray.hpp>
|
||||||
|
|
||||||
|
namespace spine {
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
AtlasPage super;
|
||||||
|
sf::Texture* texture;
|
||||||
|
} SfmlAtlasPage;
|
||||||
|
|
||||||
|
/**/
|
||||||
|
|
||||||
|
class SkeletonDrawable;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
Skeleton super;
|
||||||
|
sf::VertexArray* vertexArray;
|
||||||
|
sf::Texture* texture; // All region attachments must use the same texture.
|
||||||
|
SkeletonDrawable* drawable;
|
||||||
|
} SfmlSkeleton;
|
||||||
|
|
||||||
|
class SkeletonDrawable: public sf::Drawable {
|
||||||
|
public:
|
||||||
|
SfmlSkeleton* skeleton;
|
||||||
|
|
||||||
|
SkeletonDrawable (Skeleton* skeleton);
|
||||||
|
|
||||||
|
virtual void draw (sf::RenderTarget& target, sf::RenderStates states) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
SkeletonDrawable& Skeleton_getDrawable (const Skeleton* skeleton);
|
||||||
|
|
||||||
|
/**/
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
RegionAttachment super;
|
||||||
|
sf::Vertex vertices[4];
|
||||||
|
sf::Texture* texture;
|
||||||
|
} SfmlRegionAttachment;
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user