From: <at...@us...> - 2007-08-26 11:09:40
|
Revision: 493 http://cadcdev.svn.sourceforge.net/cadcdev/?rev=493&view=rev Author: atani Date: 2007-08-24 19:07:26 -0700 (Fri, 24 Aug 2007) Log Message: ----------- added Code::Blocks project/workspace for SDL build added new method: Request::setAuthentication() added Tiki::Net::Util::Base64 class fixed pngconf.h comment (astyle mangled it) removed old Tiki.xcode files (old XCode version) modified font.cpp to use macros from pch.h instead of TIKI_PLAT==TIKI_WIN32 blocks Modified Paths: -------------- tiki/3rdparty/libpng/pngconf.h tiki/include/Tiki/net/buffer.h tiki/include/Tiki/net/http/request.h tiki/include/Tiki/net/tcpsocket.h tiki/include/Tiki/net.h tiki/nds/Makefile tiki/sdl/Makefile tiki/sdl/src/init_shutdown.cpp tiki/sdl/src/platgl.cpp tiki/sdl/src/plathid.cpp tiki/sdl/src/platnet.cpp tiki/sdl/src/platthread.cpp tiki/sdl/src/tikitime.cpp tiki/src/gl/font.cpp tiki/src/net/http/request.cpp Added Paths: ----------- tiki/include/Tiki/net/util/ tiki/include/Tiki/net/util/base64.h tiki/sdl/TikiSDL.cbp tiki/sdl/TikiSDL.workspace tiki/src/net/util/ tiki/src/net/util/base64.cpp Removed Paths: ------------- tiki/osx/Tiki.xcode/ Modified: tiki/3rdparty/libpng/pngconf.h =================================================================== --- tiki/3rdparty/libpng/pngconf.h 2007-08-25 00:14:06 UTC (rev 492) +++ tiki/3rdparty/libpng/pngconf.h 2007-08-25 02:07:26 UTC (rev 493) @@ -29,7 +29,7 @@ /* * Added at libpng-1.2.8 - * + * * If you create a private DLL you need to define in "pngusr.h" the followings: * #define PNG_USER_PRIVATEBUILD <Describes by whom and why this version of * the DLL was built> @@ -40,8 +40,8 @@ * number and must match your private DLL name> * e.g. // private DLL "libpng13gx.dll" * #define PNG_USER_DLLFNAME_POSTFIX "gx" - * - * The following macros are also at your disposal if you want to complete the + * + * The following macros are also at your disposal if you want to complete the * DLL VERSIONINFO structure. * - PNG_USER_VERSIONINFO_COMMENTS * - PNG_USER_VERSIONINFO_COMPANYNAME @@ -129,9 +129,9 @@ * 'Cygwin' defines/defaults: * PNG_BUILD_DLL -- (ignored) building the dll * (no define) -- (ignored) building an application, linking to the dll - * PNG_STATIC -- (ignored) building the static lib, or building an + * PNG_STATIC -- (ignored) building the static lib, or building an * application that links to the static lib. - * ALL_STATIC -- (ignored) building various static libs, or building an + * ALL_STATIC -- (ignored) building various static libs, or building an * application that links to the static libs. * Thus, * a cygwin user should define either PNG_BUILD_DLL or PNG_STATIC, and @@ -144,12 +144,12 @@ * PNG_BUILD_DLL * PNG_STATIC * (nothing) == PNG_USE_DLL - * + * * CYGWIN (2002-01-20): The preceding is now obsolete. With the advent - * of auto-import in binutils, we no longer need to worry about + * of auto-import in binutils, we no longer need to worry about * __declspec(dllexport) / __declspec(dllimport) and friends. Therefore, * we don't need to worry about PNG_STATIC or ALL_STATIC when it comes - * to __declspec() stuff. However, we DO need to worry about + * to __declspec() stuff. However, we DO need to worry about * PNG_BUILD_DLL and PNG_STATIC because those change some defaults * such as CONSOLE_IO and whether GLOBAL_ARRAYS are allowed. */ @@ -212,7 +212,7 @@ */ #if defined(_WIN32_WCE) -# include <windows.h> +# include <windows.h> /* Console I/O functions are not supported on WindowsCE */ # define PNG_NO_CONSOLE_IO # ifdef PNG_DEBUG @@ -238,7 +238,7 @@ # endif # endif # else -# if !defined(_WIN32_WCE) +# if !defined(_WIN32_WCE) /* "stdio.h" functions are not supported on WindowsCE */ # include <stdio.h> # endif @@ -290,7 +290,7 @@ # define PNG_SETJMP_SUPPORTED #endif -#ifdef PNG_SETJMP_SUPPORTED +#ifdef PNG_SETJMP_SUPPORTED /* This is an attempt to force a single setjmp behaviour on Linux. If * the X config stuff didn't define _BSD_SOURCE we wouldn't need this. */ @@ -300,7 +300,7 @@ # define PNG_SAVE_BSD_SOURCE # undef _BSD_SOURCE # endif -# ifdef _SETJMP_H +# ifdef _SETJMP_H /* If you encounter a compiler error here, see the explanation * near the end of INSTALL. */ @@ -345,7 +345,7 @@ */ #if defined(PNG_FLOATING_POINT_SUPPORTED) -# if defined(MACOS) +# if defined(MACOS) /* We need to check that <math.h> hasn't already been included earlier * as it seems it doesn't agree with <fp.h>, yet we should really use * <fp.h> if possible. @@ -356,7 +356,7 @@ # else # include <math.h> # endif -# if defined(_AMIGA) && defined(__SASC) && defined(_M68881) +# if defined(_AMIGA) && defined(__SASC) && defined(_M68881) /* Amiga SAS/C: We must include builtin FPU functions when compiling using * MATH=68881 */ @@ -574,7 +574,7 @@ #if !defined(PNG_NO_PROGRESSIVE_READ) && \ !defined(PNG_PROGRESSIVE_READ_NOT_SUPPORTED) /* if you don't do progressive */ # define PNG_PROGRESSIVE_READ_SUPPORTED /* reading. This is not talking */ -#endif /* about interlacing capability! You'll */ +#endif /* about interlacing capability! You'll */ /* still have interlacing unless you change the following line: */ #define PNG_READ_INTERLACING_SUPPORTED /* required for PNG-compliant decoders */ @@ -633,11 +633,8 @@ # endif #endif /* PNG_WRITE_TRANSFORMS_SUPPORTED */ -#define PNG_WRITE_INTERLACING_SUPPORTED /* not required for PNG-compliant +#define PNG_WRITE_INTERLACING_SUPPORTED /* not required for PNG-compliant encoders, but can cause trouble if left undefined */ -encoders, but can cause trouble -if left undefined * / - #if !defined(PNG_NO_WRITE_WEIGHTED_FILTER) && \ defined(PNG_FLOATING_POINT_SUPPORTED) # define PNG_WRITE_WEIGHTED_FILTER_SUPPORTED @@ -1033,7 +1030,7 @@ /* need the time information for reading tIME chunks */ #if defined(PNG_tIME_SUPPORTED) -# if !defined(_WIN32_WCE) +# if !defined(_WIN32_WCE) /* "time.h" functions are not supported on WindowsCE */ # include <time.h> # endif @@ -1082,7 +1079,7 @@ # define LDATA 1 # else # define LDATA 0 -# endif +# endif /* GRR: why is Cygwin in here? Cygwin is not Borland C... */ # if !defined(__WIN32__) && !defined(__FLAT__) && !defined(__CYGWIN__) # define PNG_MAX_MALLOC_64K @@ -1091,7 +1088,7 @@ # define FAR __far # endif # define USE_FAR_KEYWORD -# endif /* LDATA != 1 */ +# endif /* LDATA != 1 */ /* Possibly useful for moving data out of default segment. * Uncomment it if you want. Could also define FARDATA as * const if your compiler supports it. (SJT) @@ -1168,7 +1165,7 @@ /* Pointers to pointers to pointers; i.e., pointer to array */ typedef char FAR * FAR * FAR * png_charppp; -#if defined(PNG_1_0_X) || defined(PNG_1_2_X) +#if defined(PNG_1_0_X) || defined(PNG_1_2_X) /* SPC - Is this stuff deprecated? */ /* It'll be removed as of libpng-1.3.0 - GR-P */ /* libpng typedefs for types in zlib. If zlib changes @@ -1200,7 +1197,7 @@ #if !defined(PNG_DLL) && (defined(PNG_BUILD_DLL) || defined(PNG_USE_DLL)) # define PNG_DLL -#endif +#endif /* If CYGWIN, then disallow GLOBAL ARRAYS unless building a static lib. * When building a static lib, default to no GLOBAL ARRAYS, but allow * command-line override @@ -1357,7 +1354,7 @@ (LIBPNG_WAS_COMPILED_WITH__PNG_SETJMP_NOT_SUPPORTED) #endif -#if defined(USE_FAR_KEYWORD) /* memory model independent fns */ +#if defined(USE_FAR_KEYWORD) /* memory model independent fns */ /* use this to make far-to-near assignments */ # define CHECK 1 # define NOCHECK 0 @@ -1378,7 +1375,7 @@ # define png_memcmp memcmp /* SJT: added */ # define png_memcpy memcpy # define png_memset memset -#endif +#endif /* End of memory model independent support */ /* Just a little check that someone hasn't tried to define something @@ -1389,7 +1386,7 @@ # define PNG_ZBUF_SIZE 65536L #endif -#ifdef PNG_READ_SUPPORTED +#ifdef PNG_READ_SUPPORTED /* Prior to libpng-1.0.9, this block was in pngasmrd.h */ #if defined(PNG_INTERNAL) @@ -1424,7 +1421,7 @@ # define PNG_HAVE_ASSEMBLER_COMBINE_ROW # define PNG_HAVE_ASSEMBLER_READ_INTERLACE # define PNG_HAVE_ASSEMBLER_READ_FILTER_ROW -#endif +#endif /* - see pnggccrd.c for info about what is currently enabled */ #endif /* PNG_INTERNAL */ Modified: tiki/include/Tiki/net/buffer.h =================================================================== --- tiki/include/Tiki/net/buffer.h 2007-08-25 00:14:06 UTC (rev 492) +++ tiki/include/Tiki/net/buffer.h 2007-08-25 02:07:26 UTC (rev 493) @@ -42,7 +42,7 @@ } Buffer(std::string filename, std::string contentType, std::string fieldName = "") : - m_fileName(filename), m_contentType(contentType), m_fieldName(fieldName) { + m_contentType(contentType), m_fileName(filename), m_fieldName(fieldName) { File file(filename, "rb"); read(file); file.close(); @@ -50,7 +50,7 @@ Buffer(Tiki::File file, std::string contentType, std::string fieldName = "") : m_contentType(contentType), m_fieldName(fieldName) { - read(file); + read(file); } void read(Tiki::File file) { @@ -86,9 +86,6 @@ } uint8 *getData() const { - if(m_usedDataLen > 0) { - m_data[m_usedDataLen] = '\0'; - } return m_data; } Modified: tiki/include/Tiki/net/http/request.h =================================================================== --- tiki/include/Tiki/net/http/request.h 2007-08-25 00:14:06 UTC (rev 492) +++ tiki/include/Tiki/net/http/request.h 2007-08-25 02:07:26 UTC (rev 493) @@ -8,13 +8,16 @@ #ifndef __TIKI_NET_HTTP_REQUEST_H #define __TIKI_NET_HTTP_REQUEST_H -#include "Tiki/refcnt.h" +#include "Tiki/refcnt.h" +#include "Tiki/net/util/base64.h" namespace Tiki { namespace Net { -namespace Http { +namespace Http { + +using Tiki::Net::Util::Base64; extern std::string DEFAULT_CONTENT_PART; @@ -33,7 +36,20 @@ } m_parts.clear(); } - */ + */ + + void setAuthentication(std::string username, std::string password) { + std::string param = username + ":" + password; + Buffer *inputBuf = new Buffer(param.length(), (uint8 *)param.c_str()); + + Base64 b64; + Buffer *result = b64.encode(inputBuf); + + setHeaderParam("Authorization", std::string("Basic ") + std::string((char *)result->getData())); + + delete inputBuf; + delete result; + } std::string getUrl() const { return m_url; Modified: tiki/include/Tiki/net/tcpsocket.h =================================================================== --- tiki/include/Tiki/net/tcpsocket.h 2007-08-25 00:14:06 UTC (rev 492) +++ tiki/include/Tiki/net/tcpsocket.h 2007-08-25 02:07:26 UTC (rev 493) @@ -34,9 +34,9 @@ TCPSocket() : Socket(), m_open(false) {}; TCPSocket(Address *address) : Socket(address), m_open(false) {}; #if TIKI_PLAT == TIKI_WIN32 - TCPSocket(Address *address, SOCKET socket) : Socket(address), m_socket(socket), m_open(true) {setNonBlocking(false);}; + TCPSocket(Address *address, SOCKET socket) : Socket(address), m_open(true), m_socket(socket) {setNonBlocking(false);}; #else - TCPSocket(RefPtr<Address> address, int socket) : Socket(address), m_socket(socket), m_open(true) {setNonBlocking(false);}; + TCPSocket(RefPtr<Address> address, int socket) : Socket(address), m_open(true), m_socket(socket) {setNonBlocking(false);}; #endif virtual void send(Buffer *data); Added: tiki/include/Tiki/net/util/base64.h =================================================================== --- tiki/include/Tiki/net/util/base64.h (rev 0) +++ tiki/include/Tiki/net/util/base64.h 2007-08-25 02:07:26 UTC (rev 493) @@ -0,0 +1,36 @@ +/* + Tiki + + base64.h + + Copyright (C)2007 Atani Software +*/ + +#ifndef __TIKI_BASE64_H +#define __TIKI_BASE64_H + +namespace Tiki { + namespace Net { + namespace Util { + + class Base64 { + public: + Buffer *encode(Buffer *source); + Buffer *decode(Buffer *source); + + private: + void encodeTriplet(uint8 *input, uint8 count, uint8 *output); + uint8 decodeQuartet(uint8 *input, uint8 *output); + size_t calcEncodeBufferSize(size_t byteCount); + size_t calcDecodeBufferSize(uint8 *input, size_t inputByteCount); + + static uint8 BASE64_ALPHABET[64]; + static uint8 BASE64_DEALPHABET[128]; + }; + + } + } + +} + +#endif // __TIKI_BASE64_H Modified: tiki/include/Tiki/net.h =================================================================== --- tiki/include/Tiki/net.h 2007-08-25 00:14:06 UTC (rev 492) +++ tiki/include/Tiki/net.h 2007-08-25 02:07:26 UTC (rev 493) @@ -31,3 +31,4 @@ #include "Tiki/net/tcpsocket.h" #include "Tiki/net/tcpserversocket.h" #include "Tiki/net/udpsocket.h" +#include "Tiki/net/util/base64.h" Modified: tiki/nds/Makefile =================================================================== --- tiki/nds/Makefile 2007-08-25 00:14:06 UTC (rev 492) +++ tiki/nds/Makefile 2007-08-25 02:07:26 UTC (rev 493) @@ -12,6 +12,7 @@ BASE_THREAD_OBJ=$(patsubst %.cpp,%.o,$(wildcard ../src/thread/*.cpp)) BASE_NET_OBJ=$(patsubst %.cpp,%.o,$(wildcard ../src/net/*.cpp)) BASE_NET_OBJ+=$(patsubst %.cpp,%.o,$(wildcard ../src/net/http/*.cpp)) +BASE_NET_OBJ+=$(patsubst %.cpp,%.o,$(wildcard ../src/net/util/*.cpp)) JPEG_OBJ=$(patsubst %.c,%.o,$(wildcard ../3rdparty/libjpeg/*.c)) PNG_OBJ=$(patsubst %.c,%.o,$(wildcard ../3rdparty/libpng/*.c)) Modified: tiki/sdl/Makefile =================================================================== --- tiki/sdl/Makefile 2007-08-25 00:14:06 UTC (rev 492) +++ tiki/sdl/Makefile 2007-08-25 02:07:26 UTC (rev 493) @@ -12,6 +12,7 @@ BASE_THREAD_OBJ=$(patsubst %.cpp,%.o,$(wildcard ../src/thread/*.cpp)) BASE_NET_OBJ=$(patsubst %.cpp,%.o,$(wildcard ../src/net/*.cpp)) BASE_NET_OBJ+=$(patsubst %.cpp,%.o,$(wildcard ../src/net/http/*.cpp)) +BASE_NET_OBJ+=$(patsubst %.cpp,%.o,$(wildcard ../src/net/util/*.cpp)) JPEG_OBJ=$(patsubst %.c,%.o,$(wildcard ../3rdparty/libjpeg/*.c)) PNG_OBJ=$(patsubst %.c,%.o,$(wildcard ../3rdparty/libpng/*.c)) Added: tiki/sdl/TikiSDL.cbp =================================================================== --- tiki/sdl/TikiSDL.cbp (rev 0) +++ tiki/sdl/TikiSDL.cbp 2007-08-25 02:07:26 UTC (rev 493) @@ -0,0 +1,548 @@ +<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> +<CodeBlocks_project_file> + <FileVersion major="1" minor="6" /> + <Project> + <Option title="TikiSDL" /> + <Option pch_mode="2" /> + <Option compiler="gcc" /> + <Build> + <Target title="Debug"> + <Option output="bin/Debug/libTikiSDL" prefix_auto="1" extension_auto="1" /> + <Option working_dir="" /> + <Option object_output="obj/Debug/" /> + <Option type="2" /> + <Option compiler="gcc" /> + <Option createDefFile="1" /> + <Compiler> + <Add option="-g" /> + </Compiler> + </Target> + <Target title="Release"> + <Option output="bin/Release/libTikiSDL" prefix_auto="1" extension_auto="1" /> + <Option working_dir="" /> + <Option object_output="obj/Release/" /> + <Option type="2" /> + <Option compiler="gcc" /> + <Option createDefFile="1" /> + <Compiler> + <Add option="-O2" /> + </Compiler> + <Linker> + <Add option="-s" /> + </Linker> + </Target> + </Build> + <Compiler> + <Add option="-Wall" /> + <Add option="`sdl-config --cflags`" /> + <Add directory="include" /> + <Add directory="../include" /> + <Add directory="../3rdparty/libjpeg" /> + <Add directory="../3rdparty/libogg/include" /> + <Add directory="../3rdparty/libpng" /> + <Add directory="../3rdparty/libvorbis/include" /> + <Add directory="../3rdparty/zlib" /> + <Add directory="../3rdparty/libvorbis/lib" /> + </Compiler> + <Unit filename="../3rdparty/libjpeg/jcapimin.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/libjpeg/jcapistd.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/libjpeg/jccoefct.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/libjpeg/jccolor.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/libjpeg/jcdctmgr.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/libjpeg/jchuff.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/libjpeg/jchuff.h" /> + <Unit filename="../3rdparty/libjpeg/jcinit.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/libjpeg/jcmainct.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/libjpeg/jcmarker.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/libjpeg/jcmaster.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/libjpeg/jcomapi.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/libjpeg/jconfig.h" /> + <Unit filename="../3rdparty/libjpeg/jcparam.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/libjpeg/jcphuff.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/libjpeg/jcprepct.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/libjpeg/jcsample.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/libjpeg/jctrans.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/libjpeg/jdapimin.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/libjpeg/jdapistd.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/libjpeg/jdatadst.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/libjpeg/jdatasrc.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/libjpeg/jdcoefct.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/libjpeg/jdcolor.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/libjpeg/jdct.h" /> + <Unit filename="../3rdparty/libjpeg/jddctmgr.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/libjpeg/jdhuff.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/libjpeg/jdhuff.h" /> + <Unit filename="../3rdparty/libjpeg/jdinput.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/libjpeg/jdmainct.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/libjpeg/jdmarker.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/libjpeg/jdmaster.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/libjpeg/jdmerge.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/libjpeg/jdphuff.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/libjpeg/jdpostct.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/libjpeg/jdsample.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/libjpeg/jdtrans.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/libjpeg/jerror.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/libjpeg/jerror.h" /> + <Unit filename="../3rdparty/libjpeg/jfdctflt.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/libjpeg/jfdctfst.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/libjpeg/jfdctint.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/libjpeg/jidctflt.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/libjpeg/jidctfst.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/libjpeg/jidctint.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/libjpeg/jidctred.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/libjpeg/jinclude.h" /> + <Unit filename="../3rdparty/libjpeg/jmemmgr.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/libjpeg/jmemnobs.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/libjpeg/jmemsys.h" /> + <Unit filename="../3rdparty/libjpeg/jmorecfg.h" /> + <Unit filename="../3rdparty/libjpeg/jpegint.h" /> + <Unit filename="../3rdparty/libjpeg/jpeglib.h" /> + <Unit filename="../3rdparty/libjpeg/jquant1.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/libjpeg/jquant2.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/libjpeg/jutils.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/libjpeg/jversion.h" /> + <Unit filename="../3rdparty/libogg/include/ogg/ogg.h" /> + <Unit filename="../3rdparty/libogg/include/ogg/os_types.h" /> + <Unit filename="../3rdparty/libogg/src/bitwise.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/libogg/src/framing.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/libpng/png.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/libpng/png.h" /> + <Unit filename="../3rdparty/libpng/pngconf.h" /> + <Unit filename="../3rdparty/libpng/pngerror.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/libpng/pnggccrd.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/libpng/pngget.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/libpng/pngmem.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/libpng/pngpread.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/libpng/pngread.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/libpng/pngrio.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/libpng/pngrtran.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/libpng/pngrutil.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/libpng/pngset.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/libpng/pngtrans.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/libpng/pngvcrd.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/libpng/pngwio.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/libpng/pngwrite.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/libpng/pngwtran.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/libpng/pngwutil.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/libvorbis/include/vorbis/codec.h" /> + <Unit filename="../3rdparty/libvorbis/include/vorbis/vorbisenc.h" /> + <Unit filename="../3rdparty/libvorbis/include/vorbis/vorbisfile.h" /> + <Unit filename="../3rdparty/libvorbis/lib/analysis.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/libvorbis/lib/backends.h" /> + <Unit filename="../3rdparty/libvorbis/lib/barkmel.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/libvorbis/lib/bitrate.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/libvorbis/lib/bitrate.h" /> + <Unit filename="../3rdparty/libvorbis/lib/block.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/libvorbis/lib/books/coupled/res_books_stereo.h" /> + <Unit filename="../3rdparty/libvorbis/lib/books/floor/floor_books.h" /> + <Unit filename="../3rdparty/libvorbis/lib/books/uncoupled/res_books_uncoupled.h" /> + <Unit filename="../3rdparty/libvorbis/lib/codebook.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/libvorbis/lib/codebook.h" /> + <Unit filename="../3rdparty/libvorbis/lib/codec_internal.h" /> + <Unit filename="../3rdparty/libvorbis/lib/envelope.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/libvorbis/lib/envelope.h" /> + <Unit filename="../3rdparty/libvorbis/lib/floor0.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/libvorbis/lib/floor1.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/libvorbis/lib/highlevel.h" /> + <Unit filename="../3rdparty/libvorbis/lib/info.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/libvorbis/lib/lookup.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/libvorbis/lib/lookup.h" /> + <Unit filename="../3rdparty/libvorbis/lib/lookup_data.h" /> + <Unit filename="../3rdparty/libvorbis/lib/lpc.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/libvorbis/lib/lpc.h" /> + <Unit filename="../3rdparty/libvorbis/lib/lsp.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/libvorbis/lib/lsp.h" /> + <Unit filename="../3rdparty/libvorbis/lib/mapping0.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/libvorbis/lib/masking.h" /> + <Unit filename="../3rdparty/libvorbis/lib/mdct.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/libvorbis/lib/mdct.h" /> + <Unit filename="../3rdparty/libvorbis/lib/misc.h" /> + <Unit filename="../3rdparty/libvorbis/lib/modes/floor_all.h" /> + <Unit filename="../3rdparty/libvorbis/lib/modes/psych_11.h" /> + <Unit filename="../3rdparty/libvorbis/lib/modes/psych_16.h" /> + <Unit filename="../3rdparty/libvorbis/lib/modes/psych_44.h" /> + <Unit filename="../3rdparty/libvorbis/lib/modes/psych_8.h" /> + <Unit filename="../3rdparty/libvorbis/lib/modes/residue_16.h" /> + <Unit filename="../3rdparty/libvorbis/lib/modes/residue_44.h" /> + <Unit filename="../3rdparty/libvorbis/lib/modes/residue_44u.h" /> + <Unit filename="../3rdparty/libvorbis/lib/modes/residue_8.h" /> + <Unit filename="../3rdparty/libvorbis/lib/modes/setup_11.h" /> + <Unit filename="../3rdparty/libvorbis/lib/modes/setup_16.h" /> + <Unit filename="../3rdparty/libvorbis/lib/modes/setup_22.h" /> + <Unit filename="../3rdparty/libvorbis/lib/modes/setup_32.h" /> + <Unit filename="../3rdparty/libvorbis/lib/modes/setup_44.h" /> + <Unit filename="../3rdparty/libvorbis/lib/modes/setup_44u.h" /> + <Unit filename="../3rdparty/libvorbis/lib/modes/setup_8.h" /> + <Unit filename="../3rdparty/libvorbis/lib/modes/setup_X.h" /> + <Unit filename="../3rdparty/libvorbis/lib/os.h" /> + <Unit filename="../3rdparty/libvorbis/lib/psy.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/libvorbis/lib/psy.h" /> + <Unit filename="../3rdparty/libvorbis/lib/registry.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/libvorbis/lib/registry.h" /> + <Unit filename="../3rdparty/libvorbis/lib/res0.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/libvorbis/lib/scales.h" /> + <Unit filename="../3rdparty/libvorbis/lib/sharedbook.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/libvorbis/lib/smallft.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/libvorbis/lib/smallft.h" /> + <Unit filename="../3rdparty/libvorbis/lib/synthesis.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/libvorbis/lib/vorbisenc.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/libvorbis/lib/vorbisfile.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/libvorbis/lib/window.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/libvorbis/lib/window.h" /> + <Unit filename="../3rdparty/zlib/adler32.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/zlib/compress.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/zlib/crc32.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/zlib/crc32.h" /> + <Unit filename="../3rdparty/zlib/deflate.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/zlib/deflate.h" /> + <Unit filename="../3rdparty/zlib/gzio.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/zlib/infback.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/zlib/inffast.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/zlib/inffast.h" /> + <Unit filename="../3rdparty/zlib/inffixed.h" /> + <Unit filename="../3rdparty/zlib/inflate.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/zlib/inflate.h" /> + <Unit filename="../3rdparty/zlib/inftrees.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/zlib/inftrees.h" /> + <Unit filename="../3rdparty/zlib/trees.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/zlib/trees.h" /> + <Unit filename="../3rdparty/zlib/uncompr.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/zlib/zconf.h" /> + <Unit filename="../3rdparty/zlib/zlib.h" /> + <Unit filename="../3rdparty/zlib/zutil.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../3rdparty/zlib/zutil.h" /> + <Unit filename="../include/Tiki/TikiAll.h" /> + <Unit filename="../include/Tiki/animation.h" /> + <Unit filename="../include/Tiki/anims/alphafader.h" /> + <Unit filename="../include/Tiki/anims/alpharotate.h" /> + <Unit filename="../include/Tiki/anims/expxymover.h" /> + <Unit filename="../include/Tiki/anims/logxymover.h" /> + <Unit filename="../include/Tiki/anims/sleep.h" /> + <Unit filename="../include/Tiki/anims/tintfader.h" /> + <Unit filename="../include/Tiki/bspline.h" /> + <Unit filename="../include/Tiki/color.h" /> + <Unit filename="../include/Tiki/color3.h" /> + <Unit filename="../include/Tiki/debug.h" /> + <Unit filename="../include/Tiki/drawable.h" /> + <Unit filename="../include/Tiki/drawables/banner.h" /> + <Unit filename="../include/Tiki/drawables/console.h" /> + <Unit filename="../include/Tiki/drawables/cursor.h" /> + <Unit filename="../include/Tiki/drawables/label.h" /> + <Unit filename="../include/Tiki/drawables/layer.h" /> + <Unit filename="../include/Tiki/drawables/pointerArrow.h" /> + <Unit filename="../include/Tiki/drawables/texturetile.h" /> + <Unit filename="../include/Tiki/endian.h" /> + <Unit filename="../include/Tiki/eventcollector.h" /> + <Unit filename="../include/Tiki/file.h" /> + <Unit filename="../include/Tiki/font.h" /> + <Unit filename="../include/Tiki/genmenu.h" /> + <Unit filename="../include/Tiki/gl.h" /> + <Unit filename="../include/Tiki/hid.h" /> + <Unit filename="../include/Tiki/image.h" /> + <Unit filename="../include/Tiki/imgjpg.h" /> + <Unit filename="../include/Tiki/imgpng.h" /> + <Unit filename="../include/Tiki/list.h" /> + <Unit filename="../include/Tiki/matrix.h" /> + <Unit filename="../include/Tiki/net.h" /> + <Unit filename="../include/Tiki/net/address.h" /> + <Unit filename="../include/Tiki/net/buffer.h" /> + <Unit filename="../include/Tiki/net/http/cookie.h" /> + <Unit filename="../include/Tiki/net/http/request.h" /> + <Unit filename="../include/Tiki/net/http/response.h" /> + <Unit filename="../include/Tiki/net/http/useragent.h" /> + <Unit filename="../include/Tiki/net/socket.h" /> + <Unit filename="../include/Tiki/net/tcpserversocket.h" /> + <Unit filename="../include/Tiki/net/tcpsocket.h" /> + <Unit filename="../include/Tiki/net/udpsocket.h" /> + <Unit filename="../include/Tiki/net/util/base64.h" /> + <Unit filename="../include/Tiki/object.h" /> + <Unit filename="../include/Tiki/oggvorbis.h" /> + <Unit filename="../include/Tiki/plxcompat.h" /> + <Unit filename="../include/Tiki/refcnt.h" /> + <Unit filename="../include/Tiki/scene.h" /> + <Unit filename="../include/Tiki/sound.h" /> + <Unit filename="../include/Tiki/stream.h" /> + <Unit filename="../include/Tiki/tee.h" /> + <Unit filename="../include/Tiki/texture.h" /> + <Unit filename="../include/Tiki/thread.h" /> + <Unit filename="../include/Tiki/tiki.h" /> + <Unit filename="../include/Tiki/tikimath.h" /> + <Unit filename="../include/Tiki/tikitime.h" /> + <Unit filename="../include/Tiki/timeline.h" /> + <Unit filename="../include/Tiki/timepoint.h" /> + <Unit filename="../include/Tiki/trigger.h" /> + <Unit filename="../include/Tiki/triggers/birth.h" /> + <Unit filename="../include/Tiki/triggers/chainanim.h" /> + <Unit filename="../include/Tiki/triggers/death.h" /> + <Unit filename="../include/Tiki/triggers/oneshot.h" /> + <Unit filename="../include/Tiki/vector.h" /> + <Unit filename="../include/Tiki/vector3.h" /> + <Unit filename="include/Tiki/glhdrs.h" /> + <Unit filename="include/Tiki/platnet.h" /> + <Unit filename="include/Tiki/platthread.h" /> + <Unit filename="include/Tiki/tikitypes.h" /> + <Unit filename="include/machine/endian.h" /> + <Unit filename="include/pch.h" /> + <Unit filename="include/sys/queue.h" /> + <Unit filename="src/init_shutdown.cpp" /> + <Unit filename="src/platgl.cpp" /> + <Unit filename="src/plathid.cpp" /> + <Unit filename="src/platnet.cpp" /> + <Unit filename="src/platthread.cpp" /> + <Unit filename="src/tikitime.cpp" /> + <Unit filename="../src/audio/oggvorbis/misc.h" /> + <Unit filename="../src/audio/oggvorbis/sndoggvorbis.cpp" /> + <Unit filename="../src/audio/sound.cpp" /> + <Unit filename="../src/audio/stream.cpp" /> + <Unit filename="../src/base/debug.cpp" /> + <Unit filename="../src/base/endian.cpp" /> + <Unit filename="../src/base/file.cpp" /> + <Unit filename="../src/base/object.cpp" /> + <Unit filename="../src/base/timeline.cpp" /> + <Unit filename="../src/base/timepoint.cpp" /> + <Unit filename="../src/gl/animation.cpp" /> + <Unit filename="../src/gl/anims/alphafader.cpp" /> + <Unit filename="../src/gl/anims/expxymover.cpp" /> + <Unit filename="../src/gl/anims/logxymover.cpp" /> + <Unit filename="../src/gl/anims/tintfader.cpp" /> + <Unit filename="../src/gl/drawable.cpp" /> + <Unit filename="../src/gl/drawables/banner.cpp" /> + <Unit filename="../src/gl/drawables/console.cpp" /> + <Unit filename="../src/gl/drawables/cursor.cpp" /> + <Unit filename="../src/gl/drawables/label.cpp" /> + <Unit filename="../src/gl/drawables/pointerArrow.cpp" /> + <Unit filename="../src/gl/drawables/texturetile.cpp" /> + <Unit filename="../src/gl/font.cpp" /> + <Unit filename="../src/gl/genmenu.cpp" /> + <Unit filename="../src/gl/gl.cpp" /> + <Unit filename="../src/gl/plxcompat.cpp" /> + <Unit filename="../src/gl/texture.cpp" /> + <Unit filename="../src/gl/trigger.cpp" /> + <Unit filename="../src/gl/triggers/birth.cpp" /> + <Unit filename="../src/gl/triggers/death.cpp" /> + <Unit filename="../src/hid/eventcollector.cpp" /> + <Unit filename="../src/hid/hid.cpp" /> + <Unit filename="../src/image/image.cpp" /> + <Unit filename="../src/image/loadjpg.cpp" /> + <Unit filename="../src/image/loadpng.cpp" /> + <Unit filename="../src/math/bspline.cpp" /> + <Unit filename="../src/math/math.cpp" /> + <Unit filename="../src/math/matrix.cpp" /> + <Unit filename="../src/math/vector.cpp" /> + <Unit filename="../src/math/vector3.cpp" /> + <Unit filename="../src/net/address.cpp" /> + <Unit filename="../src/net/http/request.cpp" /> + <Unit filename="../src/net/http/response.cpp" /> + <Unit filename="../src/net/http/useragent.cpp" /> + <Unit filename="../src/net/socket.cpp" /> + <Unit filename="../src/net/tcpserversocket.cpp" /> + <Unit filename="../src/net/tcpsocket.cpp" /> + <Unit filename="../src/net/util/base64.cpp" /> + <Unit filename="../src/thread/thread.cpp" /> + <Extensions> + <code_completion /> + <envvars /> + <debugger /> + </Extensions> + </Project> +</CodeBlocks_project_file> Added: tiki/sdl/TikiSDL.workspace =================================================================== --- tiki/sdl/TikiSDL.workspace (rev 0) +++ tiki/sdl/TikiSDL.workspace 2007-08-25 02:07:26 UTC (rev 493) @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> +<CodeBlocks_workspace_file> + <Workspace title="Workspace"> + <Project filename="TikiSDL.cbp" active="1" /> + </Workspace> +</CodeBlocks_workspace_file> Modified: tiki/sdl/src/init_shutdown.cpp =================================================================== --- tiki/sdl/src/init_shutdown.cpp 2007-08-25 00:14:06 UTC (rev 492) +++ tiki/sdl/src/init_shutdown.cpp 2007-08-25 02:07:26 UTC (rev 493) @@ -19,55 +19,44 @@ namespace Tiki { -bool init( int argc, char **argv ) { - ALCdevice * dev; - ALCcontext *context; - if ( SDL_Init( SDL_INIT_EVERYTHING | SDL_INIT_EVENTTHREAD | SDL_INIT_NOPARACHUTE ) < 0 ) { - fprintf( stderr, "Unable to initialize SDL: %s\n", SDL_GetError() ); - return false; + bool init( int argc, char **argv ) { + ALCdevice * dev; + ALCcontext *context; + if ( SDL_Init( SDL_INIT_EVERYTHING | SDL_INIT_EVENTTHREAD | SDL_INIT_NOPARACHUTE ) < 0 ) { + fprintf( stderr, "Unable to initialize SDL: %s\n", SDL_GetError() ); + return false; + } + + dev = alcOpenDevice( "sdl" ); + if ( dev == NULL ) { + fprintf( stderr, "Unable to initialize OpenAL: %s\n", alGetString( alGetError() ) ); + } else { + context = alcCreateContext( dev, NULL ); + if ( context == NULL ) { + fprintf( stderr, "alcCreateContext returned NULL: %s\n", alGetString( alGetError() ) ); + } else { + alcMakeContextCurrent( context ); + alcProcessContext( context ); + Audio::Sound::initGlobal(); + Audio::Stream::initGlobal(); + } + } + GL::Plxcompat::plx_mat3d_init( 640, 480 ); + return Hid::init(); } - dev = alcOpenDevice( "sdl" ); - if ( dev == NULL ) { - fprintf( stderr, "Unable to initialize OpenAL: %s\n", alGetError() ); - } else { - context = alcCreateContext( dev, NULL ); - if ( context == NULL ) { - fprintf( stderr, "alcCreateContext returned NULL: %s\n", alGetError() ); - } else { - alcMakeContextCurrent( context ); - alcProcessContext( context ); - Audio::Sound::initGlobal(); - Audio::Stream::initGlobal(); - } + void shutdown() { + Hid::shutdown(); } - GL::Plxcompat::plx_mat3d_init( 640, 480 ); - return Hid::init(); -} -void shutdown() { - Hid::shutdown(); -} + void setName( const char *windowName, const char *iconName ) { + SDL_WM_SetCaption( windowName, iconName ); + } -void setName( const char *windowName, const char *iconName ) { - SDL_WM_SetCaption( windowName, iconName ); -} + namespace GL { + void showCursor( bool visible ) { + SDL_ShowCursor( visible == true ); + } + } -namespace GL { -void showCursor( bool visible ) { - SDL_ShowCursor( visible == true ); } -} - -namespace Net { - -void init() -{ -} - -void shutdown() -{ -} -} - -} Modified: tiki/sdl/src/platgl.cpp =================================================================== --- tiki/sdl/src/platgl.cpp 2007-08-25 00:14:06 UTC (rev 492) +++ tiki/sdl/src/platgl.cpp 2007-08-25 02:07:26 UTC (rev 493) @@ -20,9 +20,9 @@ using namespace Tiki; static struct timeval lastFrame = { - 0, 0 - }; -static int targetFrameRate = 60, targetW = 640, targetH = 480; + 0, 0 + }; +static int targetFrameRate = 60; static uint64 firstFrame = 0; static uint64 frameCnt = 0, totalFrameCnt = 0; @@ -33,7 +33,7 @@ if ( cur == firstFrame ) return 0.0f; - return ( float ) ( ( frameCnt * 1000000.0 ) / ( cur - firstFrame ) ); + return ( float )(( frameCnt * 1000000.0 ) / ( cur - firstFrame ) ); } void Tiki::GL::Frame::setFrameRateLimit( int rate ) { @@ -42,50 +42,50 @@ extern "C" { - void tiki_wait_if_needed() { - // Every so often we should reset the frame counters, to avoid - // having a super long term averaging effect. - if ( frameCnt >= 500 ) { - firstFrame = 0; - frameCnt = 0; - } + void tiki_wait_if_needed() { + // Every so often we should reset the frame counters, to avoid + // having a super long term averaging effect. + if ( frameCnt >= 500 ) { + firstFrame = 0; + frameCnt = 0; + } - // Update frame counters. - if ( !firstFrame ) - firstFrame = Tiki::Time::gettime(); - frameCnt++; - totalFrameCnt++; + // Update frame counters. + if ( !firstFrame ) + firstFrame = Tiki::Time::gettime(); + frameCnt++; + totalFrameCnt++; - if ( lastFrame.tv_sec == 0 ) { + if ( lastFrame.tv_sec == 0 ) { + gettimeofday( &lastFrame, NULL ); + return ; + } + + struct timeval now; + gettimeofday( &now, NULL ); + long long nowu = (( long long ) now.tv_sec ) * 1000 * 1000 + now.tv_usec; + long long lastu = (( long long ) lastFrame.tv_sec ) * 1000 * 1000 + lastFrame.tv_usec; + long long diffu = nowu - lastu; + if ( diffu < ( 1000 * 1000 / targetFrameRate ) ) { + usleep(( 1000 * 1000 / targetFrameRate ) - diffu ); + } gettimeofday( &lastFrame, NULL ); - return ; } - struct timeval now; - gettimeofday( &now, NULL ); - long long nowu = ( ( long long ) now.tv_sec ) * 1000 * 1000 + now.tv_usec; - long long lastu = ( ( long long ) lastFrame.tv_sec ) * 1000 * 1000 + lastFrame.tv_usec; - long long diffu = nowu - lastu; - if ( diffu < ( 1000 * 1000 / targetFrameRate ) ) { - usleep( ( 1000 * 1000 / targetFrameRate ) - diffu ); + void tiki_scene_begin_hook() { + tiki_wait_if_needed(); } - gettimeofday( &lastFrame, NULL ); - } - void tiki_scene_begin_hook() { - tiki_wait_if_needed(); - } + void tiki_scene_finish_hook() { + SDL_GL_SwapBuffers(); + } - void tiki_scene_finish_hook() { - SDL_GL_SwapBuffers(); - } + void tiki_scene_begin_opaque_hook() {} - void tiki_scene_begin_opaque_hook() {} + void tiki_scene_finish_opaque_hook() {} - void tiki_scene_finish_opaque_hook() {} + void tiki_scene_begin_trans_hook() {} - void tiki_scene_begin_trans_hook() {} + void tiki_scene_finish_trans_hook() {} - void tiki_scene_finish_trans_hook() {} - -} + } Modified: tiki/sdl/src/plathid.cpp =================================================================== --- tiki/sdl/src/plathid.cpp 2007-08-25 00:14:06 UTC (rev 492) +++ tiki/sdl/src/plathid.cpp 2007-08-25 02:07:26 UTC (rev 493) @@ -8,46 +8,46 @@ using namespace Tiki::Hid; class KbDevice : public Device { -public: - KbDevice() { } - virtual ~KbDevice() { } + public: + KbDevice() { } + virtual ~KbDevice() { } - virtual Type getType() const { - return TypeKeyboard; - } - virtual string getName() const { - return "SDL Keyboard"; - } -}; + virtual Type getType() const { + return TypeKeyboard; + } + virtual string getName() const { + return "SDL Keyboard"; + } + }; class MouseDevice : public Device { -public: - MouseDevice() { } - virtual ~MouseDevice() { } + public: + MouseDevice() { } + virtual ~MouseDevice() { } - virtual Type getType() const { - return TypeMouse; - } - virtual string getName() const { - return "SDL Mouse"; - } + virtual Type getType() const { + return TypeMouse; + } + virtual string getName() const { + return "SDL Mouse"; + } - void moveXY( int x, int y ) { - abs_x += x; - abs_y += y; - } - void setXY( int x, int y ) { - abs_x = x; - abs_y = y; - } - void getXY( int *x, int *y ) { - *x = abs_x; - *y = abs_y; - } + void moveXY( int x, int y ) { + abs_x += x; + abs_y += y; + } + void setXY( int x, int y ) { + abs_x = x; + abs_y = y; + } + void getXY( int *x, int *y ) { + *x = abs_x; + *y = abs_y; + } -protected: - int abs_x, abs_y; -}; + protected: + int abs_x, abs_y; + }; static RefPtr<KbDevice> SDLkb; static RefPtr<MouseDevice> SDLMouse; @@ -75,9 +75,9 @@ sendEvent( evtMouse ); if ( SDL_SetVideoMode( 640, 480, 16, SDL_OPENGL ) == NULL ) { - fprintf( stderr, "Unable to Create OpenGL Window: %s\n", SDL_GetError() ); - return false; - } + fprintf( stderr, "Unable to Create OpenGL Window: %s\n", SDL_GetError() ); + return false; + } SDL_WarpMouse( 0, 0 ); @@ -91,12 +91,12 @@ glEnable( GL_BLEND ); glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ); glShadeModel( GL_SMOOTH ); // Enable Smooth Shading - glClearColor( 0.0f, 0.0f, 0.0f, 0.0f ); // Black Background + glClearColor( 0.0f, 0.0f, 0.0f, 0.0f ); // Black Background glClearDepth( 1.0f ); // Depth Buffer Setup glEnable( GL_DEPTH_TEST ); // Enables Depth Testing glDepthFunc( GL_LEQUAL ); // The Type Of Depth Testing To Do - glHint( GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST ); // Really Nice Perspective Calculations + glHint( GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST ); // Really Nice Perspective Calculations return true; } @@ -120,10 +120,10 @@ } extern "C" void TikiRecvQuit() { - done = 1; - Event evt( Event::EvtQuit ); - sendEvent( evt ); -} + done = 1; + Event evt( Event::EvtQuit ); + sendEvent( evt ); + } int HandleMouse( void *unused ) { SDL_Event events[ 10 ]; @@ -133,95 +133,95 @@ /* Handle mouse events here */ mask = ( SDL_MOUSEMOTIONMASK | SDL_MOUSEBUTTONDOWNMASK | SDL_MOUSEBUTTONUPMASK ); while ( ! done ) { - found = SDL_PeepEvents( events, 10, SDL_GETEVENT, mask ); - for ( i = 0; i < found; ++i ) { - switch ( events[ i ].type ) { - case SDL_MOUSEBUTTONDOWN: { - Event evt( Event::EvtBtnPress ); - evt.port = 0; - evt.dev = SDLMouse; - evt.btn = Event::MouseFirst + events[ i ].button.button - 1; - SDLMouse->getXY( &evt.x, &evt.y ); - sendEvent( evt ); + found = SDL_PeepEvents( events, 10, SDL_GETEVENT, mask ); + for ( i = 0; i < found; ++i ) { + switch ( events[ i ].type ) { + case SDL_MOUSEBUTTONDOWN: { + Event evt( Event::EvtBtnPress ); + evt.port = 0; + evt.dev = SDLMouse; + evt.btn = Event::MouseFirst + events[ i ].button.button - 1; + SDLMouse->getXY( &evt.x, &evt.y ); + sendEvent( evt ); + } + break; + case SDL_MOUSEBUTTONUP: { + Event evt( Event::EvtBtnRelease ); + evt.port = 0; + evt.dev = SDLMouse; + evt.btn = Event::MouseFirst + events[ i ].button.button - 1; + SDLMouse->getXY( &evt.x, &evt.y ); + sendEvent( evt ); + } + break; + case SDL_MOUSEMOTION: { + SDLMouse->moveXY( events[ i ].motion.xrel, events[ i ].motion.yrel ); + Event evt( Event::EvtMouseMove ); + evt.port = 0; + evt.dev = SDLMouse; + SDLMouse->getXY( &evt.x, &evt.y ); + sendEvent( evt ); + } + break; + } } - break; - case SDL_MOUSEBUTTONUP: { - Event evt( Event::EvtBtnRelease ); - evt.port = 0; - evt.dev = SDLMouse; - evt.btn = Event::MouseFirst + events[ i ].button.button - 1; - SDLMouse->getXY( &evt.x, &evt.y ); - sendEvent( evt ); - } - break; - case SDL_MOUSEMOTION: { - SDLMouse->moveXY( events[ i ].motion.xrel, events[ i ].motion.yrel ); - Event evt( Event::EvtMouseMove ); - evt.port = 0; - evt.dev = SDLMouse; - SDLMouse->getXY( &evt.x, &evt.y ); - sendEvent( evt ); - } - break; - } + /* Give up some CPU to allow events to arrive */ + SDL_Delay( 20 ); } - /* Give up some CPU to allow events to arrive */ - SDL_Delay( 20 ); - } return ( 0 ); } static int translateSym( SDLKey key ) { switch ( key ) { - case SDLK_UP: - return Event::KeyUp; - case SDLK_DOWN: - return Event::KeyDown; - case SDLK_LEFT: - return Event::KeyLeft; - case SDLK_RIGHT: - return Event::KeyRight; - case SDLK_INSERT: - return Event::KeyInsert; - case SDLK_DELETE: - return Event::KeyDelete; - case SDLK_HOME: - return Event::KeyHome; - case SDLK_END: - return Event::KeyEnd; - case SDLK_PAGEUP: - return Event::KeyPgup; - case SDLK_PAGEDOWN: - return Event::KeyPgdn; - case SDLK_ESCAPE: - return Event::KeyEsc; - case SDLK_F1: - return Event::KeyF1; - case SDLK_F2: - return Event::KeyF2; - case SDLK_F3: - return Event::KeyF3; - case SDLK_F4: - return Event::KeyF4; - case SDLK_F5: - return Event::KeyF5; - case SDLK_F6: - return Event::KeyF6; - case SDLK_F7: - return Event::KeyF7; - case SDLK_F8: - return Event::KeyF8; - case SDLK_F9: - return Event::KeyF9; - case SDLK_F10: - return Event::KeyF10; - case SDLK_F11: - return Event::KeyF11; - case SDLK_F12: - return Event::KeyF12; - default: - return key; - } + case SDLK_UP: + return Event::KeyUp; + case SDLK_DOWN: + return Event::KeyDown; + case SDLK_LEFT: + return Event::KeyLeft; + case SDLK_RIGHT: + return Event::KeyRight; + case SDLK_INSERT: + return Event::KeyInsert; + case SDLK_DELETE: + return Event::KeyDelete; + case SDLK_HOME: + return Event::KeyHome; + case SDLK_END: + return Event::KeyEnd; + case SDLK_PAGEUP: + return Event::KeyPgup; + case SDLK_PAGEDOWN: + return Event::KeyPgdn; + case SDLK_ESCAPE: + return Event::KeyEsc; + case SDLK_F1: + return Event::KeyF1; + case SDLK_F2: + return Event::KeyF2; + case SDLK_F3: + return Event::KeyF3; + case SDLK_F4: + return Event::KeyF4; + case SDLK_F5: + return Event::KeyF5; + case SDLK_F6: + return Event::KeyF6; + case SDLK_F7: + return Event::KeyF7; + case SDLK_F8: + return Event::KeyF8; + case SDLK_F9: + return Event::KeyF9; + case SDLK_F10: + return Event::KeyF10; + case SDLK_F11: + return Event::KeyF11; + case SDLK_F12: + return Event::KeyF12; + default: + return key; + } return key; } @@ -238,53 +238,53 @@ /* Handle mouse events here */ mask = ( SDL_KEYDOWNMASK | SDL_KEYUPMASK ); while ( ! done ) { - found = SDL_PeepEvents( events, 10, SDL_GETEVENT, mask ); - for ( i = 0; i < found; ++i ) { - if ( events[ i ].type == SDL_KEYDOWN ) { - mod = 0; + found = SDL_PeepEvents( events, 10, SDL_GETEVENT, mask ); + for ( i = 0; i < found; ++i ) { + if ( events[ i ].type == SDL_KEYDOWN ) { + mod = 0; - if ( events[ i ].key.keysym.mod & KMOD_SHIFT ) - mod |= Event::KeyShift; - if ( events[ i ].key.keysym.mod & KMOD_CTRL ) - mod |= Event::KeyControl; - if ( events[ i ].key.keysym.mod & KMOD_ALT ) - mod |= Event::KeyAlt; + if ( events[ i ].key.keysym.mod & KMOD_SHIFT ) + mod |= Event::KeyShift; + if ( events[ i ].key.keysym.mod & KMOD_CTRL ) + mod |= Event::KeyControl; + if ( events[ i ].key.keysym.mod & KMOD_ALT ) + mod |= Event::KeyAlt; - /* We want to toggle visibility on buttonpress */ + /* We want to toggle visibility on buttonpress */ - //Only keypress, not keydown, should repeat - if ( !( lastPressed.sym == events[ i ].key.keysym.sym && lastPressed.mod == events[ i ].key.keysym.mod ) ) { - Event evt( Event::EvtKeyDown ); - evt.dev = SDLkb; - evt.key = translateSym( events[ i ].key.keysym.sym ); - evt.mod = mod; - sendEvent( evt ); + //Only keypress, not keydown, should repeat + if ( !( lastPressed.sym == events[ i ].key.keysym.sym && lastPressed.mod == events[ i ].key.keysym.mod ) ) { + Event evt( Event::EvtKeyDown ); + evt.dev = SDLkb; + evt.key = translateSym( events[ i ].key.keysym.sym ); + evt.mod = mod; + sendEvent( evt ); - lastPressed.sym = events[ i ].key.keysym.sym; - lastPressed.mod = events[ i ].key.keysym.mod; - } + lastPressed.sym = events[ i ].key.keysym.sym; + lastPressed.mod = events[ i ].key.keysym.mod; + } - Event evtPress( Event::EvtKeypress ); - evtPress.dev = SDLkb; - evtPress.key = translateSym( events[ i ].key.keysym.sym ); - evtPress.mod = mod; - sendEvent( evtPress ); - //Debug::printf("HID:KB: KEYDOWN: %d\n", evt.key); - } else { - Event evt( Event::EvtKeyUp ); - evt.dev = SDLkb; - evt.key = translateSym( events[ i ].key.keysym.sym ); - evt.mod = mod; - sendEvent( evt ); - //Debug::printf("HID:KB: KEYUP: %d\n", evt.key); + Event evtPress( Event::EvtKeypress ); + evtPress.dev = SDLkb; + evtPress.key = translateSym( events[ i ].key.keysym.sym ); + evtPress.mod = mod; + sendEvent( evtPress ); + //Debug::printf("HID:KB: KEYDOWN: %d\n", evt.key); + } else { + Event evt( Event::EvtKeyUp ); + evt.dev = SDLkb; + evt.key = translateSym( events[ i ].key.keysym.sym ); + evt.mod = mod; + sendEvent( evt ); + //Debug::printf("HID:KB: KEYUP: %d\n", evt.key); - lastPressed.sym = ( SDLKey ) 0; - lastPressed.mod = ( SDLMod ) 0; - } + lastPressed.sym = ( SDLKey ) 0; + lastPressed.mod = ( SDLMod ) 0; + } + } + /* Give up some CPU to allow events to arrive */ + SDL_Delay( 20 ); } - /* Give up some CPU to allow events to arrive */ - SDL_Delay( 20 ); - } return ( 0 ); } @@ -296,19 +296,19 @@ /* Handle mouse events here */ mask = ( SDL_ACTIVEEVENTMASK | SDL_QUITMASK | SDL_SYSWMEVENTMASK ); while ( ! done ) { - found = SDL_PeepEvents( events, 10, SDL_GETEVENT, mask ); - for ( i = 0; i < found; ++i ) { - switch ( events[ i ].type ) { - /* We want to toggle visibility on buttonpress */ - case SDL_QUIT: - done = 1; - TikiRecvQuit(); - break; - } + found = SDL_PeepEvents( events, 10, SDL_GETEVENT, mask ); + for ( i = 0; i < found; ++i ) { + switch ( events[ i ].type ) { + /* We want to toggle visibility on buttonpress */ + case SDL_QUIT: + done = 1; + TikiRecvQuit(); + break; + } + } + /* Give up some CPU to allow events to arrive */ + SDL_Delay( 20 ); } - /* Give up some CPU to allow events to arrive */ - SDL_Delay( 20 ); - } return ( 0 ); } Modified: tiki/sdl/src/platnet.cpp =================================================================== --- tiki/sdl/src/platnet.cpp 2007-08-25 00:14:06 UTC (rev 492) +++ tiki/sdl/src/platnet.cpp 2007-08-25 02:07:26 UTC (rev 493) @@ -11,20 +11,21 @@ namespace Tiki { -namespace Net { + namespace Net { -void init() { -} + void init() { + } -void shutdown() { -} + void shutdown() { + } -bool connect() { -} + bool connect() { + return true; + } -void disconnect() { -} + void disconnect() { + } -} // namespace Net + } // namespace Net } // namespace Tiki Modified: tiki/sdl/src/platthread.cpp =================================================================== --- tiki/sdl/src/platthread.cpp 2007-08-25 00:14:06 UTC (rev 492) +++ tiki/sdl/src/platthread.cpp 2007-08-25 02:07:26 UTC (rev 493) @@ -19,7 +19,7 @@ using Tiki::Thread::mutex_t; using Tiki::Thread::cond_t; -bool Thread::create( pthread_t * out, void * ( *func ) ( void * ), void * param ) { +bool Thread::create( pthread_t * out, void * ( *func )( void * ), void * param ) { return pthread_create( out, NULL, func, param ) >= 0; } @@ -43,13 +43,13 @@ bool Thread::mutex_create( mutex_t * out ) { pthread_mutexattr_t attrs; if ( pthread_mutexattr_init( &attrs ) < 0 ) { - assert( false ); - return false; - } + assert( false ); + return false; + } if ( pthread_mutexattr_settype( &attrs, PTHREAD_MUTEX_RECURSIVE ) < 0 ) { - assert( false ); - return false; - } + assert( false ); + return false; + } int rv = pthread_mutex_init( out, &attrs ) >= 0; pthread_mutexattr_destroy( &attrs ); return rv; Modified: tiki/sdl/src/tikitime.cpp =================================================================== --- tiki/sdl/src/tikitime.cpp 2007-08-25 00:14:06 UTC (rev 492) +++ tiki/sdl/src/tikitime.cpp 2007-08-25 02:07:26 UTC (rev 493) @@ -24,7 +24,7 @@ } void Time::sleep( uint64 us ) { - usleep( ( unsigned int ) us ); + usleep(( unsigned int ) us ); } Modified: tiki/src/gl/font.cpp =================================================================== --- tiki/src/gl/font.cpp 2007-08-25 00:14:06 UTC (rev 492) +++ tiki/src/gl/font.cpp 2007-08-25 02:07:26 UTC (rev 493) @@ -39,9 +39,9 @@ /* Implementation notes... - + TXF Header (thanks to PLIB and gentexfont) - + BYTES WHAT ----------------------------- 4 0xff + 'txf' @@ -52,9 +52,9 @@ 4 maximum font ascent 4 maximum font descent 4 glyph count - + TXF Per-Glyph Data - + BYTES WHAT ----------------------------- 2 character index @@ -66,19 +66,17 @@ 1 char for padding 2 texture x for left of char 2 texture y for bottom of char - + We'll mimic PLIB here as far as handling the fonts: each u/v coord is offset by half a pixel (which provides a bit of an anti-aliasing effect) and all character sizes are scaled to 1 pixel high using the maximum font ascent. We then multiply this by the point size to get the real quad size. Additionally, we add to the X coordinate of the top of the glyph to achieve an oblique effect (it's not a proper italic...) - + */ -#if TIKI_PLAT==TIKI_WIN32 -#pragma pack(push,1) -#endif +PACKED_STRUCT_BEGIN typedef struct { uint8 magic[ 4 ] PACKED_STRUCT_MEMBER; uint32 endian PACKED_STRUCT_MEMBER; @@ -90,7 +88,9 @@ uint32 glyph_cnt PACKED_STRUCT_MEMBER; } txfhdr_t; +PACKED_STRUCT_END +PACKED_STRUCT_BEGIN typedef struct { int16 idx PACKED_STRUCT_MEMBER; int8 w PACKED_STRUCT_MEMBER; @@ -103,9 +103,7 @@ uint16 y PACKED_STRUCT_MEMBER; } txfglyph_t; -#if TIKI_PLAT==TIKI_WIN32 -#pragma pack(pop) -#endif +PACKED_STRUCT_END // These functions are used if the host and font endianness // do *not* match. Modified: tiki/src/net/http/request.cpp =================================================================== --- tiki/src/net/http/request.cpp 2007-08-25 00:14:06 UTC (rev 492) +++ tiki/src/net/http/request.cpp 2007-08-25 02:07:26 UTC (rev 493) @@ -35,7 +35,8 @@ if(!param.compare("User-Agent")) { Tiki::Debug::printf("Setting User-Agent via Request::setHeaderParam() is not allowed. Use HttpUserAgent::setUserAgentName() instead.\n"); return; - } + } + removeHeaderParam(param); m_params.insert(std::make_pair(param, value)); } @@ -59,16 +60,19 @@ return params; } -void Request::addContentPart(Buffer *input, std::string name) { - if(!name.empty()) { - m_parts.insert(std::make_pair(name, input)); +void Request::addContentPart(Buffer *input, std::string name) { + std::string partName = DEFAULT_CONTENT_PART; + if(!name.empty()) { + partName = name; } else if(!input->getFileName().empty()) { - m_parts.insert(std::make_pair(input->getFileName(), input)); - } - else { - m_parts.insert(std::make_pair(DEFAULT_CONTENT_PART, input)); - } + partName = input->getFileName(); + } + + if(m_parts.find(partName) != m_parts.end()) { + m_parts.erase(m_parts.find(partName)); + } + m_parts.insert(std::make_pair(partName, input)); } Buffer *Request::getContentPart(std::string name) const { Added: tiki/src/net/util/base64.cpp =================================================================== --- tiki/src/net/util/base64.cpp (rev 0) +++ tiki/src/net/util/base64.cpp 2007-08-25 02:07:26 UTC (rev 493) @@ -0,0 +1,235 @@ +/* + Tiki + + Base64.cpp + + Copyright (C)2007 Atani Software +*/ + +#include "pch.h" +#include "Tiki/tiki.h" +#include "Tiki/net.h" + +#include "Tiki/net/util/base64.h" + +#include <stdlib.h> +#include <math.h> +#include <memory.h> + +namespace Tiki { + + namespace Net { + + namespace Util { + using Tiki::Net::Buffer; + + uint8 Base64::BASE64_ALPHABET[] = { + 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', // 0 - 9 + 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', // 10 - 19 + 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', // 20 - 29 + 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', // 30 - 39 + 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', // 40 - 49 + 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', // 50 - 59 + '8', '9', '+', '/' // 60 - 63 + }; + + uint8 Base64::BASE64_DEALPHABET[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0 - 9 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 10 - 19 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 20 - 29 + ... [truncated message content] |