Added typed skel

This commit is contained in:
Josh Yelon 2007-02-09 21:46:03 +00:00
parent a0bc7707a6
commit e8a0cd972d
5 changed files with 179 additions and 3 deletions

View File

@ -17,6 +17,8 @@
////////////////////////////////////////////////////////////////////
#include "config_skel.h"
#include "basicSkel.h"
#include "typedSkel.h"
#include "dconfig.h"
Configure(config_skel);
@ -26,7 +28,7 @@ ConfigureFn(config_skel) {
init_libskel();
}
ConfigVariableInt skel_number_of_monkeys
ConfigVariableInt skel_sample_config_variable
("skel-sample-config-variable", 3);
////////////////////////////////////////////////////////////////////
@ -45,7 +47,6 @@ init_libskel() {
}
initialized = true;
// There's no initialization necessary for the skel library.
// But if there were, we would put it here.
TypedSkel::init_type();
}

View File

@ -1,2 +1,3 @@
#include "config_skel.cxx"
#include "basicSkel.cxx"
#include "typedSkel.cxx"

View File

@ -0,0 +1,56 @@
// Filename: typedSkel.I
// Created by: jyelon (31Jan07)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
//
// To contact the maintainers of this program write to
// panda3d-general@lists.sourceforge.net .
//
////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////
// Function: TypedSkel::Constructor
// Access: Public
// Description:
////////////////////////////////////////////////////////////////////
INLINE TypedSkel::
TypedSkel() {
}
////////////////////////////////////////////////////////////////////
// Function: TypedSkel::Destructor
// Access: Public
// Description:
////////////////////////////////////////////////////////////////////
INLINE TypedSkel::
~TypedSkel() {
}
////////////////////////////////////////////////////////////////////
// Function: TypedSkel::set_value
// Access: Public
// Description: Stores an integer value.
////////////////////////////////////////////////////////////////////
INLINE void TypedSkel::
set_value(int n) {
_value = n;
}
////////////////////////////////////////////////////////////////////
// Function: TypedSkel::get_value
// Access: Public
// Description: Retreives a value that was previously stored.
////////////////////////////////////////////////////////////////////
INLINE int TypedSkel::
get_value() {
return _value;
}

View File

@ -0,0 +1,45 @@
// Filename: typedSkel.cxx
// Created by: jyelon (31Jan07)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
//
// To contact the maintainers of this program write to
// panda3d-general@lists.sourceforge.net .
//
////////////////////////////////////////////////////////////////////
#include "typedSkel.h"
TypeHandle TypedSkel::_type_handle;
////////////////////////////////////////////////////////////////////
// Function: TypedSkel::set_value_alt
// Access: Public
// Description: Stores an integer value. Exact same functionality
// as set_value, except that this isn't an inline
// function.
////////////////////////////////////////////////////////////////////
void TypedSkel::
set_value_alt(int n) {
_value = n;
}
////////////////////////////////////////////////////////////////////
// Function: TypedSkel::get_value
// Access: Public
// Description: Retreives a value that was previously stored.
// Exact same functionality as get_value, except
// that this isn't an inline function.
////////////////////////////////////////////////////////////////////
int TypedSkel::
get_value_alt() {
return _value;
}

View File

@ -0,0 +1,73 @@
// Filename: typedSkel.h
// Created by: jyelon (31Jan07)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
//
// To contact the maintainers of this program write to
// panda3d-general@lists.sourceforge.net .
//
////////////////////////////////////////////////////////////////////
#ifndef TYPEDSKEL_H
#define TYPEDSKEL_H
#include "pandabase.h"
#include "typedObject.h"
////////////////////////////////////////////////////////////////////
// Class : TypedSkel
// Description : Skeleton object that inherits from TypedObject.
// Stores an integer, and will return it on request.
//
// The skeleton classes are intended to help you learn
// how to add C++ classes to panda. See also the manual,
// "Adding C++ Classes to Panda."
////////////////////////////////////////////////////////////////////
class EXPCL_PANDASKEL TypedSkel : public TypedObject {
PUBLISHED:
INLINE TypedSkel();
INLINE ~TypedSkel();
// These inline functions allow you to get and set _value.
INLINE void set_value(int n);
INLINE int get_value();
// These do the same thing as the functions above.
void set_value_alt(int n);
int get_value_alt();
private:
int _value;
public:
static TypeHandle get_class_type() {
return _type_handle;
}
static void init_type() {
TypedObject::init_type();
register_type(_type_handle, "TypedSkel",
TypedObject::get_class_type());
}
virtual TypeHandle get_type() const {
return get_class_type();
}
virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
private:
static TypeHandle _type_handle;
};
#include "typedSkel.I"
#endif