mirror of
https://github.com/love2d/love-android.git
synced 2026-08-20 12:40:28 +02:00
updated to latest love-android (changeset 7b5f223900b)
This commit is contained in:
@@ -21,33 +21,31 @@
|
||||
// LOVE
|
||||
#include "Object.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
namespace love
|
||||
{
|
||||
|
||||
Object::Object()
|
||||
: count(1)
|
||||
{
|
||||
count.value = 1;
|
||||
}
|
||||
|
||||
Object::~Object()
|
||||
{
|
||||
}
|
||||
|
||||
int Object::getReferenceCount() const
|
||||
int Object::getReferenceCount()
|
||||
{
|
||||
return count;
|
||||
return SDL_AtomicGet(&count);
|
||||
}
|
||||
|
||||
void Object::retain()
|
||||
{
|
||||
++count;
|
||||
SDL_AtomicIncRef(&count);
|
||||
}
|
||||
|
||||
void Object::release()
|
||||
{
|
||||
if (--count <= 0)
|
||||
if (SDL_AtomicDecRef(&count))
|
||||
delete this;
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,13 @@
|
||||
#ifndef LOVE_OBJECT_H
|
||||
#define LOVE_OBJECT_H
|
||||
|
||||
/**
|
||||
* NOTE: the fact that an SDL header is included in such a widely used header
|
||||
* file is only temporary - in the LOVE 0.10+ codebase we use atomics from
|
||||
* C++11's standard library.
|
||||
**/
|
||||
#include <SDL_atomic.h>
|
||||
|
||||
namespace love
|
||||
{
|
||||
|
||||
@@ -50,7 +57,7 @@ public:
|
||||
* Gets the reference count of this Object.
|
||||
* @returns The reference count.
|
||||
**/
|
||||
int getReferenceCount() const;
|
||||
int getReferenceCount();
|
||||
|
||||
/**
|
||||
* Retains the Object, i.e. increases the
|
||||
@@ -155,7 +162,7 @@ public:
|
||||
private:
|
||||
|
||||
// The reference count.
|
||||
int count;
|
||||
SDL_atomic_t count;
|
||||
|
||||
}; // Object
|
||||
|
||||
|
||||
@@ -116,6 +116,7 @@
|
||||
# define LOVE_ENABLE_KEYBOARD_SDL
|
||||
# define LOVE_ENABLE_LOVE
|
||||
# define LOVE_ENABLE_LUASOCKET
|
||||
# define LOVE_ENABLE_LUAUTF8
|
||||
# define LOVE_ENABLE_MATH
|
||||
# define LOVE_ENABLE_MOUSE
|
||||
# define LOVE_ENABLE_MOUSE_SDL
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
|
||||
// LOVE
|
||||
#include "types.h"
|
||||
#include "Object.h"
|
||||
|
||||
// Lua
|
||||
extern "C" {
|
||||
@@ -40,6 +39,7 @@ namespace love
|
||||
{
|
||||
|
||||
// Forward declarations.
|
||||
class Object;
|
||||
class Module;
|
||||
class Reference;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user