code with Texture compiles (untested)

This commit is contained in:
James Turk 2005-06-10 07:06:06 +00:00
parent 963152f55d
commit 7451b89ef4
8 changed files with 37 additions and 18 deletions

View File

@ -5,7 +5,7 @@
# James Turk (jpt2433@rit.edu) # James Turk (jpt2433@rit.edu)
# #
# Version: # Version:
# $Id: SConstruct,v 1.10 2005/05/15 02:51:51 cozman Exp $ # $Id: SConstruct,v 1.11 2005/06/10 07:06:06 cozman Exp $
import os,os.path import os,os.path
import glob import glob
@ -29,7 +29,7 @@ INC_FILES = getFilesMulti(INC_DIRS, '*.hpp')
libsMap = { libsMap = {
'nt':('opengl32','glu32','openal32'), 'nt':('opengl32','glu32','openal32'),
'posix':('GL','GLU','openal'), 'posix':('GL','GLU','openal'),
'mac':('GL','GLU','openal') } 'mac':('GL','GLU','openal')}
try: try:
OGL_LIB,GLU_LIB,OAL_LIB = libsMap[os.name] OGL_LIB,GLU_LIB,OAL_LIB = libsMap[os.name]
except KeyError: except KeyError:
@ -55,6 +55,9 @@ if not conf.CheckLibWithHeader(GLU_LIB, 'GL/glu.h', 'C++'):
if not conf.CheckLibWithHeader('glfw', 'GL/glfw.h', 'C++'): if not conf.CheckLibWithHeader('glfw', 'GL/glfw.h', 'C++'):
print 'GLFW not found, exiting.' print 'GLFW not found, exiting.'
Exit(1) Exit(1)
if not conf.CheckLibWithHeader('corona', 'corona.h', 'C++'):
print 'Corona not found, exiting.'
Exit(1)
env = conf.Finish() env = conf.Finish()
# Build the Super-Header # Build the Super-Header
@ -65,6 +68,7 @@ header.write('#define '+incGuard+'\n\n')
for inc in INC_FILES: for inc in INC_FILES:
header.write('#include "'+inc.replace('include/','')+'"\n') header.write('#include "'+inc.replace('include/','')+'"\n')
header.write('\n#endif // '+incGuard+'\n') header.write('\n#endif // '+incGuard+'\n')
header.close()
# Define Builds: # Define Builds:
BuildDir('build', 'src', duplicate=0) BuildDir('build', 'src', duplicate=0)

View File

@ -5,7 +5,7 @@
// James Turk (jpt2433@rit.edu) // James Turk (jpt2433@rit.edu)
// //
// Version: // Version:
// $Id: ResourceManaged.hpp,v 1.2 2005/06/10 05:48:59 cozman Exp $ // $Id: ResourceManaged.hpp,v 1.3 2005/06/10 07:06:06 cozman Exp $
#ifndef PHOTON_RESOURCEMANAGED_HPP #ifndef PHOTON_RESOURCEMANAGED_HPP
#define PHOTON_RESOURCEMANAGED_HPP #define PHOTON_RESOURCEMANAGED_HPP
@ -70,7 +70,7 @@ public:
// Function: cleanUp // Function: cleanUp
// Cleans up any unused resources of the type. // Cleans up any unused resources of the type.
// (Ex. Image::cleanUp() will unload all images.) // (Ex. Image::cleanUp() will unload all images.)
static virtual void cleanUp(); virtual void cleanUp();
// Function: addResource // Function: addResource
// Define a new named resource. // Define a new named resource.
@ -92,7 +92,7 @@ public:
// path - Path of resource data file. // path - Path of resource data file.
static void addResource(const std::string& path); static void addResource(const std::string& path);
private: protected:
static ResMgrT resMgr_; static ResMgrT resMgr_;
uint resID_; uint resID_;
}; };

View File

@ -5,7 +5,7 @@
// James Turk (jpt2433@rit.edu) // James Turk (jpt2433@rit.edu)
// //
// Version: // Version:
// $Id: ResourceManager.hpp,v 1.2 2005/06/10 05:48:59 cozman Exp $ // $Id: ResourceManager.hpp,v 1.3 2005/06/10 07:06:06 cozman Exp $
#ifndef PHOTON_RESOURCEMANAGER_HPP #ifndef PHOTON_RESOURCEMANAGER_HPP
#define PHOTON_RESOURCEMANAGER_HPP #define PHOTON_RESOURCEMANAGER_HPP
@ -54,13 +54,13 @@ public:
void cleanUp(); void cleanUp();
private: private:
virtual void loadResource(resT &res, const std::string& name)=0; virtual void loadResource(resT &res, const std::string& path)=0;
virtual void freeResource(resT &res)=0; virtual void freeResource(resT &res)=0;
uint newResource(const std::string& name, const std::string& path); uint newResource(const std::string& name, const std::string& path);
void deleteResource(uint id); void deleteResource(uint id);
private: protected:
std::vector<resT> resVec_; std::vector<resT> resVec_;
}; };
@ -101,7 +101,7 @@ template<class resT>
void ResourceManager<resT>::delRef(uint id) void ResourceManager<resT>::delRef(uint id)
{ {
// if decremented count is <= 0, delete resource // if decremented count is <= 0, delete resource
if(id < resVec_.size() && --resVec_[id].refcount <= 0) if(id < resVec_.size() && --resVec_[id].refCount <= 0)
{ {
deleteResource(id); deleteResource(id);
} }
@ -130,7 +130,7 @@ uint ResourceManager<resT>::newResource(const std::string& name,
try try
{ {
// attempt to load // attempt to load
loadResource(res, name, path); loadResource(res, path);
} }
catch(ResourceException&) catch(ResourceException&)
{ {

View File

@ -26,7 +26,9 @@
#include "util/FileBuffer.hpp" #include "util/FileBuffer.hpp"
#include "util/filesys/filesys.hpp" #include "util/filesys/filesys.hpp"
#include "video/Pen.hpp" #include "video/Pen.hpp"
#include "video/Texture.hpp"
#include "video/Color.hpp" #include "video/Color.hpp"
#include "video/TextureResourceManager.hpp"
#include "video/VideoCore.hpp" #include "video/VideoCore.hpp"
#endif // PHOTON_HPP #endif // PHOTON_HPP

View File

@ -5,7 +5,7 @@
// James Turk (jpt2433@rit.edu) // James Turk (jpt2433@rit.edu)
// //
// Version: // Version:
// $Id: FileBuffer.hpp,v 1.3 2005/03/03 09:25:20 cozman Exp $ // $Id: FileBuffer.hpp,v 1.4 2005/06/10 07:06:06 cozman Exp $
#ifndef PHOTON_UTIL_FILEBUFFER_HPP #ifndef PHOTON_UTIL_FILEBUFFER_HPP
#define PHOTON_UTIL_FILEBUFFER_HPP #define PHOTON_UTIL_FILEBUFFER_HPP
@ -64,14 +64,14 @@ public:
// Function: getData // Function: getData
// Loads an amount of data, returns a pointer to the loaded data. // Loads an amount of data, returns a pointer to the loaded data.
// If the requested amount of data wasn't available, returns only // If the requested amount of data wasn't available, returns only
// what could be loaded. // what could be loaded. If amount is 0 (default), returns entire buffer.
// //
// Parameters: // Parameters:
// amount - maximum amount of data to load // amount - maximum amount of data to load [default: 0]
// //
// Returns: // Returns:
// Vector containing loaded data, empty if nothing loaded. // Vector containing loaded data, empty if nothing loaded.
std::vector<ubyte> getData(int amount); std::vector<ubyte> getData(int amount=0);
// Function: getPosition // Function: getPosition
// Gets position of internal cursor inside data. // Gets position of internal cursor inside data.

View File

@ -4,7 +4,7 @@
<cloud/> <cloud/>
<font BOLD="true" NAME="SansSerif" SIZE="12"/> <font BOLD="true" NAME="SansSerif" SIZE="12"/>
<node ID="_" POSITION="right" TEXT="0.1 Release"> <node ID="_" POSITION="right" TEXT="0.1 Release">
<arrowlink DESTINATION="Freemind_Link_511487087" ENDARROW="Default" ENDINCLINATION="117;-117;" ID="Freemind_Arrow_Link_1969744902" STARTARROW="None" STARTINCLINATION="-97;-427;"/> <arrowlink DESTINATION="Freemind_Link_511487087" ENDARROW="Default" ENDINCLINATION="114;-120;" ID="Freemind_Arrow_Link_1969744902" STARTARROW="None" STARTINCLINATION="-94;-430;"/>
<font NAME="SansSerif" SIZE="12"/> <font NAME="SansSerif" SIZE="12"/>
<node ID="Freemind_Link_1613164220" TEXT="better SConstruct file"> <node ID="Freemind_Link_1613164220" TEXT="better SConstruct file">
<icon BUILTIN="button_ok"/> <icon BUILTIN="button_ok"/>
@ -40,7 +40,7 @@
<node ID="Freemind_Link_714736465" TEXT="Drawing Program?"/> <node ID="Freemind_Link_714736465" TEXT="Drawing Program?"/>
</node> </node>
</node> </node>
<node FOLDED="true" ID="Freemind_Link_486829238" POSITION="right" TEXT="0.2 Release"> <node ID="Freemind_Link_486829238" POSITION="right" TEXT="0.2 Release">
<node ID="Freemind_Link_216021234" TEXT="Sprite System"> <node ID="Freemind_Link_216021234" TEXT="Sprite System">
<font NAME="SansSerif" SIZE="12"/> <font NAME="SansSerif" SIZE="12"/>
</node> </node>
@ -78,5 +78,9 @@
</node> </node>
<node ID="Freemind_Link_1642641448" TEXT="Ensure compilation succeeds on Win/Linux simultaneously"/> <node ID="Freemind_Link_1642641448" TEXT="Ensure compilation succeeds on Win/Linux simultaneously"/>
</node> </node>
<node ID="Freemind_Link_682620075" POSITION="left" TEXT="Current Problems">
<font BOLD="true" NAME="SansSerif" SIZE="12"/>
<node ID="Freemind_Link_1953928405" TEXT="Tests do not seem to compile (since ResourceManagers)"/>
</node>
</node> </node>
</map> </map>

View File

@ -5,7 +5,7 @@
// James Turk (jpt2433@rit.edu) // James Turk (jpt2433@rit.edu)
// //
// Version: // Version:
// $Id: FileBuffer.cpp,v 1.4 2005/02/16 06:58:26 cozman Exp $ // $Id: FileBuffer.cpp,v 1.5 2005/06/10 07:06:06 cozman Exp $
#include "util/FileBuffer.hpp" #include "util/FileBuffer.hpp"
@ -50,6 +50,12 @@ std::vector<ubyte> FileBuffer::getData(int amount)
throw PreconditionException("No file open in FileBuffer::getData"); throw PreconditionException("No file open in FileBuffer::getData");
} }
// if amount is 0, read entire buffer
if(amount == 0)
{
amount = getSize();
}
std::vector<ubyte> buffer(amount); //create buffer std::vector<ubyte> buffer(amount); //create buffer
// try to read 'amount' bytes into buffer // try to read 'amount' bytes into buffer

View File

@ -5,9 +5,12 @@
// James Turk (jpt2433@rit.edu) // James Turk (jpt2433@rit.edu)
// //
// Version: // Version:
// $Id: exception_test.cpp,v 1.1 2005/05/15 02:50:07 cozman Exp $ // $Id: exception_test.cpp,v 1.2 2005/06/10 07:06:07 cozman Exp $
#include "photon.hpp" #include "photon.hpp"
#include "exceptions.hpp"
#include "entrypoint.hpp"
using namespace photon; using namespace photon;