|
From: <at...@us...> - 2006-06-15 16:56:56
|
Revision: 345 Author: atani Date: 2006-06-15 09:50:57 -0700 (Thu, 15 Jun 2006) ViewCVS: http://svn.sourceforge.net/cadcdev/?rev=345&view=rev Log Message: ----------- initial port to GP2x, makes use of Vincent OGL-ES library. What should work: basic OpenGL, threading Still to be done: input sound Next step will be todo some testing on the real device once I find someone with one who is willing to test things Added Paths: ----------- tiki/gp2x/ tiki/gp2x/Makefile tiki/gp2x/Makefile.rules tiki/gp2x/include/ tiki/gp2x/include/GLES/ tiki/gp2x/include/GLES/egl.h tiki/gp2x/include/GLES/egltypes.h tiki/gp2x/include/GLES/gl.h tiki/gp2x/include/GLES/glext.h tiki/gp2x/include/Tiki/ tiki/gp2x/include/Tiki/glhdrs.h tiki/gp2x/include/Tiki/platthread.h tiki/gp2x/include/Tiki/tikitypes.h tiki/gp2x/include/machine/ tiki/gp2x/include/machine/endian.h tiki/gp2x/include/minimal.h tiki/gp2x/include/minimal_940t.h tiki/gp2x/include/pch.h tiki/gp2x/include/sys/ tiki/gp2x/include/sys/queue.h tiki/gp2x/lib/ tiki/gp2x/lib/gles-license.txt tiki/gp2x/lib/libcodegen.a tiki/gp2x/lib/libgles_cm.a tiki/gp2x/src/ tiki/gp2x/src/Makefile tiki/gp2x/src/init_shutdown.cpp tiki/gp2x/src/platgl.cpp tiki/gp2x/src/plathid.cpp tiki/gp2x/src/platthread.cpp tiki/gp2x/src/rlyeh-minimal.cpp tiki/gp2x/src/tikitime.cpp Added: tiki/gp2x/Makefile =================================================================== --- tiki/gp2x/Makefile (rev 0) +++ tiki/gp2x/Makefile 2006-06-15 16:50:57 UTC (rev 345) @@ -0,0 +1,57 @@ + +BASE_AUDIO_OBJ=$(patsubst %.cpp,%.o,$(wildcard ../src/audio/*.cpp)) +BASE_AUDIO_OBJ+=$(patsubst %.cpp,%.o,$(wildcard ../src/audio/oggvorbis/*.cpp)) +BASE_BASE_OBJ=$(patsubst %.cpp,%.o,$(wildcard ../src/base/*.cpp)) +BASE_GL_OBJ=$(patsubst %.cpp,%.o,$(wildcard ../src/gl/*.cpp)) +BASE_GL_OBJ+=$(patsubst %.cpp,%.o,$(wildcard ../src/gl/anims/*.cpp)) +BASE_GL_OBJ+=$(patsubst %.cpp,%.o,$(wildcard ../src/gl/drawables/*.cpp)) +BASE_GL_OBJ+=$(patsubst %.cpp,%.o,$(wildcard ../src/gl/triggers/*.cpp)) +BASE_HID_OBJ=$(patsubst %.cpp,%.o,$(wildcard ../src/hid/*.cpp)) +BASE_IMAGE_OBJ=$(patsubst %.cpp,%.o,$(wildcard ../src/image/*.cpp)) +BASE_MATH_OBJ=$(patsubst %.cpp,%.o,$(wildcard ../src/math/*.cpp)) +BASE_THREAD_OBJ=$(patsubst %.cpp,%.o,$(wildcard ../src/thread/*.cpp)) + +JPEG_OBJ=$(patsubst %.c,%.o,$(wildcard ../3rdparty/libjpeg/*.c)) +PNG_OBJ=$(patsubst %.c,%.o,$(wildcard ../3rdparty/libpng/*.c)) +ZLIB_OBJ=$(patsubst %.c,%.o,$(wildcard ../3rdparty/zlib/*.c)) +OGG_OBJ=$(patsubst %.c,%.o,$(wildcard ../3rdparty/libogg/src/*.c)) +VORBIS_OBJ=../3rdparty/libvorbis/lib/analysis.o \ + ../3rdparty/libvorbis/lib/bitrate.o \ + ../3rdparty/libvorbis/lib/block.o \ + ../3rdparty/libvorbis/lib/codebook.o \ + ../3rdparty/libvorbis/lib/envelope.o \ + ../3rdparty/libvorbis/lib/floor0.o \ + ../3rdparty/libvorbis/lib/floor1.o \ + ../3rdparty/libvorbis/lib/info.o \ + ../3rdparty/libvorbis/lib/lookup.o \ + ../3rdparty/libvorbis/lib/lpc.o \ + ../3rdparty/libvorbis/lib/lsp.o \ + ../3rdparty/libvorbis/lib/mapping0.o \ + ../3rdparty/libvorbis/lib/mdct.o \ + ../3rdparty/libvorbis/lib/psy.o \ + ../3rdparty/libvorbis/lib/registry.o \ + ../3rdparty/libvorbis/lib/res0.o \ + ../3rdparty/libvorbis/lib/sharedbook.o \ + ../3rdparty/libvorbis/lib/smallft.o \ + ../3rdparty/libvorbis/lib/synthesis.o \ + ../3rdparty/libvorbis/lib/vorbisfile.o \ + ../3rdparty/libvorbis/lib/window.o + +BASE_OBJS = $(BASE_AUDIO_OBJ) $(BASE_BASE_OBJ) $(BASE_GL_OBJ) \ + $(BASE_HID_OBJ) $(BASE_IMAGE_OBJ) $(BASE_MATH_OBJ) \ + $(BASE_THREAD_OBJ) + +THIRD_PARTY_OBJS = $(JPEG_OBJ) $(OGG_OBJ) $(VORBIS_OBJ) $(PNG_OBJ) $(ZLIB_OBJ) + +CFLAGS=-I../include -I$(CURDIR)/include -g +CFLAGS+=-I../3rdparty/libogg/include -I../3rdparty/libvorbis/include -I../3rdparty/libvorbis/lib + +SUBDIRS=src + +all: subdirs $(BASE_OBJS) $(THIRD_PARTY_OBJS) + $(AR) ru libtiki.a $(BASE_OBJS) $(THIRD_PARTY_OBJS) + +clean: clean_subdirs + -rm -f $(BASE_OBJS) libtiki.a + +include Makefile.rules Property changes on: tiki/gp2x/Makefile ___________________________________________________________________ Name: svn:executable + * Added: tiki/gp2x/Makefile.rules =================================================================== --- tiki/gp2x/Makefile.rules (rev 0) +++ tiki/gp2x/Makefile.rules 2006-06-15 16:50:57 UTC (rev 345) @@ -0,0 +1,23 @@ +%.o: %.c + @echo "Compiling $< to $@" + @gcc $(CFLAGS) -c $< -o $@ + +%.o: %.cc + @echo "Compiling $< to $@" + @g++ $(CFLAGS) $(CXXFLAGS) -c $< -o $@ + +%.o: %.cpp + @echo "Compiling $< to $@" + @g++ $(CFLAGS) $(CXXFLAGS) -c $< -o $@ + +subdirs: $(patsubst %, _dir_%, $(SUBDIRS)) + +$(patsubst %, _dir_%, $(SUBDIRS)): + @$(MAKE) -C $(patsubst _dir_%, %, $@) + +clean_subdirs: $(patsubst %, _clean_dir_%, $(SUBDIRS)) + +$(patsubst %, _clean_dir_%, $(SUBDIRS)): + @$(MAKE) -C $(patsubst _clean_dir_%, %, $@) clean + +TIKI_BASE_LIBS=-ltiki -lcodegen -lgles_cm Property changes on: tiki/gp2x/Makefile.rules ___________________________________________________________________ Name: svn:executable + * Added: tiki/gp2x/include/GLES/egl.h =================================================================== --- tiki/gp2x/include/GLES/egl.h (rev 0) +++ tiki/gp2x/include/GLES/egl.h 2006-06-15 16:50:57 UTC (rev 345) @@ -0,0 +1,265 @@ +#ifndef __egl_h_ +#define __egl_h_ + +/* +** Copyright 2002-2003 Promoters of the Khronos Group (3Dlabs, ARM Ltd., +** ATI Technologies, Inc., Discreet, Ericsson Mobile, Imagination +** Technologies Group plc, Motorola, Inc., Nokia, Silicon Graphics, Inc., +** SK Telecom, and Sun Microsystems). +** +** This document is protected by copyright, and contains information +** proprietary to The Khronos Group. Any copying, adaptation, distribution, +** public performance, or public display of this document without the +** express written consent of the copyright holders is strictly prohibited. +** The receipt or possession of this document does not convey any rights to +** reproduce, disclose, or distribute its contents, or to manufacture, use, +** or sell anything that it may describe, in whole or in part. +*/ + +#include <GLES/gl.h> +#include <GLES/egltypes.h> + + +/* +** Versioning and extensions +*/ +#define EGL_VERSION_1_0 1 +#define EGL_VERSION_1_1 1 + +/* +** Boolean +*/ +#define EGL_FALSE 0 +#define EGL_TRUE 1 + +/* +** Errors +*/ +#define EGL_SUCCESS 0x3000 +#define EGL_NOT_INITIALIZED 0x3001 +#define EGL_BAD_ACCESS 0x3002 +#define EGL_BAD_ALLOC 0x3003 +#define EGL_BAD_ATTRIBUTE 0x3004 +#define EGL_BAD_CONFIG 0x3005 +#define EGL_BAD_CONTEXT 0x3006 +#define EGL_BAD_CURRENT_SURFACE 0x3007 +#define EGL_BAD_DISPLAY 0x3008 +#define EGL_BAD_MATCH 0x3009 +#define EGL_BAD_NATIVE_PIXMAP 0x300A +#define EGL_BAD_NATIVE_WINDOW 0x300B +#define EGL_BAD_PARAMETER 0x300C +#define EGL_BAD_SURFACE 0x300D +#define EGL_CONTEXT_LOST 0x300E +/* 0x300F - 0x301F reserved for additional errors. */ + +/* +** Config attributes +*/ +#define EGL_BUFFER_SIZE 0x3020 +#define EGL_ALPHA_SIZE 0x3021 +#define EGL_BLUE_SIZE 0x3022 +#define EGL_GREEN_SIZE 0x3023 +#define EGL_RED_SIZE 0x3024 +#define EGL_DEPTH_SIZE 0x3025 +#define EGL_STENCIL_SIZE 0x3026 +#define EGL_CONFIG_CAVEAT 0x3027 +#define EGL_CONFIG_ID 0x3028 +#define EGL_LEVEL 0x3029 +#define EGL_MAX_PBUFFER_HEIGHT 0x302A +#define EGL_MAX_PBUFFER_PIXELS 0x302B +#define EGL_MAX_PBUFFER_WIDTH 0x302C +#define EGL_NATIVE_RENDERABLE 0x302D +#define EGL_NATIVE_VISUAL_ID 0x302E +#define EGL_NATIVE_VISUAL_TYPE 0x302F +/*#define EGL_PRESERVED_RESOURCES 0x3030*/ +#define EGL_SAMPLES 0x3031 +#define EGL_SAMPLE_BUFFERS 0x3032 +#define EGL_SURFACE_TYPE 0x3033 +#define EGL_TRANSPARENT_TYPE 0x3034 +#define EGL_TRANSPARENT_BLUE_VALUE 0x3035 +#define EGL_TRANSPARENT_GREEN_VALUE 0x3036 +#define EGL_TRANSPARENT_RED_VALUE 0x3037 +#define EGL_NONE 0x3038 /* Also a config value */ +#define EGL_BIND_TO_TEXTURE_RGB 0x3039 +#define EGL_BIND_TO_TEXTURE_RGBA 0x303A +#define EGL_MIN_SWAP_INTERVAL 0x303B +#define EGL_MAX_SWAP_INTERVAL 0x303C + +/* +** Config values +*/ +#define EGL_DONT_CARE ((EGLint) -1) + +#define EGL_SLOW_CONFIG 0x3050 /* EGL_CONFIG_CAVEAT value */ +#define EGL_NON_CONFORMANT_CONFIG 0x3051 /* " */ +#define EGL_TRANSPARENT_RGB 0x3052 /* EGL_TRANSPARENT_TYPE value */ +#define EGL_NO_TEXTURE 0x305C /* EGL_TEXTURE_FORMAT/TARGET value */ +#define EGL_TEXTURE_RGB 0x305D /* EGL_TEXTURE_FORMAT value */ +#define EGL_TEXTURE_RGBA 0x305E /* " */ +#define EGL_TEXTURE_2D 0x305F /* EGL_TEXTURE_TARGET value */ + +/* +** Config attribute mask bits +*/ +#define EGL_PBUFFER_BIT 0x01 /* EGL_SURFACE_TYPE mask bit */ +#define EGL_PIXMAP_BIT 0x02 /* " */ +#define EGL_WINDOW_BIT 0x04 /* " */ + +/* +** String names +*/ +#define EGL_VENDOR 0x3053 /* eglQueryString target */ +#define EGL_VERSION 0x3054 /* " */ +#define EGL_EXTENSIONS 0x3055 /* " */ + +/* +** Surface attributes +*/ +#define EGL_HEIGHT 0x3056 +#define EGL_WIDTH 0x3057 +#define EGL_LARGEST_PBUFFER 0x3058 +#define EGL_TEXTURE_FORMAT 0x3080 /* For pbuffers bound as textures */ +#define EGL_TEXTURE_TARGET 0x3081 /* " */ +#define EGL_MIPMAP_TEXTURE 0x3082 /* " */ +#define EGL_MIPMAP_LEVEL 0x3083 /* " */ + +/* +** BindTexImage / ReleaseTexImage buffer target +*/ +#define EGL_BACK_BUFFER 0x3084 + +/* +** Current surfaces +*/ +#define EGL_DRAW 0x3059 +#define EGL_READ 0x305A + +/* +** Engines +*/ +#define EGL_CORE_NATIVE_ENGINE 0x305B + +/* 0x305C-0x3FFFF reserved for future use */ + +/* +** Functions +*/ +#ifdef __cplusplus +extern "C" { +#endif + +GLAPI EGLint APIENTRY eglGetError (void); + +GLAPI EGLDisplay APIENTRY eglGetDisplay (NativeDisplayType display); +GLAPI EGLBoolean APIENTRY eglInitialize (EGLDisplay dpy, EGLint *major, EGLint *minor); +GLAPI EGLBoolean APIENTRY eglTerminate (EGLDisplay dpy); +GLAPI const char * APIENTRY eglQueryString (EGLDisplay dpy, EGLint name); +GLAPI void (APIENTRY * eglGetProcAddress (const char *procname))(); + +GLAPI EGLBoolean APIENTRY eglGetConfigs (EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config); +GLAPI EGLBoolean APIENTRY eglChooseConfig (EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config); +GLAPI EGLBoolean APIENTRY eglGetConfigAttrib (EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value); + +GLAPI EGLSurface APIENTRY eglCreateWindowSurface (EGLDisplay dpy, EGLConfig config, NativeWindowType window, const EGLint *attrib_list); +GLAPI EGLSurface APIENTRY eglCreatePixmapSurface (EGLDisplay dpy, EGLConfig config, NativePixmapType pixmap, const EGLint *attrib_list); +GLAPI EGLSurface APIENTRY eglCreatePbufferSurface (EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list); +GLAPI EGLBoolean APIENTRY eglDestroySurface (EGLDisplay dpy, EGLSurface surface); +GLAPI EGLBoolean APIENTRY eglQuerySurface (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value); + +/* EGL 1.1 render-to-texture APIs */ +GLAPI EGLBoolean APIENTRY eglSurfaceAttrib (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value); +GLAPI EGLBoolean APIENTRY eglBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer); +GLAPI EGLBoolean APIENTRY eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer); + +/* EGL 1.1 swap control API */ +GLAPI EGLBoolean APIENTRY eglSwapInterval(EGLDisplay dpy, EGLint interval); + +GLAPI EGLContext APIENTRY eglCreateContext (EGLDisplay dpy, EGLConfig config, EGLContext share_list, const EGLint *attrib_list); +GLAPI EGLBoolean APIENTRY eglDestroyContext (EGLDisplay dpy, EGLContext ctx); +GLAPI EGLBoolean APIENTRY eglMakeCurrent (EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx); +GLAPI EGLContext APIENTRY eglGetCurrentContext (void); +GLAPI EGLSurface APIENTRY eglGetCurrentSurface (EGLint readdraw); +GLAPI EGLDisplay APIENTRY eglGetCurrentDisplay (void); +GLAPI EGLBoolean APIENTRY eglQueryContext (EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value); + +GLAPI EGLBoolean APIENTRY eglWaitGL (void); +GLAPI EGLBoolean APIENTRY eglWaitNative (EGLint engine); +GLAPI EGLBoolean APIENTRY eglSwapBuffers (EGLDisplay dpy, EGLSurface draw); +GLAPI EGLBoolean APIENTRY eglCopyBuffers (EGLDisplay dpy, EGLSurface surface, NativePixmapType target); + +#ifdef __cplusplus +} +#endif + +#endif /* ___egl_h_ */ + + + +/* usage + + // ---------------------------------------------------------------------- + // Initialization + // ---------------------------------------------------------------------- + + HDC hdc = GetDC(0); // the screen or window device context, for example + + EGLDisplay display = eglGetDisplay(hdc); + + EGLint major, minor; + + if (!eglInitialize(display, &major, &minor)) { + // could not initialize display + } + + EGLConfig configs[10]; + EGLint matchingConfigs; + EGLint attribList[] = { 0 }; // extend this + + if (!eglChooseConfig(display, attribList, &configs, 10, &matchingConfigs)) { + // could not choose config + } + + if (matchingConfigs < 1) { + // did not find a suitable configuration + } + + EGLConfig config = configs[0]; // pick any + + EGLSurface surface = eglCreatePbufferSurface(display, config, attribList); + + // test for error + + EGLContext context = eglCreateContext(display, config, 0, attribList); + + // test for error + + // ---------------------------------------------------------------------- + // Rendering Loop + // ---------------------------------------------------------------------- + + eglMakeCurrent(display, surface, surface, context); + + // actual GL rendering goes here + + eglWait(); + eglSwapBuffers(display, surface); + + // ---------------------------------------------------------------------- + // Cleanup + // ---------------------------------------------------------------------- + + + if (!eglDestoyContext(display, context)) { + // error deallocating context + } + + if (!eglDestroySurface(display, surface)) { + // error deallocating surface + } + + if (!eglTerminate(display)) { + // error while cleaning up display + } + + +*/ Added: tiki/gp2x/include/GLES/egltypes.h =================================================================== --- tiki/gp2x/include/GLES/egltypes.h (rev 0) +++ tiki/gp2x/include/GLES/egltypes.h 2006-06-15 16:50:57 UTC (rev 345) @@ -0,0 +1,100 @@ +#ifndef __egl_types_h_ +#define __egl_types_h_ + +/* +** egltypes.h is platform dependent. It defines: +** +** - EGL types and resources +** - Native types +** - EGL and native handle values +** +** EGL types and resources are to be typedef'ed with appropriate platform +** dependent resource handle types. EGLint must be an integer of at least +** 32-bit. +** +** NativeDisplayType, NativeWindowType and NativePixmapType are to be +** replaced with corresponding types of the native window system in egl.h. +** +** EGL and native handle values must match their types. +*/ + +#if (defined(WIN32) || defined(_WIN32_WCE)) + +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +#endif + +// Windows Header Files: +#include <windows.h> + +typedef HDC NativeDisplayType; +typedef HWND NativeWindowType; +typedef HBITMAP NativePixmapType; + +#define EGL_DEFAULT_DISPLAY GetDC(0) + +#elif defined(__SYMBIAN32__) + +#include <e32def.h> + +class RWindow; +class CWindowGc; +class CFbsBitmap; + +typedef CWindowGc * NativeDisplayType; +typedef RWindow * NativeWindowType; +typedef CFbsBitmap * NativePixmapType; + +#define EGL_DEFAULT_DISPLAY ((NativeDisplayType) 0) + +#elif defined(__gnu_linux__) + +typedef void * NativeDisplayType; +typedef void * NativeWindowType; +typedef void * NativePixmapType; + +#define EGL_DEFAULT_DISPLAY ((NativeDisplayType) 0) + +#else + +# error "Unsupported Operating System" + +#endif + +#ifdef __cplusplus + +namespace EGL { + class Context; + class Config; + class Surface; +} + +typedef const EGL::Config * EGLConfig; +typedef EGL::Surface * EGLSurface; +typedef EGL::Context * EGLContext; + +#else + +typedef void * EGLConfig; +typedef void * EGLSurface; +typedef void * EGLContext; + +#endif + + +/* +** Types and resources +*/ +typedef int EGLBoolean; +typedef int EGLint; +typedef void * EGLDisplay; + +/* +** EGL and native handle values +*/ +#define EGL_NO_CONTEXT ((EGLContext)0) +#define EGL_NO_DISPLAY ((EGLDisplay)0) +#define EGL_NO_SURFACE ((EGLSurface)0) + + +#endif //ndef __egl_types_h_ Added: tiki/gp2x/include/GLES/gl.h =================================================================== --- tiki/gp2x/include/GLES/gl.h (rev 0) +++ tiki/gp2x/include/GLES/gl.h 2006-06-15 16:50:57 UTC (rev 345) @@ -0,0 +1,861 @@ +#ifndef __gl_h_ +#define __gl_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.0 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +*/ + +#if defined(__SYMBIAN32__) + +# include <e32def.h> + +#elif (defined(WIN32) || defined(_WIN32_WCE)) /*&& !defined(APIENTRY) && !defined(__CYGWIN__)*/ + +# ifndef WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +# endif + +# include <windows.h> + +#elif defined(__gnu_linux__) + +# define GLAPI + +# ifdef APIENTRY +# undef APIENTRY +# endif + +#else + +# error "Unsupported Operating System" + +#endif + + +#ifndef APIENTRY +#define APIENTRY +#endif + +#ifndef GLAPI + #ifdef OGLES_EXPORTS + #define GLAPI __declspec(dllexport) + #else + #define GLAPI __declspec(dllimport) + #endif +#endif + +typedef unsigned int GLenum; +typedef unsigned char GLboolean; +typedef unsigned int GLbitfield; +typedef signed char GLbyte; +typedef short GLshort; +typedef int GLint; +typedef int GLsizei; +typedef unsigned char GLubyte; +typedef unsigned short GLushort; +typedef unsigned int GLuint; +typedef float GLfloat; +typedef float GLclampf; +typedef void GLvoid; +typedef int GLintptr; +typedef int GLsizeiptr; +typedef int GLfixed; +typedef int GLclampx; +/* Internal convenience typedefs */ +typedef void (*_GLfuncptr)(); + +/*************************************************************/ + +/* OpenGL ES core versions */ +#define GL_OES_VERSION_1_0 1 +#define GL_OES_VERSION_1_1 1 + +/* Extensions */ +#define GL_OES_compressed_paletted_texture 1 +/*#define GL_OES_draw_texture 1*/ +#define GL_OES_matrix_get 1 +/*#define GL_OES_matrix_palette 1*/ +#define GL_OES_point_size_array 1 +#define GL_OES_point_sprite 1 +#define GL_OES_read_format 1 + +/* ClearBufferMask */ +#define GL_DEPTH_BUFFER_BIT 0x00000100 +#define GL_STENCIL_BUFFER_BIT 0x00000400 +#define GL_COLOR_BUFFER_BIT 0x00004000 + +/* Boolean */ +#define GL_FALSE 0 +#define GL_TRUE 1 + +/* BeginMode */ +#define GL_POINTS 0x0000 +#define GL_LINES 0x0001 +#define GL_LINE_LOOP 0x0002 +#define GL_LINE_STRIP 0x0003 +#define GL_TRIANGLES 0x0004 +#define GL_TRIANGLE_STRIP 0x0005 +#define GL_TRIANGLE_FAN 0x0006 + +/* AlphaFunction */ +#define GL_NEVER 0x0200 +#define GL_LESS 0x0201 +#define GL_EQUAL 0x0202 +#define GL_LEQUAL 0x0203 +#define GL_GREATER 0x0204 +#define GL_NOTEQUAL 0x0205 +#define GL_GEQUAL 0x0206 +#define GL_ALWAYS 0x0207 + +/* BlendingFactorDest */ +#define GL_ZERO 0 +#define GL_ONE 1 +#define GL_SRC_COLOR 0x0300 +#define GL_ONE_MINUS_SRC_COLOR 0x0301 +#define GL_SRC_ALPHA 0x0302 +#define GL_ONE_MINUS_SRC_ALPHA 0x0303 +#define GL_DST_ALPHA 0x0304 +#define GL_ONE_MINUS_DST_ALPHA 0x0305 + +/* BlendingFactorSrc */ +/* GL_ZERO */ +/* GL_ONE */ +#define GL_DST_COLOR 0x0306 +#define GL_ONE_MINUS_DST_COLOR 0x0307 +#define GL_SRC_ALPHA_SATURATE 0x0308 +/* GL_SRC_ALPHA */ +/* GL_ONE_MINUS_SRC_ALPHA */ +/* GL_DST_ALPHA */ +/* GL_ONE_MINUS_DST_ALPHA */ + +/* ClipPlaneName */ +#define GL_CLIP_PLANE0 0x3000 +#define GL_CLIP_PLANE1 0x3001 +#define GL_CLIP_PLANE2 0x3002 +#define GL_CLIP_PLANE3 0x3003 +#define GL_CLIP_PLANE4 0x3004 +#define GL_CLIP_PLANE5 0x3005 + +/* ColorMaterialFace */ +/* GL_FRONT_AND_BACK */ + +/* ColorMaterialParameter */ +/* GL_AMBIENT_AND_DIFFUSE */ + +/* ColorPointerType */ +/* GL_UNSIGNED_BYTE */ +/* GL_FLOAT */ +/* GL_FIXED */ + +/* CullFaceMode */ +#define GL_FRONT 0x0404 +#define GL_BACK 0x0405 +#define GL_FRONT_AND_BACK 0x0408 + +/* DepthFunction */ +/* GL_NEVER */ +/* GL_LESS */ +/* GL_EQUAL */ +/* GL_LEQUAL */ +/* GL_GREATER */ +/* GL_NOTEQUAL */ +/* GL_GEQUAL */ +/* GL_ALWAYS */ + +/* EnableCap */ +#define GL_FOG 0x0B60 +#define GL_LIGHTING 0x0B50 +#define GL_TEXTURE_2D 0x0DE1 +#define GL_CULL_FACE 0x0B44 +#define GL_ALPHA_TEST 0x0BC0 +#define GL_BLEND 0x0BE2 +#define GL_COLOR_LOGIC_OP 0x0BF2 +#define GL_DITHER 0x0BD0 +#define GL_STENCIL_TEST 0x0B90 +#define GL_DEPTH_TEST 0x0B71 +/* GL_LIGHT0 */ +/* GL_LIGHT1 */ +/* GL_LIGHT2 */ +/* GL_LIGHT3 */ +/* GL_LIGHT4 */ +/* GL_LIGHT5 */ +/* GL_LIGHT6 */ +/* GL_LIGHT7 */ +#define GL_POINT_SMOOTH 0x0B10 +#define GL_LINE_SMOOTH 0x0B20 +#define GL_SCISSOR_TEST 0x0C11 +#define GL_COLOR_MATERIAL 0x0B57 +#define GL_NORMALIZE 0x0BA1 +#define GL_RESCALE_NORMAL 0x803A +#define GL_POLYGON_OFFSET_FILL 0x8037 +#define GL_VERTEX_ARRAY 0x8074 +#define GL_NORMAL_ARRAY 0x8075 +#define GL_COLOR_ARRAY 0x8076 +#define GL_TEXTURE_COORD_ARRAY 0x8078 +#define GL_MULTISAMPLE 0x809D +#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E +#define GL_SAMPLE_ALPHA_TO_ONE 0x809F +#define GL_SAMPLE_COVERAGE 0x80A0 + +/* ErrorCode */ +#define GL_NO_ERROR 0 +#define GL_INVALID_ENUM 0x0500 +#define GL_INVALID_VALUE 0x0501 +#define GL_INVALID_OPERATION 0x0502 +#define GL_STACK_OVERFLOW 0x0503 +#define GL_STACK_UNDERFLOW 0x0504 +#define GL_OUT_OF_MEMORY 0x0505 + +/* FogMode */ +/* GL_LINEAR */ +#define GL_EXP 0x0800 +#define GL_EXP2 0x0801 + +/* FogParameter */ +#define GL_FOG_DENSITY 0x0B62 +#define GL_FOG_START 0x0B63 +#define GL_FOG_END 0x0B64 +#define GL_FOG_MODE 0x0B65 +#define GL_FOG_COLOR 0x0B66 + +/* FrontFaceDirection */ +#define GL_CW 0x0900 +#define GL_CCW 0x0901 + +/* GetPName */ +#define GL_CURRENT_COLOR 0x0B00 +#define GL_CURRENT_NORMAL 0x0B02 +#define GL_CURRENT_TEXTURE_COORDS 0x0B03 +#define GL_POINT_SIZE 0x0B11 +#define GL_POINT_SIZE_MIN 0x8126 +#define GL_POINT_SIZE_MAX 0x8127 +#define GL_POINT_FADE_THRESHOLD_SIZE 0x8128 +#define GL_POINT_DISTANCE_ATTENUATION 0x8129 +#define GL_SMOOTH_POINT_SIZE_RANGE 0x0B12 +#define GL_LINE_WIDTH 0x0B21 +#define GL_SMOOTH_LINE_WIDTH_RANGE 0x0B22 +#define GL_ALIASED_POINT_SIZE_RANGE 0x846D +#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E +#define GL_CULL_FACE_MODE 0x0B45 +#define GL_FRONT_FACE 0x0B46 +#define GL_SHADE_MODEL 0x0B54 +#define GL_DEPTH_RANGE 0x0B70 +#define GL_DEPTH_WRITEMASK 0x0B72 +#define GL_DEPTH_CLEAR_VALUE 0x0B73 +#define GL_DEPTH_FUNC 0x0B74 +#define GL_STENCIL_CLEAR_VALUE 0x0B91 +#define GL_STENCIL_FUNC 0x0B92 +#define GL_STENCIL_VALUE_MASK 0x0B93 +#define GL_STENCIL_FAIL 0x0B94 +#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95 +#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96 +#define GL_STENCIL_REF 0x0B97 +#define GL_STENCIL_WRITEMASK 0x0B98 +#define GL_MATRIX_MODE 0x0BA0 +#define GL_VIEWPORT 0x0BA2 +#define GL_MODELVIEW_STACK_DEPTH 0x0BA3 +#define GL_PROJECTION_STACK_DEPTH 0x0BA4 +#define GL_TEXTURE_STACK_DEPTH 0x0BA5 +#define GL_MODELVIEW_MATRIX 0x0BA6 +#define GL_PROJECTION_MATRIX 0x0BA7 +#define GL_TEXTURE_MATRIX 0x0BA8 +#define GL_ALPHA_TEST_FUNC 0x0BC1 +#define GL_ALPHA_TEST_REF 0x0BC2 +#define GL_BLEND_DST 0x0BE0 +#define GL_BLEND_SRC 0x0BE1 +#define GL_LOGIC_OP_MODE 0x0BF0 +#define GL_SCISSOR_BOX 0x0C10 +#define GL_SCISSOR_TEST 0x0C11 +#define GL_COLOR_CLEAR_VALUE 0x0C22 +#define GL_COLOR_WRITEMASK 0x0C23 +#define GL_UNPACK_ALIGNMENT 0x0CF5 +#define GL_PACK_ALIGNMENT 0x0D05 +#define GL_MAX_LIGHTS 0x0D31 +#define GL_MAX_CLIP_PLANES 0x0D32 +#define GL_MAX_TEXTURE_SIZE 0x0D33 +#define GL_MAX_MODELVIEW_STACK_DEPTH 0x0D36 +#define GL_MAX_PROJECTION_STACK_DEPTH 0x0D38 +#define GL_MAX_TEXTURE_STACK_DEPTH 0x0D39 +#define GL_MAX_VIEWPORT_DIMS 0x0D3A +#define GL_MAX_ELEMENTS_VERTICES 0x80E8 +#define GL_MAX_ELEMENTS_INDICES 0x80E9 +#define GL_MAX_TEXTURE_UNITS 0x84E2 +#define GL_SUBPIXEL_BITS 0x0D50 +#define GL_RED_BITS 0x0D52 +#define GL_GREEN_BITS 0x0D53 +#define GL_BLUE_BITS 0x0D54 +#define GL_ALPHA_BITS 0x0D55 +#define GL_DEPTH_BITS 0x0D56 +#define GL_STENCIL_BITS 0x0D57 +#define GL_POLYGON_OFFSET_UNITS 0x2A00 +#define GL_POLYGON_OFFSET_FILL 0x8037 +#define GL_POLYGON_OFFSET_FACTOR 0x8038 +#define GL_TEXTURE_BINDING_2D 0x8069 +#define GL_VERTEX_ARRAY_SIZE 0x807A +#define GL_VERTEX_ARRAY_TYPE 0x807B +#define GL_VERTEX_ARRAY_STRIDE 0x807C +#define GL_NORMAL_ARRAY_TYPE 0x807E +#define GL_NORMAL_ARRAY_STRIDE 0x807F +#define GL_COLOR_ARRAY_SIZE 0x8081 +#define GL_COLOR_ARRAY_TYPE 0x8082 +#define GL_COLOR_ARRAY_STRIDE 0x8083 +#define GL_TEXTURE_COORD_ARRAY_SIZE 0x8088 +#define GL_TEXTURE_COORD_ARRAY_TYPE 0x8089 +#define GL_TEXTURE_COORD_ARRAY_STRIDE 0x808A +#define GL_VERTEX_ARRAY_POINTER 0x808E +#define GL_NORMAL_ARRAY_POINTER 0x808F +#define GL_COLOR_ARRAY_POINTER 0x8090 +#define GL_TEXTURE_COORD_ARRAY_POINTER 0x8092 +#define GL_SAMPLE_BUFFERS 0x80A8 +#define GL_SAMPLES 0x80A9 +#define GL_SAMPLE_C... [truncated message content] |
|
From: <at...@us...> - 2006-07-06 19:18:35
|
Revision: 347 Author: atani Date: 2006-07-06 12:18:05 -0700 (Thu, 06 Jul 2006) ViewCVS: http://svn.sourceforge.net/cadcdev/?rev=347&view=rev Log Message: ----------- initial NDS port, nonfunctional so far but it compiles cleanly with DevKitARM(DevKitPro) r19a and libnds 20060621 Modified Paths: -------------- tiki/examples/TikiTest/Makefile tiki/include/Tiki/color.h tiki/include/Tiki/plxcompat.h tiki/include/Tiki/sound.h tiki/include/Tiki/stream.h tiki/include/Tiki/texture.h tiki/src/gl/drawables/console.cpp tiki/src/gl/genmenu.cpp tiki/src/gl/gl.cpp tiki/src/gl/plxcompat.cpp tiki/src/gl/texture.cpp Added Paths: ----------- tiki/nds/ tiki/nds/Makefile tiki/nds/Makefile.rules tiki/nds/include/ tiki/nds/include/Tiki/ tiki/nds/include/Tiki/glhdrs.h tiki/nds/include/Tiki/platthread.h tiki/nds/include/Tiki/tikitypes.h tiki/nds/include/ogg/ tiki/nds/include/ogg/config_types.h tiki/nds/include/pch.h tiki/nds/lib/ tiki/nds/src/ tiki/nds/src/Makefile tiki/nds/src/init_shutdown.cpp tiki/nds/src/platgl.cpp tiki/nds/src/plathid.cpp tiki/nds/src/platthread.cpp tiki/nds/src/tikitime.cpp Modified: tiki/examples/TikiTest/Makefile =================================================================== --- tiki/examples/TikiTest/Makefile 2006-07-05 22:01:53 UTC (rev 346) +++ tiki/examples/TikiTest/Makefile 2006-07-06 19:18:05 UTC (rev 347) @@ -1,11 +1,13 @@ -CFLAGS=-I../../$(TIKI_PLAT)/include -I../../include +TIKI_DIR=../../ +CFLAGS=-I$(TIKI_DIR)$(TIKI_PLAT)/include -I$(TIKI_DIR)include OBJS = $(patsubst %.cpp,%.o,$(wildcard src/*.cpp)) all: $(OBJS) - $(CXX) -L../../$(TIKI_PLAT) -L../../$(TIKI_PLAT)/lib $(OBJS) $(TIKI_BASE_LIBS) -o tikitest + $(CXX) -L$(TIKI_DIR)$(TIKI_PLAT) -L$(TIKI_DIR)$(TIKI_PLAT)/lib $(OBJS) $(TIKI_BASE_LIBS) -o tikitest clean: -rm -f $(OBJS) tikitest -include ../../$(TIKI_PLAT)/Makefile.rules +DEPSDIR=$(CURDIR) +include $(TIKI_DIR)$(TIKI_PLAT)/Makefile.rules Modified: tiki/include/Tiki/color.h =================================================================== --- tiki/include/Tiki/color.h 2006-07-05 22:01:53 UTC (rev 346) +++ tiki/include/Tiki/color.h 2006-07-06 19:18:05 UTC (rev 347) @@ -80,7 +80,11 @@ } void select() const { +#if TIKI_PLAT != TIKI_NDS glColor4f(r, g, b, a); +#else + glColor3f(r, g, b); +#endif } static uint32 pack(float a, float r, float g, float b) { Modified: tiki/include/Tiki/plxcompat.h =================================================================== --- tiki/include/Tiki/plxcompat.h 2006-07-05 22:01:53 UTC (rev 346) +++ tiki/include/Tiki/plxcompat.h 2006-07-06 19:18:05 UTC (rev 347) @@ -249,7 +249,11 @@ uint8 g = (uint8)((argb >> 8) & 0xff); uint8 b = (uint8)((argb >> 0) & 0xff); uint8 a = (uint8)((argb >> 24) & 0xff); +#if TIKI_PLAT != TIKI_NDS glColor4ub(r, g, b, a); +#else + glColor3f(r, g, b); +#endif } // This function will handle the meat of the Parallax emulation. Note @@ -346,7 +350,11 @@ */ static inline void plx_vert_fnp(int flags, float x, float y, float z, float a, float r, float g, float b) { PRIMPRE(); +#if TIKI_PLAT != TIKI_NDS glColor4f(r, g, b, a); +#else + glColor3f(r, g, b); +#endif glVertex3f(x, y, z / zscale); PRIMPOST(flags); } @@ -390,7 +398,11 @@ float a, float r, float g, float b, float u, float v) { PRIMPRE(); +#if TIKI_PLAT != TIKI_NDS glColor4f(r, g, b, a); +#else + glColor3f(r, g, b); +#endif glTexCoord2f(u, v); glVertex3f(x, y, z / zscale); PRIMPOST(flags); Modified: tiki/include/Tiki/sound.h =================================================================== --- tiki/include/Tiki/sound.h 2006-07-05 22:01:53 UTC (rev 346) +++ tiki/include/Tiki/sound.h 2006-07-06 19:18:05 UTC (rev 347) @@ -66,11 +66,14 @@ private: bool m_stereo; -#if TIKI_PLAT != TIKI_DC +#if TIKI_PLAT != TIKI_DC && TIKI_PLAT != TIKI_NDS ALuint m_buffer; -#else +#endif +#if TIKI_PLAT == TIKI_DC sfxhnd_t handle; #endif +#if TIKI_PLAT == TIKI_NDS +#endif static float m_default_vol; }; Modified: tiki/include/Tiki/stream.h =================================================================== --- tiki/include/Tiki/stream.h 2006-07-05 22:01:53 UTC (rev 346) +++ tiki/include/Tiki/stream.h 2006-07-06 19:18:05 UTC (rev 347) @@ -124,7 +124,7 @@ }; State m_state; -#if TIKI_PLAT != TIKI_DC +#if TIKI_PLAT != TIKI_DC && TIKI_PLAT != TIKI_NDS ALuint m_buffers[2]; ALuint m_source; ALenum m_format; @@ -135,7 +135,7 @@ static void * alThreadProc(void * us); void threadProc(); void check(); -#if TIKI_PLAT != TIKI_DC +#if TIKI_PLAT != TIKI_DC && TIKI_PLAT != TIKI_NDS bool fillBuffer(ALuint buffer); #endif Modified: tiki/include/Tiki/texture.h =================================================================== --- tiki/include/Tiki/texture.h 2006-07-05 22:01:53 UTC (rev 346) +++ tiki/include/Tiki/texture.h 2006-07-06 19:18:05 UTC (rev 347) @@ -89,7 +89,11 @@ int m_w, m_h; // Texture width/height Fmt m_fmt; // Format spec uint8 * m_txrdata; // Pointer to GL-formatted data +#if TIKI_PLAT != TIKI_NDS GLuint m_gltxr; // GL texture handle +#else + int m_gltxr; // GL texture handle +#endif }; }; Added: tiki/nds/Makefile =================================================================== --- tiki/nds/Makefile (rev 0) +++ tiki/nds/Makefile 2006-07-06 19:18:05 UTC (rev 347) @@ -0,0 +1,58 @@ + +# BASE_AUDIO_OBJ=$(patsubst %.cpp,%.o,$(wildcard ../src/audio/*.cpp)) +BASE_AUDIO_OBJ=$(patsubst %.cpp,%.o,$(wildcard ../src/audio/oggvorbis/*.cpp)) +BASE_BASE_OBJ=$(patsubst %.cpp,%.o,$(wildcard ../src/base/*.cpp)) +BASE_GL_OBJ=$(patsubst %.cpp,%.o,$(wildcard ../src/gl/*.cpp)) +BASE_GL_OBJ+=$(patsubst %.cpp,%.o,$(wildcard ../src/gl/anims/*.cpp)) +BASE_GL_OBJ+=$(patsubst %.cpp,%.o,$(wildcard ../src/gl/drawables/*.cpp)) +BASE_GL_OBJ+=$(patsubst %.cpp,%.o,$(wildcard ../src/gl/triggers/*.cpp)) +BASE_HID_OBJ=$(patsubst %.cpp,%.o,$(wildcard ../src/hid/*.cpp)) +BASE_IMAGE_OBJ=$(patsubst %.cpp,%.o,$(wildcard ../src/image/*.cpp)) +BASE_MATH_OBJ=$(patsubst %.cpp,%.o,$(wildcard ../src/math/*.cpp)) +BASE_THREAD_OBJ=$(patsubst %.cpp,%.o,$(wildcard ../src/thread/*.cpp)) + +JPEG_OBJ=$(patsubst %.c,%.o,$(wildcard ../3rdparty/libjpeg/*.c)) +PNG_OBJ=$(patsubst %.c,%.o,$(wildcard ../3rdparty/libpng/*.c)) +ZLIB_OBJ=$(patsubst %.c,%.o,$(wildcard ../3rdparty/zlib/*.c)) +OGG_OBJ=$(patsubst %.c,%.o,$(wildcard ../3rdparty/libogg/src/*.c)) +VORBIS_OBJ=../3rdparty/libvorbis/lib/analysis.o \ + ../3rdparty/libvorbis/lib/bitrate.o \ + ../3rdparty/libvorbis/lib/block.o \ + ../3rdparty/libvorbis/lib/codebook.o \ + ../3rdparty/libvorbis/lib/envelope.o \ + ../3rdparty/libvorbis/lib/floor0.o \ + ../3rdparty/libvorbis/lib/floor1.o \ + ../3rdparty/libvorbis/lib/info.o \ + ../3rdparty/libvorbis/lib/lookup.o \ + ../3rdparty/libvorbis/lib/lpc.o \ + ../3rdparty/libvorbis/lib/lsp.o \ + ../3rdparty/libvorbis/lib/mapping0.o \ + ../3rdparty/libvorbis/lib/mdct.o \ + ../3rdparty/libvorbis/lib/psy.o \ + ../3rdparty/libvorbis/lib/registry.o \ + ../3rdparty/libvorbis/lib/res0.o \ + ../3rdparty/libvorbis/lib/sharedbook.o \ + ../3rdparty/libvorbis/lib/smallft.o \ + ../3rdparty/libvorbis/lib/synthesis.o \ + ../3rdparty/libvorbis/lib/vorbisfile.o \ + ../3rdparty/libvorbis/lib/window.o + +BASE_OBJS = $(BASE_AUDIO_OBJ) $(BASE_BASE_OBJ) $(BASE_GL_OBJ) \ + $(BASE_HID_OBJ) $(BASE_IMAGE_OBJ) $(BASE_MATH_OBJ) \ + $(BASE_THREAD_OBJ) + +THIRD_PARTY_OBJS = $(JPEG_OBJ) $(OGG_OBJ) $(VORBIS_OBJ) $(PNG_OBJ) $(ZLIB_OBJ) + +TIKI_DIR=$(CURDIR)/.. + +SUBDIRS=src + +all: subdirs $(BASE_OBJS) $(THIRD_PARTY_OBJS) + $(AR) ru libtiki.a $(BASE_OBJS) $(THIRD_PARTY_OBJS) + +clean: clean_subdirs + -rm -f $(BASE_OBJS) libtiki.a + +DEPSDIR=$(CURDIR) +TIKI_DIR=$(CURDIR)/.. +include Makefile.rules Property changes on: tiki/nds/Makefile ___________________________________________________________________ Name: svn:executable + * Added: tiki/nds/Makefile.rules =================================================================== --- tiki/nds/Makefile.rules (rev 0) +++ tiki/nds/Makefile.rules 2006-07-06 19:18:05 UTC (rev 347) @@ -0,0 +1,34 @@ +subdirs: $(patsubst %, _dir_%, $(SUBDIRS)) + +$(patsubst %, _dir_%, $(SUBDIRS)): + @$(MAKE) -C $(patsubst _dir_%, %, $@) + +clean_subdirs: $(patsubst %, _clean_dir_%, $(SUBDIRS)) + +$(patsubst %, _clean_dir_%, $(SUBDIRS)): + @$(MAKE) -C $(patsubst _clean_dir_%, %, $@) clean + +ifeq ($(strip $(DEVKITPRO)),) +$(error "Please set DEVKITPRO in your environment. export DEVKITPRO=<path to>devkitARM) +endif + +TIKI_BASE_LIBS=-ltiki -L$(DEVKITPRO)/libnds/lib -lnds9 + + +CXXFLAGS=-I$(DEVKITPRO)/libnds/include +CXXFLAGS+=-I$(TIKI_DIR)/include +CXXFLAGS+=-I$(TIKI_DIR)/nds/include -g +CXXFLAGS+=-I$(TIKI_DIR)/3rdparty/zlib +CXXFLAGS+=-I$(TIKI_DIR)/3rdparty/libjpeg +CXXFLAGS+=-I$(TIKI_DIR)/3rdparty/libpng +CXXFLAGS+=-I$(TIKI_DIR)/3rdparty/libogg/include +CXXFLAGS+=-I$(TIKI_DIR)/3rdparty/libvorbis/include +CXXFLAGS+=-I$(TIKI_DIR)/3rdparty/libvorbis/lib +CXXFLAGS+=-DARM9 +CXXFLAGS+=-mcpu=arm9tdmi -mtune=arm9tdmi -ffast-math -mthumb -mthumb-interwork +CFLAGS=$(CXXFLAGS) +CXXFLAGS+=-fno-rtti + +LDFLAGS=-specs=ds_arm9.specs -mthumb -mthumb-interwork -mno-fpu -L$(DEVKITPRO)/lib -lgcc + +include $(DEVKITPRO)/ds_rules Property changes on: tiki/nds/Makefile.rules ___________________________________________________________________ Name: svn:executable + * Added: tiki/nds/include/Tiki/glhdrs.h =================================================================== --- tiki/nds/include/Tiki/glhdrs.h (rev 0) +++ tiki/nds/include/Tiki/glhdrs.h 2006-07-06 19:18:05 UTC (rev 347) @@ -0,0 +1,16 @@ +/* + Tiki + + glhdrs.h + + Copyright (C)2005 Cryptic Allusion, LLC +*/ + +#ifndef __TIKI_GLHDRS_H +#define __TIKI_GLHDRS_H + +// This file should include the platform's OpenGL and GLU headers. + +#include <nds.h> + +#endif // __TIKI_GLHDRS_H Property changes on: tiki/nds/include/Tiki/glhdrs.h ___________________________________________________________________ Name: svn:executable + * Added: tiki/nds/include/Tiki/platthread.h =================================================================== --- tiki/nds/include/Tiki/platthread.h (rev 0) +++ tiki/nds/include/Tiki/platthread.h 2006-07-06 19:18:05 UTC (rev 347) @@ -0,0 +1,24 @@ +/* + Tiki + + platthread.h + + Copyright (C)2005 Cryptic Allusion, LLC +*/ + +#ifndef __TIKI_PLATTHREAD_H +#define __TIKI_PLATTHREAD_H + + +namespace Tiki { +namespace Thread { + +typedef void* thread_t; +typedef long mutex_t; +typedef long cond_t; + +} +} + +#endif // __TIKI_PLATTHREAD_H + Property changes on: tiki/nds/include/Tiki/platthread.h ___________________________________________________________________ Name: svn:executable + * Added: tiki/nds/include/Tiki/tikitypes.h =================================================================== --- tiki/nds/include/Tiki/tikitypes.h (rev 0) +++ tiki/nds/include/Tiki/tikitypes.h 2006-07-06 19:18:05 UTC (rev 347) @@ -0,0 +1,34 @@ +/* + Tiki + + types.h + + Copyright (C)2000,2001 Dan Potter + Copyright (C)2005 Cryptic Allusion, LLC +*/ + +#ifndef __TIKI_TYPES_H +#define __TIKI_TYPES_H + +#include <stddef.h> +#include <sys/cdefs.h> +#include <nds/jtypes.h> + +// This gets included in the main tiki.h, so it should suffice. +#define TIKI_OSX 0 +#define TIKI_WIN32 1 +#define TIKI_SDL 2 +#define TIKI_DC 3 +#define TIKI_GP2X 4 +#define TIKI_NDS 5 +#define TIKI_PLAT TIKI_NDS + +namespace Tiki { + +// Pointer arithmetic types +typedef uint32 ptr_t; + +}; + +#endif // __TIKI_TYPES_H + Property changes on: tiki/nds/include/Tiki/tikitypes.h ___________________________________________________________________ Name: svn:executable + * Added: tiki/nds/include/ogg/config_types.h =================================================================== --- tiki/nds/include/ogg/config_types.h (rev 0) +++ tiki/nds/include/ogg/config_types.h 2006-07-06 19:18:05 UTC (rev 347) @@ -0,0 +1,7 @@ + +#include <nds/jtypes.h> + +typedef int64 ogg_int64_t; +typedef int32 ogg_int32_t; +typedef uint32 ogg_uint32_t; +typedef int16 ogg_int16_t; Added: tiki/nds/include/pch.h =================================================================== --- tiki/nds/include/pch.h (rev 0) +++ tiki/nds/include/pch.h 2006-07-06 19:18:05 UTC (rev 347) @@ -0,0 +1,25 @@ +/* + Tiki + + pch.h + + Copyright (C)2005 Cryptic Allusion, LLC +*/ + +// This is mainly just a placeholder on non-Win32 platforms. If we don't +// include a file at the top of every source file, Visual C++ is too stupid +// to do it on its own. It's a convenient excuse to predefine some other +// stuff too though. + +// This header does most of the useful work for bringing in stuff. +#include "Tiki/tiki.h" + +// Don't bother with namespace poo inside the framework itself. +using namespace Tiki; + +// Packed structs need some compiler-specific foo. +#define PACKED_STRUCT_BEGIN +#define PACKED_STRUCT_END +#define PACKED_STRUCT_MEMBER __attribute__((packed)) + + Property changes on: tiki/nds/include/pch.h ___________________________________________________________________ Name: svn:executable + * Added: tiki/nds/src/Makefile =================================================================== --- tiki/nds/src/Makefile (rev 0) +++ tiki/nds/src/Makefile 2006-07-06 19:18:05 UTC (rev 347) @@ -0,0 +1,12 @@ + +OBJS = $(patsubst %.cpp,%.o,$(wildcard *.cpp)) + +all: $(OBJS) + $(AR) ru ../libtiki.a $(OBJS) + +clean: + -rm -f $(OBJS) + +DEPSDIR=$(CURDIR) +TIKI_DIR=$(CURDIR)/../../ +include ../Makefile.rules Property changes on: tiki/nds/src/Makefile ___________________________________________________________________ Name: svn:executable + * Added: tiki/nds/src/init_shutdown.cpp =================================================================== --- tiki/nds/src/init_shutdown.cpp (rev 0) +++ tiki/nds/src/init_shutdown.cpp 2006-07-06 19:18:05 UTC (rev 347) @@ -0,0 +1,35 @@ +/* + Tiki + + init_shutdown.cpp + + Copyright (C)2005 Atani Software +*/ + +#include "pch.h" + +#include "Tiki/sound.h" +#include "Tiki/stream.h" +#include "Tiki/plxcompat.h" +#include "Tiki/hid.h" + +namespace Tiki { + +bool init(int argc, char **argv) { + return Hid::init(); +} + +void shutdown() { + Hid::shutdown(); +} + +void setName(const char *windowName, const char *iconName) +{ +} + +namespace GL { +void showCursor(bool visible) { +} +} + +} Property changes on: tiki/nds/src/init_shutdown.cpp ___________________________________________________________________ Name: svn:executable + * Added: tiki/nds/src/platgl.cpp =================================================================== --- tiki/nds/src/platgl.cpp (rev 0) +++ tiki/nds/src/platgl.cpp 2006-07-06 19:18:05 UTC (rev 347) @@ -0,0 +1,55 @@ +/* + * platgl.cpp + * Tiki + * + * Created by Dan Potter on 3/20/05. + * Copyright 2005 Cryptic Allusion, LLC. All rights reserved. + * + */ + +#include "Tiki/gl.h" +#include "Tiki/tikitime.h" +#include "Tiki/debug.h" + +#include <unistd.h> +#include <sys/time.h> + +namespace Tiki { +namespace GL { +namespace Frame { + +float getFrameRate() { + return 0.0f; +} + +void setFrameRateLimit(int rate) { +} + +} + +extern "C" { + +void tiki_wait_if_needed() { +} + +void tiki_scene_begin_hook() { +} + +void tiki_scene_finish_hook() { +} + +void tiki_scene_begin_opaque_hook() { +} + +void tiki_scene_finish_opaque_hook() { +} + +void tiki_scene_begin_trans_hook() { +} + +void tiki_scene_finish_trans_hook() { +} + +} +} +} Property changes on: tiki/nds/src/platgl.cpp ___________________________________________________________________ Name: svn:executable + * Added: tiki/nds/src/plathid.cpp =================================================================== --- tiki/nds/src/plathid.cpp (rev 0) +++ tiki/nds/src/plathid.cpp 2006-07-06 19:18:05 UTC (rev 347) @@ -0,0 +1,22 @@ +#include "pch.h" +#include "Tiki/glhdrs.h" +#include "Tiki/hid.h" + +namespace Tiki { +namespace Hid { +bool platInit() { + return true; +} + +void platShutdown() { +} + +} + +} + +extern "C" void TikiRecvQuit() { + Tiki::Hid::Event evt(Tiki::Hid::Event::EvtQuit); + sendEvent(evt); +} + Property changes on: tiki/nds/src/plathid.cpp ___________________________________________________________________ Name: svn:executable + * Added: tiki/nds/src/platthread.cpp =================================================================== --- tiki/nds/src/platthread.cpp (rev 0) +++ tiki/nds/src/platthread.cpp 2006-07-06 19:18:05 UTC (rev 347) @@ -0,0 +1,92 @@ +/* + Tiki + + platthread.cpp + + Copyright (C)2005 Cryptic Allusion, LLC +*/ + +#include "pch.h" +#include "Tiki/thread.h" + +#include <sys/time.h> +#include <time.h> + +using Tiki::Thread::thread_t; +using Tiki::Thread::mutex_t; +using Tiki::Thread::cond_t; + +bool Thread::create(thread_t * out, void * (*func)(void *), void * param) { + return false; +} + +bool Thread::join(thread_t thd, void ** out) { + return false; +} + +void Thread::exit(void * ptr) { +} + +bool Thread::equal(thread_t t1, thread_t t2) { + return false; +} + +thread_t Thread::self() { + return NULL; +} + + +bool Thread::mutex_create(mutex_t * out) { + return false; +} + +bool Thread::mutex_destroy(mutex_t * m) { + return false; +} + +bool Thread::mutex_trylock(mutex_t * m) { + return false; +} + +bool Thread::mutex_lock(mutex_t * m) { + return false; +} + +bool Thread::mutex_unlock(mutex_t * m) { + return false; +} + + +bool Thread::cond_broadcast(cond_t *cond) { + return false; +} + +bool Thread::cond_destroy(cond_t *cond) { + return false; +} + +bool Thread::cond_create(cond_t *cond) { + return false; +} + +bool Thread::cond_signal(cond_t *cond) { + return false; +} + +bool Thread::cond_wait(cond_t *cond, mutex_t *mutex, uint64 maxWaitMicros) { + return false; +} + +bool Thread::cond_wait(cond_t * cond, mutex_t *mutex) { + return false; +} + + + + + + + + + + Property changes on: tiki/nds/src/platthread.cpp ___________________________________________________________________ Name: svn:executable + * Added: tiki/nds/src/tikitime.cpp =================================================================== --- tiki/nds/src/tikitime.cpp (rev 0) +++ tiki/nds/src/tikitime.cpp 2006-07-06 19:18:05 UTC (rev 347) @@ -0,0 +1,41 @@ +/* + Tiki + + tikitime.cpp + + Copyright (C)2005 Cryptic Allusion, LLC +*/ + +#include "pch.h" +#include "Tiki/tikitime.h" + +#include <sys/time.h> +#include <unistd.h> + +namespace Tiki { +namespace Time { +uint64 gettime() { + timeval tv; + gettimeofday(&tv, NULL); + + uint64 rv = tv.tv_sec; rv *= 1000000; + rv += tv.tv_usec; + + return rv; +} + +void sleep(uint64 us) { +// TODO: add this +} + +} +} + + + + + + + + + Property changes on: tiki/nds/src/tikitime.cpp ___________________________________________________________________ Name: svn:executable + * Modified: tiki/src/gl/drawables/console.cpp =================================================================== --- tiki/src/gl/drawables/console.cpp 2006-07-05 22:01:53 UTC (rev 346) +++ tiki/src/gl/drawables/console.cpp 2006-07-06 19:18:05 UTC (rev 347) @@ -36,7 +36,7 @@ m_texture->select(); -#if TIKI_PLAT != TIKI_DC +#if TIKI_PLAT != TIKI_DC && TIKI_PLAT != TIKI_NDS glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST); #endif @@ -262,8 +262,10 @@ int x=0,y=0; float x_step=(m_w / m_cols); float y_step=(m_h / m_rows); - + +#if TIKI_PLAT != TIKI_NDS glDisable(GL_DEPTH_TEST); +#endif for(y=0; y<m_rows; y++) { for(x=0; x<m_cols; x++) { Modified: tiki/src/gl/genmenu.cpp =================================================================== --- tiki/src/gl/genmenu.cpp 2006-07-05 22:01:53 UTC (rev 346) +++ tiki/src/gl/genmenu.cpp 2006-07-06 19:18:05 UTC (rev 347) @@ -134,10 +134,24 @@ Frame::begin(); - if (m_exiting) + if (m_exiting) { +#if TIKI_PLAT != TIKI_NDS glClearColor(m_bg[0]*m_exitCount, m_bg[1]*m_exitCount, m_bg[2]*m_exitCount, 1.0f); - else +#else + glClearColor((uint8)((m_bg[0]*m_exitCount)*255), + (uint8)((m_bg[1]*m_exitCount)*255), + (uint8)((m_bg[2]*m_exitCount)*255)); +#endif + } + else { +#if TIKI_PLAT != TIKI_NDS glClearColor(m_bg[0], m_bg[1], m_bg[2], 1.0f); +#else + glClearColor((uint8)(m_bg[0]*255), + (uint8)(m_bg[1]*255), + (uint8)(m_bg[2]*255)); +#endif + } visualOpaqueList(); Modified: tiki/src/gl/gl.cpp =================================================================== --- tiki/src/gl/gl.cpp 2006-07-05 22:01:53 UTC (rev 346) +++ tiki/src/gl/gl.cpp 2006-07-06 19:18:05 UTC (rev 347) @@ -22,6 +22,7 @@ // This sets up an OpenGL environment approximately the same // as a PVR. +#if TIKI_PLAT != TIKI_NDS glFrontFace(GL_CCW); glEnable(GL_DEPTH_TEST); #if TIKI_PLAT != TIKI_DC //KGL doesn't have these constants @@ -37,11 +38,14 @@ glShadeModel(GL_SMOOTH); glDisable(GL_CULL_FACE); +#endif set2d(); // glViewport((GLsizei)m_x1, (GLsizei)m_y1, (GLsizei)m_x2, (GLsizei)m_y2); + +#if TIKI_PLAT != TIKI_NDS glViewport(0, 0, 640, 480); - + glClearDepth(0.0f); #if TIKI_PLAT != TIKI_DC glClear(GL_COLOR_BUFFER_BIT+GL_DEPTH_BUFFER_BIT+GL_STENCIL_BUFFER_BIT); @@ -49,6 +53,13 @@ glClear(GL_COLOR_BUFFER_BIT+GL_DEPTH_BUFFER_BIT); #endif +#else // TIKI_NDS + glViewPort(0, 0, 255, 191); + + glClearDepth(0x7FFFF); + glClearColor(0,0,0); +#endif + glLoadIdentity(); transDisable(); @@ -75,7 +86,9 @@ void Frame::transEnable() { // This will leave the depth testing enabled (to not overdraw // opaque objects) but not update the depth buffer. +#if TIKI_PLAT != TIKI_NDS glDepthMask(GL_FALSE); +#endif #if TIKI_PLAT == TIKI_DC glKosFinishList(); @@ -83,7 +96,9 @@ // Turn on blending with a sensible alpha function default. glEnable(GL_BLEND); +#if TIKI_PLAT != TIKI_NDS glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); +#endif } void Frame::transDisable() { Modified: tiki/src/gl/plxcompat.cpp =================================================================== --- tiki/src/gl/plxcompat.cpp 2006-07-05 22:01:53 UTC (rev 346) +++ tiki/src/gl/plxcompat.cpp 2006-07-06 19:18:05 UTC (rev 347) @@ -36,12 +36,16 @@ } void Plxcompat::plx_cxt_blending(int src, int dst) { +#if TIKI_PLAT != TIKI_NDS glBlendFunc(src, dst); +#endif } void Plxcompat::plx_cxt_culling(int type) { +#if TIKI_PLAT != TIKI_NDS glCullFace(type); glFrontFace(GL_CCW); +#endif } ///////////////////////////////////////////////////////////////////// Modified: tiki/src/gl/texture.cpp =================================================================== --- tiki/src/gl/texture.cpp 2006-07-05 22:01:53 UTC (rev 346) +++ tiki/src/gl/texture.cpp 2006-07-06 19:18:05 UTC (rev 347) @@ -55,8 +55,10 @@ //glDeleteTexture frees the PVR memory for us, how nice of it! #endif m_txrdata = NULL; +#if TIKI_PLAT != TIKI_NDS if (!initial && m_gltxr) glDeleteTextures(1, &m_gltxr); +#endif m_gltxr = 0; } @@ -186,11 +188,13 @@ m_h = img->h; m_fmt = (Fmt)(img->fmt); switch(img->fmt) { + case Image::RGB565: + case Image::RGB888: +#if TIKI_PLAT != TIKI_NDS // NDS doesnt support Alpha? case Image::RGBA8888: - case Image::RGB565: case Image::ARGB4444: case Image::ARGB1555: - case Image::RGB888: +#endif break; default: /* shrug */ @@ -203,7 +207,7 @@ glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, m_gltxr); -#if TIKI_PLAT != TIKI_DC +#if TIKI_PLAT != TIKI_DC && TIKI_PLAT != TIKI_NDS /* We'll write the converted data into this buffer */ if (!m_txrdata) m_txrdata = new uint8[img->w * img->h * 4]; @@ -214,7 +218,7 @@ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, m_w, m_h, 0, GL_RGBA, GL_UNSIGNED_BYTE, m_txrdata); GLenum err = glGetError(); -#else +#elif TIKI_PLAT == TIKI_DC m_txrdata = (uint8 *)pvr_mem_malloc(img->w * img->h * 2); pvr_txr_load_ex(m_ptr, m_txrdata, img->w, img->h, PVR_TXRLOAD_16BPP); @@ -224,6 +228,8 @@ glKosTex2D(GL_RGB565_TWID, m_w, m_h, m_txrdata); } glTexEnvi(GL_TEXTURE_2D,GL_TEXTURE_ENV_MODE,GL_MODULATEALPHA); +#elif TIKI_PLAT == TIKI_NDS + glTexImage2D(0, 0, GL_RGB, m_w, m_h, 0, TEXGEN_TEXCOORD, m_ptr); #endif return true; @@ -234,11 +240,13 @@ glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, m_gltxr); -#if TIKI_PLAT != TIKI_DC //KGL doesn't support these +#if TIKI_PLAT != TIKI_DC && TIKI_PLAT != TIKI_NDS + //KGL/NDS do support these glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); -#else +#elif TIKI_PLAT == TIKI_DC glTexEnvi(GL_TEXTURE_2D,GL_TEXTURE_ENV_MODE,GL_MODULATEALPHA); +#elif TIKI_PLAT == TIKI_NDS #endif m_w = w; @@ -281,7 +289,7 @@ void Texture::setFilter(FilterType filter) { -#if TIKI_PLAT != TIKI_DC +#if TIKI_PLAT != TIKI_DC && TIKI_PLAT != TIKI_NDS select(); GLuint glfilt = GL_LINEAR; switch (filter) { @@ -298,6 +306,7 @@ } void Texture::setUVClamp(UVMode umode, UVMode vmode) { +#if TIKI_PLAT != TIKI_NDS GLenum gumode, gvmode; gumode = umode == UVClamp ? GL_CLAMP : GL_REPEAT; @@ -314,6 +323,7 @@ if (gvmode == GL_CLAMP) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); #endif +#endif } void * Texture::canvasLock() { @@ -324,18 +334,24 @@ convertToGl(); glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, m_gltxr); -#if TIKI_PLAT != TIKI_DC +#if TIKI_PLAT != TIKI_DC && TIKI_PLAT != TIKI_NDS glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, m_w, m_h, 0, GL_RGBA, GL_UNSIGNED_BYTE, m_txrdata); #else switch (m_fmt) { +#if TIKI_PLAT != TIKI_NDS case ARGB1555: glTexImage2D(GL_TEXTURE_2D, 0, GL_ARGB1555, m_w, m_h, 0, GL_ARGB1555, GL_UNSIGNED_BYTE, m_ptr); break; case ARGB4444: glTexImage2D(GL_TEXTURE_2D, 0, GL_ARGB4444, m_w, m_h, 0, GL_ARGB4444, GL_UNSIGNED_BYTE, m_ptr); break; +#endif case RGB565: +#if TIKI_PLAT != TIKI_NDS glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB565, m_w, m_h, 0, GL_RGB565, GL_UNSIGNED_BYTE, m_ptr); +#else + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, m_w, m_h, 0, TEXGEN_TEXCOORD, m_ptr); +#endif break; default: Debug::printf("Texture::canvasUnlock: Unsupported texture format\n"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <c99...@us...> - 2006-11-13 22:38:20
|
Revision: 380
http://svn.sourceforge.net/cadcdev/?rev=380&view=rev
Author: c99koder
Date: 2006-11-12 15:01:37 -0800 (Sun, 12 Nov 2006)
Log Message:
-----------
Add F-key constants
Modified Paths:
--------------
tiki/include/Tiki/hid.h
tiki/osx/src/plathid.mm
Modified: tiki/include/Tiki/hid.h
===================================================================
--- tiki/include/Tiki/hid.h 2006-10-19 00:20:31 UTC (rev 379)
+++ tiki/include/Tiki/hid.h 2006-11-12 23:01:37 UTC (rev 380)
@@ -78,6 +78,18 @@
KeyDelete,
KeyPgup,
KeyPgdn,
+ KeyF1,
+ KeyF2,
+ KeyF3,
+ KeyF4,
+ KeyF5,
+ KeyF6,
+ KeyF7,
+ KeyF8,
+ KeyF9,
+ KeyF10,
+ KeyF11,
+ KeyF12,
KeyUnknown,
KeySentinel
};
Modified: tiki/osx/src/plathid.mm
===================================================================
--- tiki/osx/src/plathid.mm 2006-10-19 00:20:31 UTC (rev 379)
+++ tiki/osx/src/plathid.mm 2006-11-12 23:01:37 UTC (rev 380)
@@ -84,6 +84,30 @@
return Event::KeyPgup;
case NSPageDownFunctionKey:
return Event::KeyPgdn;
+ case NSF1FunctionKey:
+ return Event::KeyF1;
+ case NSF2FunctionKey:
+ return Event::KeyF2;
+ case NSF3FunctionKey:
+ return Event::KeyF3;
+ case NSF4FunctionKey:
+ return Event::KeyF4;
+ case NSF5FunctionKey:
+ return Event::KeyF5;
+ case NSF6FunctionKey:
+ return Event::KeyF6;
+ case NSF7FunctionKey:
+ return Event::KeyF7;
+ case NSF8FunctionKey:
+ return Event::KeyF8;
+ case NSF9FunctionKey:
+ return Event::KeyF9;
+ case NSF10FunctionKey:
+ return Event::KeyF10;
+ case NSF11FunctionKey:
+ return Event::KeyF11;
+ case NSF12FunctionKey:
+ return Event::KeyF12;
default:
return -1;
}
@@ -178,7 +202,7 @@
unichar c = [chs characterAtIndex: i];
int ch;
- if ((c & 0xff00) == (NSUpArrowFunctionKey & 0xff00) || c == 27) {
+ if ((c & 0xff00) == (NSUpArrowFunctionKey & 0xff00) || c == 27 || (c >= NSF1FunctionKey && c <= NSF12FunctionKey)) {
ch = translateFn(c);
if (ch < 0)
return;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <c99...@us...> - 2006-11-26 01:59:08
|
Revision: 385
http://svn.sourceforge.net/cadcdev/?rev=385&view=rev
Author: c99koder
Date: 2006-11-25 17:59:05 -0800 (Sat, 25 Nov 2006)
Log Message:
-----------
Tiki: Mac OS X: Pass argc,argv onto tiki_main. Append the document passed by Finder onto argv (see tikitest's controller for example). Output argc,argv in TikiTest.
Modified Paths:
--------------
tiki/examples/TikiTest/src/Controller.h
tiki/examples/TikiTest/src/Controller.m
tiki/examples/TikiTest/src/test.cpp
tiki/osx/include/Tiki/TikiMain.h
tiki/osx/include/Tiki/tikitypes.h
tiki/osx/src/TikiMain.m
tiki/osx/src/init_shutdown.cpp
Modified: tiki/examples/TikiTest/src/Controller.h
===================================================================
--- tiki/examples/TikiTest/src/Controller.h 2006-11-25 20:53:55 UTC (rev 384)
+++ tiki/examples/TikiTest/src/Controller.h 2006-11-26 01:59:05 UTC (rev 385)
@@ -9,5 +9,6 @@
IBOutlet NSWindow *mainWindow;
TikiMain * tm;
+ NSString * openFileName;
}
@end
Modified: tiki/examples/TikiTest/src/Controller.m
===================================================================
--- tiki/examples/TikiTest/src/Controller.m 2006-11-25 20:53:55 UTC (rev 384)
+++ tiki/examples/TikiTest/src/Controller.m 2006-11-26 01:59:05 UTC (rev 385)
@@ -5,12 +5,16 @@
void tiki_main();
@implementation Controller
+- (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename
+{
+ openFileName = filename;
+}
- (void) applicationDidFinishLaunching: (NSNotification *) note
{
TikiMain * otm = [[TikiMain alloc] retain];
tm = otm;
- [tm doMainWithWindow: mainWindow andView: mainView andMainFunc: tiki_main];
+ [tm doMainWithWindow: mainWindow andView: mainView andMainFunc: tiki_main andOpenFile:openFileName];
tm = nil;
[otm release];
}
Modified: tiki/examples/TikiTest/src/test.cpp
===================================================================
--- tiki/examples/TikiTest/src/test.cpp 2006-11-25 20:53:55 UTC (rev 384)
+++ tiki/examples/TikiTest/src/test.cpp 2006-11-26 01:59:05 UTC (rev 385)
@@ -240,6 +240,11 @@
Tiki::GL::showCursor(false);
Hid::callbackReg(tkCallback, NULL);
+ Debug::printf("argc: %i\n", argc);
+ for(int i=0; i<argc; i++) {
+ Debug::printf("argv[%i]: %s\n",i,argv[i]);
+ }
+
#if TIKI_PLAT != TIKI_DC
//Attach events happen before we start :(
mp[0].valid=1;
Modified: tiki/osx/include/Tiki/TikiMain.h
===================================================================
--- tiki/osx/include/Tiki/TikiMain.h 2006-11-25 20:53:55 UTC (rev 384)
+++ tiki/osx/include/Tiki/TikiMain.h 2006-11-26 01:59:05 UTC (rev 385)
@@ -19,10 +19,15 @@
NSView * mainView;
pthread_t glThreadHnd;
void (*mainFunc)(int, char**);
+ NSString * openFile;
}
- (void) doMainWithWindow: (NSWindow *)mainWindow andView: (NSView *)mainView
andMainFunc: (void (*)(int, char**))mainFunc;
+
+- (void) doMainWithWindow: (NSWindow *)mainWindow andView: (NSView *)mainView
+ andMainFunc: (void (*)(int, char**))mainFunc andOpenFile: (NSString *)openFile;
+
- (void) quitSoon;
@end
Modified: tiki/osx/include/Tiki/tikitypes.h
===================================================================
--- tiki/osx/include/Tiki/tikitypes.h 2006-11-25 20:53:55 UTC (rev 384)
+++ tiki/osx/include/Tiki/tikitypes.h 2006-11-26 01:59:05 UTC (rev 385)
@@ -17,6 +17,8 @@
#define TIKI_WIN32 1
#define TIKI_SDL 2
#define TIKI_DC 3
+#define TIKI_GP2X 4
+#define TIKI_NDS 5
#define TIKI_PLAT TIKI_OSX
namespace Tiki {
Modified: tiki/osx/src/TikiMain.m
===================================================================
--- tiki/osx/src/TikiMain.m 2006-11-25 20:53:55 UTC (rev 384)
+++ tiki/osx/src/TikiMain.m 2006-11-26 01:59:05 UTC (rev 385)
@@ -69,16 +69,23 @@
}
@implementation TikiMain
+- (void) doMainWithWindow: (NSWindow *)iMainWindow andView: (NSView *)iMainView
+ andMainFunc: (void (*)(int, char**))iMainFunc
+{
+
+ [self doMainWithWindow:iMainWindow andView:iMainView andMainFunc:iMainFunc andOpenFile: nil];
+}
- (void) doMainWithWindow: (NSWindow *)iMainWindow andView: (NSView *)iMainView
- andMainFunc: (void (*)(int, char**))iMainFunc;
+ andMainFunc: (void (*)(int, char**))iMainFunc andOpenFile: (NSString *)iOpenFile
{
width = targetW;
height = targetH;
mainWindow = iMainWindow;
mainView = iMainView;
mainFunc = iMainFunc;
-
+ openFile = iOpenFile;
+
[mainWindow makeKeyAndOrderFront:nil];
[mainWindow makeFirstResponder:mainView];
[mainWindow setAcceptsMouseMovedEvents:true];
@@ -265,10 +272,32 @@
tiki_scene_finish_hook();
- // XXX get args in here
assert( mainFunc );
- mainFunc(0, NULL);
+ NSArray *args;
+ if(openFile != nil)
+ args = [[[NSProcessInfo processInfo] arguments] arrayByAddingObject:openFile];
+ else
+ args = [[NSProcessInfo processInfo] arguments];
+
+ int argc = [args count];
+
+ if(argc > 0) {
+ char ** argv = malloc(sizeof(char*) * argc);
+ NSString *arg;
+
+ for(int i = 0; i < argc; i++) {
+ arg = [args objectAtIndex: i];
+ argv[i] = malloc([arg length] + 2);
+ strncpy(argv[i],[arg cString],[arg cStringLength]);
+ argv[i][[arg cStringLength]] = '\0';
+ }
+ mainFunc(argc, argv);
+ } else {
+ mainFunc(0, NULL);
+ }
+
+
NSLog(@"glThread exiting");
[NSApp terminate: self];
Modified: tiki/osx/src/init_shutdown.cpp
===================================================================
--- tiki/osx/src/init_shutdown.cpp 2006-11-25 20:53:55 UTC (rev 384)
+++ tiki/osx/src/init_shutdown.cpp 2006-11-26 01:59:05 UTC (rev 385)
@@ -11,9 +11,11 @@
#include <CoreFoundation/CFString.h>
#if TIKI_PLAT == TIKI_OSX
-# include <OpenAL/alut.h>
+# include <OpenAL/al.h>
+# include <OpenAL/alc.h>
#else
-# include <alut.h>
+# include <al.h>
+# include <alc.h>
#endif
#include "Tiki/sound.h"
@@ -27,7 +29,17 @@
namespace Tiki {
bool init(int argc, char **argv) {
- alutInit(&argc, argv);
+ ALCdevice *dev = NULL;
+ ALCcontext *ctx = NULL;
+
+ dev = alcOpenDevice(getenv("OPENAL_DEVICE")); // getenv()==NULL is okay.
+ if (dev != NULL) {
+ ctx = alcCreateContext(dev, 0);
+ if (ctx != NULL) {
+ alcMakeContextCurrent(ctx);
+ alcProcessContext(ctx);
+ } // if
+ } // if
Audio::Sound::initGlobal();
Audio::Stream::initGlobal();
@@ -42,7 +54,7 @@
Audio::Stream::shutdownGlobal();
Hid::shutdown();
- alutExit();
+ //alutExit();
}
void setName(const char *windowName, const char *icon) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <c99...@us...> - 2006-12-03 18:23:41
|
Revision: 388
http://svn.sourceforge.net/cadcdev/?rev=388&view=rev
Author: c99koder
Date: 2006-12-03 10:23:38 -0800 (Sun, 03 Dec 2006)
Log Message:
-----------
Tiki: add File::writele16() and File::writele32()
Modified Paths:
--------------
tiki/include/Tiki/file.h
tiki/src/base/file.cpp
Modified: tiki/include/Tiki/file.h
===================================================================
--- tiki/include/Tiki/file.h 2006-12-03 03:47:53 UTC (rev 387)
+++ tiki/include/Tiki/file.h 2006-12-03 18:23:38 UTC (rev 388)
@@ -42,6 +42,13 @@
// Read cnt 32-bit little-endian words from the file.
bool readle32(void * out, int cnt);
+ // Write cnt 16-bit little-endian words to the file.
+ bool writele16(uint16 * in, int cnt);
+
+ // Write cnt 32-bit little-endian words to the file.
+ bool writele32(uint32 * in, int cnt);
+
+
// Seek in the file.
int seek(int where, int whence);
Modified: tiki/src/base/file.cpp
===================================================================
--- tiki/src/base/file.cpp 2006-12-03 03:47:53 UTC (rev 387)
+++ tiki/src/base/file.cpp 2006-12-03 18:23:38 UTC (rev 388)
@@ -90,6 +90,42 @@
#endif
}
+bool File::writele16(uint16 * in, int cnt) {
+#if BYTE_ORDER == BIG_ENDIAN
+ for (int i=0; i<cnt; i++) {
+ uint16 v = *in;
+ v = ((v & 0xff00) >> 8)
+ | ((v & 0x00ff) << 8);
+
+ if (write(&v, 2) < 2)
+ return false;
+ in = ((uint16 *)in) + 1;
+ }
+ return true;
+#else
+ return write(in, 2 * cnt) == 2 * cnt;
+#endif
+}
+
+bool File::writele32(uint32 * in, int cnt) {
+#if BYTE_ORDER == BIG_ENDIAN
+ for (int i=0; i<cnt; i++) {
+ uint16 v = *in;
+ v = ((v & 0x000000ff) << 24) |
+ ((v & 0x0000ff00) << 8) |
+ ((v & 0x00ff0000) >> 8) |
+ ((v & 0xff000000) >> 24);
+
+ if (write(&v, 4) < 4)
+ return false;
+ in = ((uint32 *)in) + 1;
+ }
+ return true;
+#else
+ return write(in, 4 * cnt) == 4 * cnt;
+#endif
+}
+
int File::seek(int where, int whence) {
if (!isValid())
return -1;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <at...@us...> - 2007-01-01 03:31:32
|
Revision: 391
http://svn.sourceforge.net/cadcdev/?rev=391&view=rev
Author: atani
Date: 2006-12-31 19:31:29 -0800 (Sun, 31 Dec 2006)
Log Message:
-----------
Various fixes for Code::Blocks 1.0rc2 and gcc on win32.
Modified Paths:
--------------
tiki/3rdparty/libjpeg/jconfig.h
tiki/3rdparty/libogg/include/ogg/os_types.h
tiki/examples/TikiTest/tikitest.cbp
tiki/examples/TikiTest/tikitest.layout
tiki/src/gl/texture.cpp
tiki/win32/tiki.cbp
tiki/win32/tiki.layout
Modified: tiki/3rdparty/libjpeg/jconfig.h
===================================================================
--- tiki/3rdparty/libjpeg/jconfig.h 2006-12-31 03:17:23 UTC (rev 390)
+++ tiki/3rdparty/libjpeg/jconfig.h 2007-01-01 03:31:29 UTC (rev 391)
@@ -23,7 +23,7 @@
#undef INCOMPLETE_TYPES_BROKEN
/* Define "boolean" as unsigned char, not int, per Windows custom */
-#ifndef __RPCNDR_H__ /* don't conflict if rpcndr.h already read */
+#if !defined(boolean)
typedef unsigned char boolean;
#endif
#define HAVE_BOOLEAN /* prevent jmorecfg.h from redefining it */
Modified: tiki/3rdparty/libogg/include/ogg/os_types.h
===================================================================
--- tiki/3rdparty/libogg/include/ogg/os_types.h 2006-12-31 03:17:23 UTC (rev 390)
+++ tiki/3rdparty/libogg/include/ogg/os_types.h 2007-01-01 03:31:29 UTC (rev 391)
@@ -24,7 +24,7 @@
#define _ogg_realloc realloc
#define _ogg_free free
-#ifdef _WIN32
+#ifdef _WIN32
# ifndef __GNUC__
/* MSVC/Borland */
@@ -33,14 +33,21 @@
typedef unsigned __int32 ogg_uint32_t;
typedef __int16 ogg_int16_t;
typedef unsigned __int16 ogg_uint16_t;
-# else
+# elif defined(__GNUC__)
+ /* MingW32/GCC */
+ typedef short ogg_int16_t;
+ typedef unsigned short ogg_uint16_t;
+ typedef int ogg_int32_t;
+ typedef unsigned int ogg_uint32_t;
+ typedef long long ogg_int64_t;
+# else
/* Cygwin */
#include <_G_config.h>
typedef _G_int64_t ogg_int64_t;
typedef _G_int32_t ogg_int32_t;
typedef _G_uint32_t ogg_uint32_t;
typedef _G_int16_t ogg_int16_t;
- typedef _G_uint16_t ogg_uint16_t;
+ typedef _G_uint16_t ogg_uint16_t;
# endif
#elif defined(__MACOS__)
Modified: tiki/examples/TikiTest/tikitest.cbp
===================================================================
--- tiki/examples/TikiTest/tikitest.cbp 2006-12-31 03:17:23 UTC (rev 390)
+++ tiki/examples/TikiTest/tikitest.cbp 2007-01-01 03:31:29 UTC (rev 391)
@@ -6,7 +6,7 @@
<Option title="TikiTest"/>
<Option makefile="Makefile"/>
<Option makefile_is_custom="0"/>
- <Option compiler="1"/>
+ <Option compiler="0"/>
<Build>
<Target title="default">
<Option output="C:\projects\tiki\examples\TikiTest\tikitest.exe"/>
@@ -14,7 +14,7 @@
<Option object_output=".objs"/>
<Option deps_output=".deps"/>
<Option type="0"/>
- <Option compiler="1"/>
+ <Option compiler="0"/>
<Option projectResourceIncludeDirsRelation="0"/>
</Target>
</Build>
@@ -26,19 +26,25 @@
<Add library="gdi32"/>
<Add library="user32"/>
<Add library="kernel32"/>
+ <Add library="tiki"/>
+ <Add library="opengl32"/>
+ <Add library="alut"/>
<Add directory="..\..\win32"/>
<Add directory="C:\Program Files\OpenAL 1.1 SDK\libs\Win32"/>
</Linker>
<Unit filename="src\TikiTest.cpp">
<Option compilerVar="CPP"/>
+ <Option objectName="TikiTest.obj"/>
<Option target="default"/>
</Unit>
<Unit filename="src\test.cpp">
<Option compilerVar="CPP"/>
+ <Option objectName="test.obj"/>
<Option target="default"/>
</Unit>
<Unit filename="src\testobj.cpp">
<Option compilerVar="CPP"/>
+ <Option objectName="testobj.obj"/>
<Option target="default"/>
</Unit>
<Unit filename="src\testobj.h">
Modified: tiki/examples/TikiTest/tikitest.layout
===================================================================
--- tiki/examples/TikiTest/tikitest.layout 2006-12-31 03:17:23 UTC (rev 390)
+++ tiki/examples/TikiTest/tikitest.layout 2007-01-01 03:31:29 UTC (rev 391)
@@ -7,6 +7,4 @@
<File name="src\test.cpp" open="0" top="0">
<Cursor position="5471" topLine="217"/>
</File>
- <Expand folder="/Sources/src"/>
- <Expand folder="/Sources"/>
</CodeBlocks_layout_file>
Modified: tiki/src/gl/texture.cpp
===================================================================
--- tiki/src/gl/texture.cpp 2006-12-31 03:17:23 UTC (rev 390)
+++ tiki/src/gl/texture.cpp 2007-01-01 03:31:29 UTC (rev 391)
@@ -65,10 +65,10 @@
void Texture::convertToGl() {
uint16 * src16 = (uint16 *)m_ptr;
uint8 * dst = m_txrdata;
-
+
if (m_fmt == RGBA8888)
return;
-
+
// The data needs to be converted from its source format to ARGB8888, and
// it needs to be Y-inverted as well.
// NOTE: The Y-inversion is only true so "proper" GL coordinates can be obtained.
@@ -117,7 +117,8 @@
}
}
-#if TIKI_PLAT == TIKI_WIN32
+#if TIKI_PLAT == TIKI_WIN32
+#if !defined(__GNUC__)
// Win32 doesn't seem to have this... perhaps it's not really ANSI?
static int strcasecmp(const char * cs,const char * ct) {
int c1, c2, res;
@@ -132,6 +133,7 @@
return res;
}
+#endif
#endif
@@ -211,17 +213,17 @@
/* We'll write the converted data into this buffer */
if (!m_txrdata)
m_txrdata = new uint8[img->w * img->h * 4];
-
+
convertToGl();
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, m_w, m_h, 0, GL_RGBA, GL_UNSIGNED_BYTE, m_txrdata);
-
+
GLenum err = glGetError();
#elif TIKI_PLAT == TIKI_DC
- m_txrdata = (uint8 *)pvr_mem_malloc(img->w * img->h * 2);
+ m_txrdata = (uint8 *)pvr_mem_malloc(img->w * img->h * 2);
pvr_txr_load_ex(m_ptr, m_txrdata, img->w, img->h, PVR_TXRLOAD_16BPP);
-
+
if(use_alpha) {
glKosTex2D(GL_ARGB4444_TWID, m_w, m_h, m_txrdata);
} else {
@@ -315,15 +317,19 @@
select();
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, gumode);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, gvmode);
-
+
// This provides the expected behavior on newer OpenGL impls...
-#if TIKI_PLAT != TIKI_DC
+#if TIKI_PLAT != TIKI_DC
+// for whatever reason the Windows 2003 R2 PSDK is only
+// OpenGL 1.1 which doesnt have GL_CLAMP_TO_EDGE
+#if !defined(GL_VERSION_1_1)
if (gumode == GL_CLAMP)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
if (gvmode == GL_CLAMP)
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
-#endif
-#endif
+ glTexParameteri(GL_EXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+#endif // GL_VERSION_1_1
+#endif // TIKI_DC
+#endif // TIKI_NDS
}
void * Texture::canvasLock() {
Modified: tiki/win32/tiki.cbp
===================================================================
--- tiki/win32/tiki.cbp 2006-12-31 03:17:23 UTC (rev 390)
+++ tiki/win32/tiki.cbp 2007-01-01 03:31:29 UTC (rev 391)
@@ -6,15 +6,15 @@
<Option title="Tiki"/>
<Option makefile="Makefile"/>
<Option makefile_is_custom="0"/>
- <Option compiler="1"/>
+ <Option compiler="0"/>
<Build>
<Target title="default">
- <Option output="C:\projects\tiki\win32\tiki.lib"/>
+ <Option output="libtiki.a"/>
<Option working_dir=""/>
<Option object_output=".objs"/>
<Option deps_output=".deps"/>
<Option type="2"/>
- <Option compiler="1"/>
+ <Option compiler="0"/>
<Option projectResourceIncludeDirsRelation="2"/>
</Target>
</Build>
@@ -28,8 +28,10 @@
<Add directory="..\3rdparty\zlib"/>
<Add directory="C:\Program Files\OpenAL 1.1 SDK\include"/>
<Add directory="C:\Program Files\Microsoft DirectX 9.0 SDK (February 2005)\Include"/>
+ <Add directory="..\3rdparty\libvorbis\lib"/>
</Compiler>
<Linker>
+ <Add library="opengl32"/>
<Add directory="C:\Program Files\OpenAL 1.1 SDK\libs\Win32"/>
<Add directory="C:\Program Files\Microsoft DirectX 9.0 SDK (February 2005)\Lib\x86"/>
</Linker>
Modified: tiki/win32/tiki.layout
===================================================================
--- tiki/win32/tiki.layout 2006-12-31 03:17:23 UTC (rev 390)
+++ tiki/win32/tiki.layout 2007-01-01 03:31:29 UTC (rev 391)
@@ -2,11 +2,17 @@
<!DOCTYPE CodeBlocks_layout_file>
<CodeBlocks_layout_file>
<File name="..\3rdparty\libjpeg\jconfig.h" open="0" top="0">
- <Cursor position="116" topLine="0"/>
+ <Cursor position="653" topLine="2"/>
</File>
+ <File name="..\3rdparty\libjpeg\jpeglib.h" open="0" top="0">
+ <Cursor position="1105" topLine="11"/>
+ </File>
<File name="..\3rdparty\libogg\src\bitwise.c" open="0" top="0">
<Cursor position="1119" topLine="0"/>
</File>
+ <File name="..\3rdparty\libvorbis\lib\modes\setup_44.h" open="0" top="0">
+ <Cursor position="956" topLine="1"/>
+ </File>
<File name="..\include\Tiki\stream.h" open="0" top="0">
<Cursor position="471" topLine="26"/>
</File>
@@ -16,9 +22,15 @@
<File name="..\src\audio\oggvorbis\sndoggvorbis.cpp" open="0" top="0">
<Cursor position="205" topLine="0"/>
</File>
+ <File name="..\src\audio\sound.cpp" open="0" top="0">
+ <Cursor position="42" topLine="5"/>
+ </File>
<File name="..\src\gl\animation.cpp" open="0" top="0">
<Cursor position="10" topLine="0"/>
</File>
+ <File name="..\src\gl\texture.cpp" open="0" top="0">
+ <Cursor position="7819" topLine="301"/>
+ </File>
<File name="include\Tiki\glhdrs.h" open="0" top="0">
<Cursor position="123" topLine="0"/>
</File>
@@ -46,12 +58,4 @@
<File name="src\tikitime.cpp" open="0" top="0">
<Cursor position="161" topLine="2"/>
</File>
- <Expand folder="/Sources/win32/src"/>
- <Expand folder="/Sources/win32"/>
- <Expand folder="/Sources"/>
- <Expand folder="/Headers/include"/>
- <Expand folder="/Headers/win32/include/Tiki"/>
- <Expand folder="/Headers/win32/include"/>
- <Expand folder="/Headers/win32"/>
- <Expand folder="/Headers"/>
</CodeBlocks_layout_file>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <c99...@us...> - 2007-02-28 19:54:52
|
Revision: 393
http://svn.sourceforge.net/cadcdev/?rev=393&view=rev
Author: c99koder
Date: 2007-02-28 11:43:35 -0800 (Wed, 28 Feb 2007)
Log Message:
-----------
Tiki: Dreamcast sound streaming wrapper
Modified Paths:
--------------
tiki/dc/src/audio/stream.cpp
tiki/include/Tiki/stream.h
Modified: tiki/dc/src/audio/stream.cpp
===================================================================
--- tiki/dc/src/audio/stream.cpp 2007-01-28 22:41:27 UTC (rev 392)
+++ tiki/dc/src/audio/stream.cpp 2007-02-28 19:43:35 UTC (rev 393)
@@ -3,6 +3,7 @@
stream.cpp
+ Copyright (C)2007 Sam Steele
Copyright (C)2005 Cryptic Allusion, LLC
*/
@@ -10,10 +11,33 @@
#include "Tiki/stream.h"
#include <string.h>
+#include <vector>
using namespace Tiki::Audio;
using namespace Tiki::Thread;
+Stream *streams[SND_STREAM_MAX];
+static uint8 pcm_buffer[SND_STREAM_BUFFER_MAX+16384];
+
+void *cbk(snd_stream_hnd_t hnd, int size, int * size_out) {
+ int pcm_decoded = 0;
+
+ /* Check if the callback requests more data than our buffer can hold */
+ if (size > SND_STREAM_BUFFER_MAX)
+ size = SND_STREAM_BUFFER_MAX;
+
+ pcm_decoded = size / (2 * streams[(int)hnd]->getChannelCount());
+ Stream::GetDataResult rv = streams[(int)hnd]->getData((uint16 *)pcm_buffer,&pcm_decoded);
+ pcm_decoded *= (2 * streams[(int)hnd]->getChannelCount());
+ if(rv == Stream::GDError || rv == Stream::GDEOS) {
+ *size_out = 0;
+ return NULL;
+ } else {
+ *size_out = pcm_decoded;
+ return pcm_buffer;
+ }
+}
+
TIKI_OBJECT_NAME(Stream)
TIKI_OBJECT_BEGIN(Object, Stream)
TIKI_OBJECT_RECEIVER("start", Stream::objectStart)
@@ -30,13 +54,15 @@
Stream::Stream() {
// Default our members.
- m_bufSize = 0x4000;
- m_chnCount = 2;
+ m_bufSize = SND_STREAM_BUFFER_MAX;
+ m_chnCount = 1;
m_freq = 44100;
m_queueing = false;
- m_isPlaying = false;
m_volume = 0.8f;
m_mutex = new Mutex();
+ m_thread = NULL;
+ m_threadActive = false;
+ m_state = StateStopped;
}
Stream::~Stream() {
@@ -44,16 +70,21 @@
}
bool Stream::create() {
- AutoLock lock(m_mutex);
+ destroy();
+
+ assert( m_state == StateStopped );
+ hnd = snd_stream_alloc(cbk,SND_STREAM_BUFFER_MAX);
+ streams[hnd] = this;
+
return true;
}
void Stream::destroy() {
- AutoLock lock(m_mutex);
+ stop();
+
+ assert( m_state == StateStopped );
}
-// virtual void filter(int freq, int chncount, void * buffer, int smpcnt) { }
-
void Stream::filterAdd(Filter * f) {
AutoLock lock(m_mutex);
@@ -85,24 +116,37 @@
}
void Stream::start() {
- AutoLock lock(m_mutex);
- m_isPlaying = true;
+ if (m_state != StateStopped)
+ return;
+
+ m_state = StatePlaying;
+ snd_stream_volume(hnd,int(255.0f * m_volume));
+ printf("Starting audio thread...\n");
+ m_threadActive = true;
+ m_thread = new Thread::Thread(alThreadProc, this);
}
void Stream::stop() {
- AutoLock lock(m_mutex);
+ if (m_state == StateStopped)
+ return;
- pause();
+ assert( m_thread );
+ m_threadActive = false;
+ printf("Joining audio thread...\n");
+ m_thread->join();
+ delete m_thread;
+ m_thread = NULL;
}
void Stream::pause() {
- AutoLock lock(m_mutex);
- m_isPlaying = false;
+ if (m_state != StatePlaying)
+ return;
+
+ m_state = StatePaused;
}
void Stream::resume() {
AutoLock lock(m_mutex);
- m_isPlaying = true;
}
void Stream::setVolume(float vol) {
@@ -112,9 +156,7 @@
}
bool Stream::isPlaying() {
- AutoLock lock(m_mutex);
-
- return m_isPlaying;
+ return m_state == StatePlaying;
}
int Stream::objectStart(Object * /*from*/, Object * /*arg*/) {
@@ -129,32 +171,31 @@
void Stream::processFilters(void * buffer, int smpcnt) {
}
-// "len" is a *sample* count.
-void Stream::sepData(void * buffer, int len, bool stereo, int16 * outl, int16 * outr) {
- int16 * sep_buffer[2] = { outl, outr };
- int16 * bufsrc, * bufdst;
- int cnt;
+void * Stream::alThreadProc(void * u) {
+ Stream * us = (Stream *)u;
+ us->threadProc();
+ return NULL;
+}
- if (stereo) {
- bufsrc = (int16*)buffer;
- bufdst = sep_buffer[0];
- cnt = len;
- do {
- *bufdst = *bufsrc;
- bufdst++; bufsrc+=2; cnt--;
- } while (cnt > 0);
+void Stream::threadProc() {
+ int stat;
+
+ printf("Starting stream...\n");
+ snd_stream_start(hnd,m_freq,m_chnCount-1);
- bufsrc = (int16*)buffer; bufsrc++;
- bufdst = sep_buffer[1];
- cnt = len;
- do {
- *bufdst = *bufsrc;
- bufdst++; bufsrc+=2; cnt--;
- } while (cnt > 0);
- } else {
- memcpy(sep_buffer[0], buffer, len * 2);
- memcpy(sep_buffer[1], buffer, len * 2);
+ while (m_threadActive) {
+ AutoLock lock(m_mutex);
+ if((stat = snd_stream_poll(hnd)) < 0) {
+ printf("Stopping, status: %d\n",stat);
+ m_threadActive = false;
+ }
+ lock.unlock();
+ thd_sleep(2);
}
+ printf("Stopping stream...\n");
+ snd_stream_stop(hnd);
+ m_state = StateStopped;
+ printf("Stream stopped\n");
}
Stream::GetDataResult Stream::getData(uint16 * buffer, int * numSamples) {
Modified: tiki/include/Tiki/stream.h
===================================================================
--- tiki/include/Tiki/stream.h 2007-01-28 22:41:27 UTC (rev 392)
+++ tiki/include/Tiki/stream.h 2007-02-28 19:43:35 UTC (rev 393)
@@ -75,6 +75,7 @@
void setQueueing(bool isQueued);
void setFrequency(int freq);
void setChannelCount(int chncount);
+ int getChannelCount() { return m_chnCount; }
virtual void start();
virtual void stop();
virtual void pause();
@@ -87,7 +88,7 @@
int objectStart(Object * from, Object * arg);
int objectStop(Object * from, Object * arg);
-protected:
+public:
// Your subclass must override this to provide data for the stream. When
// this is called, you should try to place numSamples samples into buffer.
// Return the disposition of the stream, and place the actual number of
@@ -103,8 +104,9 @@
};
virtual GetDataResult getData(uint16 * buffer, int * numSamples);
+protected:
void processFilters(void * buffer, int smpcnt);
-static void sepData(void * buffer, int len, bool stereo, int16 * outl, int16 * outr);
+ void sepData(void * buffer, int len, bool stereo, int16 * outl, int16 * outr);
protected:
@@ -128,11 +130,13 @@
ALuint m_buffers[2];
ALuint m_source;
ALenum m_format;
+#else
+
#endif
Thread::Thread * m_thread;
volatile bool m_threadActive;
-static void * alThreadProc(void * us);
+static void * alThreadProc(void * us);
void threadProc();
void check();
#if TIKI_PLAT != TIKI_DC && TIKI_PLAT != TIKI_NDS
@@ -141,7 +145,7 @@
#if TIKI_PLAT == TIKI_DC
private:
- bool m_isPlaying;
+ int hnd;
#endif
};
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ba...@us...> - 2007-04-15 20:59:49
|
Revision: 395
http://svn.sourceforge.net/cadcdev/?rev=395&view=rev
Author: bardtx
Date: 2007-04-15 13:59:34 -0700 (Sun, 15 Apr 2007)
Log Message:
-----------
tiki: make refcnt/refptr /actually/ thread-safe on win32 (we need some
solution for other plats that can have multiple cores still probably...)
Modified Paths:
--------------
tiki/include/Tiki/refcnt.h
tiki/src/base/object.cpp
Modified: tiki/include/Tiki/refcnt.h
===================================================================
--- tiki/include/Tiki/refcnt.h 2007-02-28 20:04:09 UTC (rev 394)
+++ tiki/include/Tiki/refcnt.h 2007-04-15 20:59:34 UTC (rev 395)
@@ -37,7 +37,11 @@
void unref();
protected:
+#if TIKI_PLAT == TIKI_WIN32
+ long m_refcnt;
+#else
int m_refcnt;
+#endif
};
/// A "smart pointer" to handle the RefCnt objects.
Modified: tiki/src/base/object.cpp
===================================================================
--- tiki/src/base/object.cpp 2007-02-28 20:04:09 UTC (rev 394)
+++ tiki/src/base/object.cpp 2007-04-15 20:59:34 UTC (rev 395)
@@ -25,19 +25,29 @@
void RefCnt::ref() {
assert( this != NULL );
+
+ // This actually ought to be in plat, probably...
+#if TIKI_PLAT == TIKI_WIN32
+ InterlockedIncrement(&m_refcnt);
+#else
m_refcnt++;
+#endif
}
void RefCnt::unref() {
assert( this != NULL );
+#if TIKI_PLAT == TIKI_WIN32
+ InterlockedDecrement(&m_refcnt);
+#else
m_refcnt--;
+#endif
+
if (m_refcnt < 0) {
Debug::printf("RefCnt::unref() refcount underflow! this=%p\n", this);
assert( false );
- } else {
- if (m_refcnt == 0)
- delete this;
+ } else if (m_refcnt == 0) {
+ delete this;
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <at...@us...> - 2007-06-28 07:40:25
|
Revision: 412
http://svn.sourceforge.net/cadcdev/?rev=412&view=rev
Author: atani
Date: 2007-06-28 00:40:21 -0700 (Thu, 28 Jun 2007)
Log Message:
-----------
updates for win32 build
Modified Paths:
--------------
tiki/examples/TikiTest/src/test.cpp
tiki/src/audio/sound.cpp
tiki/src/gl/drawables/console.cpp
tiki/src/gl/drawables/cursor.cpp
tiki/src/gl/drawables/pointerArrow.cpp
tiki/win32/src/plathid.cpp
tiki/win32/tiki_vc80.sln
tiki/win32/tiki_vs80.vcproj
Added Paths:
-----------
tiki/examples/TikiTest/TikiTest_vc80.vcproj
Added: tiki/examples/TikiTest/TikiTest_vc80.vcproj
===================================================================
--- tiki/examples/TikiTest/TikiTest_vc80.vcproj (rev 0)
+++ tiki/examples/TikiTest/TikiTest_vc80.vcproj 2007-06-28 07:40:21 UTC (rev 412)
@@ -0,0 +1,213 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="TikiTest"
+ ProjectGUID="{7B823C96-860C-4578-95BB-1087A45AF1AA}"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="$(SolutionDir)\include;$(SolutionDir)\..\include;"C:\Program Files\OpenAL 1.1 SDK\include""
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="gdi32.lib kernel32.lib user32.lib opengl32.lib glu32.lib comdlg32.lib"
+ LinkIncremental="2"
+ AdditionalLibraryDirectories="$(SolutionDir)\Debug;"C:\Program Files\OpenAL 1.1 SDK\libs\Win32""
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="$(SolutionDir)\include;$(SolutionDir)\..\include;"C:\Program Files\OpenAL 1.1 SDK\include""
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;"
+ RuntimeLibrary="0"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="gdi32.lib kernel32.lib user32.lib opengl32.lib glu32.lib comdlg32.lib"
+ LinkIncremental="1"
+ AdditionalLibraryDirectories="$(SolutionDir)\Release;C:\Program Files\OpenAL 1.1 SDK\libs\Win32"
+ IgnoreDefaultLibraryNames=""
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+ >
+ <File
+ RelativePath=".\src\testobj.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+ >
+ </Filter>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+ >
+ <File
+ RelativePath=".\src\test.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\src\testobj.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\src\TikiTest.cpp"
+ >
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
Modified: tiki/examples/TikiTest/src/test.cpp
===================================================================
--- tiki/examples/TikiTest/src/test.cpp 2007-05-25 14:37:18 UTC (rev 411)
+++ tiki/examples/TikiTest/src/test.cpp 2007-06-28 07:40:21 UTC (rev 412)
@@ -42,40 +42,40 @@
plx_mat3d_identity();
- vert.argb = Color(0,0,0);
- vert.z = 0.3;
+ vert.argb = Color(0, 0, 0);
+ vert.z = 0.3f;
vert.flags = PLX_VERT;
- vert.x = pos->x-2;
- vert.y = pos->y-4;
+ vert.x = static_cast<float>(pos->x - 2);
+ vert.y = static_cast<float>(pos->y - 4);
plx_prim(&vert, sizeof(vert));
vert.flags = PLX_VERT;
- vert.x = pos->x+18;
- vert.y = pos->y+16;
+ vert.x = static_cast<float>(pos->x + 18);
+ vert.y = static_cast<float>(pos->y + 16);
plx_prim(&vert, sizeof(vert));
vert.flags = PLX_VERT_EOS;
- vert.x = pos->x-2;
- vert.y = pos->y+24;
+ vert.x = static_cast<float>(pos->x - 2);
+ vert.y = static_cast<float>(pos->y + 24);
plx_prim(&vert, sizeof(vert));
- vert.argb = Color(0.8,0.2,0.1);
- vert.z = 0.31;
+ vert.argb = Color(0.8f, 0.2f, 0.1f);
+ vert.z = 0.31f;
vert.flags = PLX_VERT;
- vert.x = pos->x;
- vert.y = pos->y;
+ vert.x = static_cast<float>(pos->x);
+ vert.y = static_cast<float>(pos->y);
plx_prim(&vert, sizeof(vert));
vert.flags = PLX_VERT;
- vert.x = pos->x+15;
- vert.y = pos->y+15;
+ vert.x = static_cast<float>(pos->x + 15);
+ vert.y = static_cast<float>(pos->y + 15);
plx_prim(&vert, sizeof(vert));
vert.flags = PLX_VERT_EOS;
- vert.x = pos->x;
- vert.y = pos->y+21;
+ vert.x = static_cast<float>(pos->x);
+ vert.y = static_cast<float>(pos->y + 21);
plx_prim(&vert, sizeof(vert));
}
@@ -107,14 +107,14 @@
/* Iterate over stacks */
for ( i=0; i<stacks; i++ ) {
- pitch = 2*M_PI * ( (float)i/(float)stacks );
- pitch2 = 2*M_PI * ( (float)(i+1)/(float)stacks );
+ pitch = static_cast<float>(2*M_PI * ( (float)i/(float)stacks ));
+ pitch2 = static_cast<float>(2*M_PI * ( (float)(i+1)/(float)stacks ));
/* Iterate over slices: each entire stack will be one
long triangle strip. */
for ( j=0; j<=slices/2; j++ ) {
- yaw = 2*M_PI * ( (float)j/(float)slices );
- yaw2 = 2*M_PI * ( (float)(j+1)/(float)slices );
+ yaw = static_cast<float>(2*M_PI * ( (float)j/(float)slices ));
+ yaw2 = static_cast<float>(2*M_PI * ( (float)(j+1)/(float)slices ));
/* x, y+1 */
x = radius * fcos( yaw ) * fcos( pitch2 );
@@ -172,7 +172,7 @@
plx_mat3d_push();
for (i=0; i<SPHERE_CNT; i++) {
- plx_mat3d_translate(6.0f * fcos(i * 2*M_PI / SPHERE_CNT), 0.0f, 6.0f * fsin(i * 2*M_PI / SPHERE_CNT));
+ plx_mat3d_translate(6.0f * fcos(static_cast<float>(i * 2*M_PI / SPHERE_CNT)), 0.0f, 6.0f * fsin(static_cast<float>(i * 2*M_PI / SPHERE_CNT)));
plx_mat3d_rotate(r, 1.0f, 1.0f, 1.0f);
sphere(1.2f, 20, 20);
if (i < (SPHERE_CNT-1))
@@ -186,7 +186,7 @@
plx_mat3d_push();
for (i=0; i<SPHERE_CNT; i++) {
- plx_mat3d_translate(3.0f * fcos(i * 2*M_PI / SPHERE_CNT), 0.0f, 3.0f * fsin(i * 2*M_PI / SPHERE_CNT));
+ plx_mat3d_translate(3.0f * fcos(static_cast<float>(i * 2*M_PI / SPHERE_CNT)), 0.0f, 3.0f * fsin(static_cast<float>(i * 2*M_PI / SPHERE_CNT)));
plx_mat3d_rotate(r, 1.0f, 1.0f, 1.0f);
sphere(0.8f, 20, 20);
if (i < (SPHERE_CNT-1))
@@ -198,7 +198,7 @@
Frame::finish();
r+=dir;
- phase += 2*M_PI / 240.0f;
+ phase += static_cast<float>(2*M_PI / 240);
}
volatile bool quitting = false;
Modified: tiki/src/audio/sound.cpp
===================================================================
--- tiki/src/audio/sound.cpp 2007-05-25 14:37:18 UTC (rev 411)
+++ tiki/src/audio/sound.cpp 2007-06-28 07:40:21 UTC (rev 412)
@@ -124,7 +124,7 @@
char magic[4];
uint32 len, hz;
- uint16 *tmp, chn, bitsize, fmt;
+ uint16 chn, bitsize, fmt;
File wavFile(fn,"r");
wavFile.seek(8, SEEK_SET);
Modified: tiki/src/gl/drawables/console.cpp
===================================================================
--- tiki/src/gl/drawables/console.cpp 2007-05-25 14:37:18 UTC (rev 411)
+++ tiki/src/gl/drawables/console.cpp 2007-06-28 07:40:21 UTC (rev 412)
@@ -179,8 +179,8 @@
void ConsoleText::renderCharacter(float x, float y, float w, float h, unsigned char c, int attr) {
plx_vertex_t vert;
- float u = (c % 16) * 8;
- float v = (c / 16) * 8;
+ float u = static_cast<float>((c % 16) * 8);
+ float v = static_cast<float>((c / 16) * 8);
int color = attr & 0x07;
@@ -188,7 +188,7 @@
w *= sv.x;
h *= sv.y;
- const Vector & tv = getPosition() + Vector(x, y, 0.01);
+ const Vector & tv = getPosition() + Vector(x, y, 0.01f);
m_texture->select();
@@ -233,7 +233,7 @@
w *= sv.x;
h *= sv.y;
- const Vector & tv = getPosition() + Vector(x, y, -0.01);
+ const Vector & tv = getPosition() + Vector(x, y, -0.01f);
m_texture->deselect();
Modified: tiki/src/gl/drawables/cursor.cpp
===================================================================
--- tiki/src/gl/drawables/cursor.cpp 2007-05-25 14:37:18 UTC (rev 411)
+++ tiki/src/gl/drawables/cursor.cpp 2007-06-28 07:40:21 UTC (rev 412)
@@ -50,7 +50,7 @@
}
if (evt.type==Event::EvtMouseMove ) {
- setTranslate(Vector(evt.x,evt.y,getTranslate().z));
+ setTranslate(Vector(static_cast<float>(evt.x), static_cast<float>(evt.y), getTranslate().z));
}
}
Modified: tiki/src/gl/drawables/pointerArrow.cpp
===================================================================
--- tiki/src/gl/drawables/pointerArrow.cpp 2007-05-25 14:37:18 UTC (rev 411)
+++ tiki/src/gl/drawables/pointerArrow.cpp 2007-06-28 07:40:21 UTC (rev 412)
@@ -16,7 +16,7 @@
using namespace Tiki::GL::Plxcompat;
PointerArrow::PointerArrow() {
- setTint(Color(1.0,0.2,0.1));
+ setTint(Color(1.0f, 0.2f, 0.1f));
}
PointerArrow::~PointerArrow() {
@@ -48,7 +48,7 @@
plx_prim(&vert, sizeof(vert));
vert.argb = getTint();
- vert.z = tv.z + 0.01;
+ vert.z = tv.z + 0.01f;
vert.flags = PLX_VERT;
vert.x = tv.x;
Modified: tiki/win32/src/plathid.cpp
===================================================================
--- tiki/win32/src/plathid.cpp 2007-05-25 14:37:18 UTC (rev 411)
+++ tiki/win32/src/plathid.cpp 2007-06-28 07:40:21 UTC (rev 412)
@@ -161,7 +161,7 @@
}
evt.type = Event::EvtKeypress;
- for (int i=0; i<event.nRepeatCount; i++)
+ for (unsigned int i=0; i<event.nRepeatCount; i++)
sendEvent(evt);
}
break;
Modified: tiki/win32/tiki_vc80.sln
===================================================================
--- tiki/win32/tiki_vc80.sln 2007-05-25 14:37:18 UTC (rev 411)
+++ tiki/win32/tiki_vc80.sln 2007-06-28 07:40:21 UTC (rev 412)
@@ -1,7 +1,18 @@
+
Microsoft Visual Studio Solution File, Format Version 9.00
-# Visual Studio 2005
+# Visual C++ Express 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tiki", "tiki_vs80.vcproj", "{F2816CAC-B560-4ED9-8A73-9635F832943C}"
EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TikiTest", "..\examples\TikiTest\TikiTest_vc80.vcproj", "{7B823C96-860C-4578-95BB-1087A45AF1AA}"
+ ProjectSection(ProjectDependencies) = postProject
+ {F2816CAC-B560-4ED9-8A73-9635F832943C} = {F2816CAC-B560-4ED9-8A73-9635F832943C}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TikiSnake", "..\examples\console\TikiSnake\TikiSnake.vcproj", "{FCAE4EF3-7B5D-4C0D-8793-4157F7D8709F}"
+ ProjectSection(ProjectDependencies) = postProject
+ {F2816CAC-B560-4ED9-8A73-9635F832943C} = {F2816CAC-B560-4ED9-8A73-9635F832943C}
+ EndProjectSection
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
@@ -12,6 +23,14 @@
{F2816CAC-B560-4ED9-8A73-9635F832943C}.Debug|Win32.Build.0 = Debug|Win32
{F2816CAC-B560-4ED9-8A73-9635F832943C}.Release|Win32.ActiveCfg = Release|Win32
{F2816CAC-B560-4ED9-8A73-9635F832943C}.Release|Win32.Build.0 = Release|Win32
+ {7B823C96-860C-4578-95BB-1087A45AF1AA}.Debug|Win32.ActiveCfg = Debug|Win32
+ {7B823C96-860C-4578-95BB-1087A45AF1AA}.Debug|Win32.Build.0 = Debug|Win32
+ {7B823C96-860C-4578-95BB-1087A45AF1AA}.Release|Win32.ActiveCfg = Release|Win32
+ {7B823C96-860C-4578-95BB-1087A45AF1AA}.Release|Win32.Build.0 = Release|Win32
+ {FCAE4EF3-7B5D-4C0D-8793-4157F7D8709F}.Debug|Win32.ActiveCfg = Debug|Win32
+ {FCAE4EF3-7B5D-4C0D-8793-4157F7D8709F}.Debug|Win32.Build.0 = Debug|Win32
+ {FCAE4EF3-7B5D-4C0D-8793-4157F7D8709F}.Release|Win32.ActiveCfg = Release|Win32
+ {FCAE4EF3-7B5D-4C0D-8793-4157F7D8709F}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Modified: tiki/win32/tiki_vs80.vcproj
===================================================================
--- tiki/win32/tiki_vs80.vcproj 2007-05-25 14:37:18 UTC (rev 411)
+++ tiki/win32/tiki_vs80.vcproj 2007-06-28 07:40:21 UTC (rev 412)
@@ -4,6 +4,7 @@
Version="8.00"
Name="tiki"
ProjectGUID="{F2816CAC-B560-4ED9-8A73-9635F832943C}"
+ RootNamespace="tiki"
Keyword="Win32Proj"
>
<Platforms>
@@ -41,8 +42,8 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
- AdditionalIncludeDirectories="include;../include;../3rdparty/libpng;../3rdparty/zlib;../3rdparty/libjpeg;../3rdparty/libogg/include;../3rdparty/libvorbis/include;"C:\Program Files\OpenAL 1.1 SDK\include""
- PreprocessorDefinitions="_WIN32_WINNT=0x0500"
+ AdditionalIncludeDirectories=""$(SolutionDir)\include";"$(SolutionDir)\..\include";"C:\Program Files\OpenAL 1.1 SDK\include";"$(SolutionDir)\..\3rdparty\libjpeg";"$(SolutionDir)\..\3rdparty\libogg\include";"$(SolutionDir)\..\3rdparty\libpng";"$(SolutionDir)\..\3rdparty\libvorbis\include";"$(SolutionDir)\..\3rdparty\zlib""
+ PreprocessorDefinitions="_WIN32_WINNT=0x0500;_CRT_SECURE_NO_WARNINGS=1"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
@@ -107,8 +108,8 @@
/>
<Tool
Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="include;../include;../3rdparty/libpng;../3rdparty/zlib;../3rdparty/libjpeg;../3rdparty/libogg/include;../3rdparty/libvorbis/include;"C:\Program Files\OpenAL 1.1 SDK\include""
- PreprocessorDefinitions="_WIN32_WINNT=0x0500"
+ AdditionalIncludeDirectories=""$(SolutionDir)\include";"$(SolutionDir)\..\include";"C:\Program Files\OpenAL 1.1 SDK\include";"$(SolutionDir)\..\3rdparty\libjpeg";"$(SolutionDir)\..\3rdparty\libogg\include";"$(SolutionDir)\..\3rdparty\libpng";"$(SolutionDir)\..\3rdparty\libvorbis\include";"$(SolutionDir)\..\3rdparty\zlib""
+ PreprocessorDefinitions="_WIN32_WINNT=0x0500; _CRT_SECURE_NO_WARNINGS=1"
RuntimeLibrary="0"
UsePrecompiledHeader="2"
PrecompiledHeaderThrough="pch.h"
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <c99...@us...> - 2007-07-01 04:19:15
|
Revision: 414
http://svn.sourceforge.net/cadcdev/?rev=414&view=rev
Author: c99koder
Date: 2007-06-30 21:19:13 -0700 (Sat, 30 Jun 2007)
Log Message:
-----------
Tiki: Nintendo DS build fixes
Modified Paths:
--------------
tiki/nds/Makefile
tiki/nds/Makefile.rules
tiki/src/base/file.cpp
tiki/src/hid/eventcollector.cpp
Modified: tiki/nds/Makefile
===================================================================
--- tiki/nds/Makefile 2007-06-29 05:36:10 UTC (rev 413)
+++ tiki/nds/Makefile 2007-07-01 04:19:13 UTC (rev 414)
@@ -51,7 +51,7 @@
$(AR) ru libtiki.a $(BASE_OBJS) $(THIRD_PARTY_OBJS)
clean: clean_subdirs
- -rm -f $(BASE_OBJS) libtiki.a
+ -rm -f $(BASE_OBJS) $(THIRD_PARTY_OBJS) libtiki.a
DEPSDIR=$(CURDIR)
TIKI_DIR=$(CURDIR)/..
Modified: tiki/nds/Makefile.rules
===================================================================
--- tiki/nds/Makefile.rules 2007-06-29 05:36:10 UTC (rev 413)
+++ tiki/nds/Makefile.rules 2007-07-01 04:19:13 UTC (rev 414)
@@ -25,9 +25,9 @@
CXXFLAGS+=-I$(TIKI_DIR)/3rdparty/libvorbis/include
CXXFLAGS+=-I$(TIKI_DIR)/3rdparty/libvorbis/lib
CXXFLAGS+=-DARM9
-CXXFLAGS+=-mcpu=arm9tdmi -mtune=arm9tdmi -ffast-math -mthumb -mthumb-interwork
+CXXFLAGS+=-march=armv5te -mtune=arm946e-s -fomit-frame-pointer -ffast-math -mthumb -mthumb-interwork
CFLAGS=$(CXXFLAGS)
-CXXFLAGS+=-fno-rtti
+CXXFLAGS+=-fno-rtti -fno-exceptions
LDFLAGS=-specs=ds_arm9.specs -mthumb -mthumb-interwork -mno-fpu -L$(DEVKITPRO)/lib -lgcc
Modified: tiki/src/base/file.cpp
===================================================================
--- tiki/src/base/file.cpp 2007-06-29 05:36:10 UTC (rev 413)
+++ tiki/src/base/file.cpp 2007-07-01 04:19:13 UTC (rev 414)
@@ -9,6 +9,9 @@
#include "pch.h"
#include "Tiki/file.h"
+#if TIKI_PLAT == TIKI_NDS
+#include <sys/param.h>
+#endif
#include <machine/endian.h>
File::File() {
Modified: tiki/src/hid/eventcollector.cpp
===================================================================
--- tiki/src/hid/eventcollector.cpp 2007-06-29 05:36:10 UTC (rev 413)
+++ tiki/src/hid/eventcollector.cpp 2007-07-01 04:19:13 UTC (rev 414)
@@ -13,7 +13,9 @@
EventCollector::EventCollector(bool startListening) {
m_cookie = -1;
+#if TIKI_PLAT != TIKI_NDS
m_mutex = new Thread::Mutex();
+#endif
if (startListening)
start();
}
@@ -24,14 +26,18 @@
}
void EventCollector::start() {
+#if TIKI_PLAT != TIKI_NDS
Thread::AutoLock lock(m_mutex);
+#endif
assert( m_cookie < 0 );
m_cookie = callbackReg(hidCallbackStatic, this);
}
void EventCollector::stop() {
+#if TIKI_PLAT != TIKI_NDS
Thread::AutoLock lock(m_mutex);
+#endif
assert( m_cookie >= 0 );
callbackUnreg(m_cookie);
@@ -41,12 +47,16 @@
}
bool EventCollector::eventsAvailable() const {
+#if TIKI_PLAT != TIKI_NDS
Thread::AutoLock lock(m_mutex);
+#endif
return !m_events.empty();
}
bool EventCollector::getEvent(Event & evtOut) {
+#if TIKI_PLAT != TIKI_NDS
Thread::AutoLock lock(m_mutex);
+#endif
if (m_events.empty())
return false;
@@ -60,7 +70,9 @@
}
void EventCollector::hidCallback(const Event & evt) {
+#if TIKI_PLAT != TIKI_NDS
Thread::AutoLock lock(m_mutex);
+#endif
if (m_cookie >= 0)
m_events.push(evt);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <c99...@us...> - 2007-07-17 23:24:52
|
Revision: 418
http://svn.sourceforge.net/cadcdev/?rev=418&view=rev
Author: c99koder
Date: 2007-07-17 16:24:50 -0700 (Tue, 17 Jul 2007)
Log Message:
-----------
Tiki: Move the list of platforms into tiki.h
Modified Paths:
--------------
tiki/dc/include/Tiki/tikitypes.h
tiki/gp2x/include/Tiki/tikitypes.h
tiki/include/Tiki/tiki.h
tiki/nds/include/Tiki/tikitypes.h
tiki/osx/include/Tiki/tikitypes.h
tiki/sdl/include/Tiki/tikitypes.h
tiki/win32/include/Tiki/tikitypes.h
Modified: tiki/dc/include/Tiki/tikitypes.h
===================================================================
--- tiki/dc/include/Tiki/tikitypes.h 2007-07-17 23:06:07 UTC (rev 417)
+++ tiki/dc/include/Tiki/tikitypes.h 2007-07-17 23:24:50 UTC (rev 418)
@@ -16,11 +16,7 @@
#include <dc/sound/stream.h>
#include <dc/sound/sfxmgr.h>
-// This gets included in the main tiki.h, so it should suffice.
-#define TIKI_OSX 0
-#define TIKI_WIN32 1
-#define TIKI_SDL 2
-#define TIKI_DC 3
+//Define our platform
#define TIKI_PLAT TIKI_DC
namespace Tiki {
Modified: tiki/gp2x/include/Tiki/tikitypes.h
===================================================================
--- tiki/gp2x/include/Tiki/tikitypes.h 2007-07-17 23:06:07 UTC (rev 417)
+++ tiki/gp2x/include/Tiki/tikitypes.h 2007-07-17 23:24:50 UTC (rev 418)
@@ -12,12 +12,7 @@
#include <stddef.h>
-// This gets included in the main tiki.h, so it should suffice.
-#define TIKI_OSX 0
-#define TIKI_WIN32 1
-#define TIKI_SDL 2
-#define TIKI_DC 3
-#define TIKI_GP2X 4
+// Define our platform
#define TIKI_PLAT TIKI_GP2X
namespace Tiki {
Modified: tiki/include/Tiki/tiki.h
===================================================================
--- tiki/include/Tiki/tiki.h 2007-07-17 23:06:07 UTC (rev 417)
+++ tiki/include/Tiki/tiki.h 2007-07-17 23:24:50 UTC (rev 418)
@@ -24,6 +24,14 @@
}
}
+// Define our supported platforms
+#define TIKI_OSX 0
+#define TIKI_WIN32 1
+#define TIKI_SDL 2
+#define TIKI_DC 3
+#define TIKI_GP2X 4
+#define TIKI_NDS 5
+
// Bring in our custom types.
#include "Tiki/tikitypes.h"
Modified: tiki/nds/include/Tiki/tikitypes.h
===================================================================
--- tiki/nds/include/Tiki/tikitypes.h 2007-07-17 23:06:07 UTC (rev 417)
+++ tiki/nds/include/Tiki/tikitypes.h 2007-07-17 23:24:50 UTC (rev 418)
@@ -14,13 +14,7 @@
#include <sys/cdefs.h>
#include <nds/jtypes.h>
-// This gets included in the main tiki.h, so it should suffice.
-#define TIKI_OSX 0
-#define TIKI_WIN32 1
-#define TIKI_SDL 2
-#define TIKI_DC 3
-#define TIKI_GP2X 4
-#define TIKI_NDS 5
+// Define our platform
#define TIKI_PLAT TIKI_NDS
namespace Tiki {
Modified: tiki/osx/include/Tiki/tikitypes.h
===================================================================
--- tiki/osx/include/Tiki/tikitypes.h 2007-07-17 23:06:07 UTC (rev 417)
+++ tiki/osx/include/Tiki/tikitypes.h 2007-07-17 23:24:50 UTC (rev 418)
@@ -12,13 +12,7 @@
#include <stddef.h>
-// This gets included in the main tiki.h, so it should suffice.
-#define TIKI_OSX 0
-#define TIKI_WIN32 1
-#define TIKI_SDL 2
-#define TIKI_DC 3
-#define TIKI_GP2X 4
-#define TIKI_NDS 5
+// Define our platform
#define TIKI_PLAT TIKI_OSX
namespace Tiki {
Modified: tiki/sdl/include/Tiki/tikitypes.h
===================================================================
--- tiki/sdl/include/Tiki/tikitypes.h 2007-07-17 23:06:07 UTC (rev 417)
+++ tiki/sdl/include/Tiki/tikitypes.h 2007-07-17 23:24:50 UTC (rev 418)
@@ -12,11 +12,7 @@
#include <stddef.h>
-// This gets included in the main tiki.h, so it should suffice.
-#define TIKI_OSX 0
-#define TIKI_WIN32 1
-#define TIKI_SDL 2
-#define TIKI_DC 3
+// Define our platform
#define TIKI_PLAT TIKI_SDL
namespace Tiki {
Modified: tiki/win32/include/Tiki/tikitypes.h
===================================================================
--- tiki/win32/include/Tiki/tikitypes.h 2007-07-17 23:06:07 UTC (rev 417)
+++ tiki/win32/include/Tiki/tikitypes.h 2007-07-17 23:24:50 UTC (rev 418)
@@ -12,13 +12,7 @@
#include <stddef.h>
-// Figure out our platform.
-#define TIKI_OSX 0
-#define TIKI_WIN32 1
-#define TIKI_SDL 2
-#define TIKI_DC 3
-#define TIKI_GP2X 4
-#define TIKI_NDS 5
+// Define our platform
#define TIKI_PLAT TIKI_WIN32
namespace Tiki {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <at...@us...> - 2007-08-09 22:49:07
|
Revision: 435
http://cadcdev.svn.sourceforge.net/cadcdev/?rev=435&view=rev
Author: atani
Date: 2007-08-09 15:48:59 -0700 (Thu, 09 Aug 2007)
Log Message:
-----------
astyle --style=kr -t -P -K -a
Modified Paths:
--------------
tiki/3rdparty/libjpeg/README
tiki/3rdparty/libjpeg/jcapimin.c
tiki/3rdparty/libjpeg/jcapistd.c
tiki/3rdparty/libjpeg/jccoefct.c
tiki/3rdparty/libjpeg/jccolor.c
tiki/3rdparty/libjpeg/jcdctmgr.c
tiki/3rdparty/libjpeg/jchuff.c
tiki/3rdparty/libjpeg/jchuff.h
tiki/3rdparty/libjpeg/jcinit.c
tiki/3rdparty/libjpeg/jcmainct.c
tiki/3rdparty/libjpeg/jcmarker.c
tiki/3rdparty/libjpeg/jcmaster.c
tiki/3rdparty/libjpeg/jcomapi.c
tiki/3rdparty/libjpeg/jconfig.h
tiki/3rdparty/libjpeg/jcparam.c
tiki/3rdparty/libjpeg/jcphuff.c
tiki/3rdparty/libjpeg/jcprepct.c
tiki/3rdparty/libjpeg/jcsample.c
tiki/3rdparty/libjpeg/jctrans.c
tiki/3rdparty/libjpeg/jdapimin.c
tiki/3rdparty/libjpeg/jdapistd.c
tiki/3rdparty/libjpeg/jdatadst.c
tiki/3rdparty/libjpeg/jdatasrc.c
tiki/3rdparty/libjpeg/jdcoefct.c
tiki/3rdparty/libjpeg/jdcolor.c
tiki/3rdparty/libjpeg/jdct.h
tiki/3rdparty/libjpeg/jddctmgr.c
tiki/3rdparty/libjpeg/jdhuff.c
tiki/3rdparty/libjpeg/jdhuff.h
tiki/3rdparty/libjpeg/jdinput.c
tiki/3rdparty/libjpeg/jdmainct.c
tiki/3rdparty/libjpeg/jdmarker.c
tiki/3rdparty/libjpeg/jdmaster.c
tiki/3rdparty/libjpeg/jdmerge.c
tiki/3rdparty/libjpeg/jdphuff.c
tiki/3rdparty/libjpeg/jdpostct.c
tiki/3rdparty/libjpeg/jdsample.c
tiki/3rdparty/libjpeg/jdtrans.c
tiki/3rdparty/libjpeg/jerror.c
tiki/3rdparty/libjpeg/jerror.h
tiki/3rdparty/libjpeg/jfdctflt.c
tiki/3rdparty/libjpeg/jfdctfst.c
tiki/3rdparty/libjpeg/jfdctint.c
tiki/3rdparty/libjpeg/jidctflt.c
tiki/3rdparty/libjpeg/jidctfst.c
tiki/3rdparty/libjpeg/jidctint.c
tiki/3rdparty/libjpeg/jidctred.c
tiki/3rdparty/libjpeg/jinclude.h
tiki/3rdparty/libjpeg/jmemmgr.c
tiki/3rdparty/libjpeg/jmemnobs.c
tiki/3rdparty/libjpeg/jmemsys.h
tiki/3rdparty/libjpeg/jmorecfg.h
tiki/3rdparty/libjpeg/jpegint.h
tiki/3rdparty/libjpeg/jpeglib.h
tiki/3rdparty/libjpeg/jquant1.c
tiki/3rdparty/libjpeg/jquant2.c
tiki/3rdparty/libjpeg/jversion.h
tiki/3rdparty/libpng/png.h
tiki/3rdparty/libpng/pngconf.h
tiki/3rdparty/libvorbis/lib/backends.h
tiki/3rdparty/libvorbis/lib/bitrate.h
tiki/3rdparty/libvorbis/lib/codebook.h
tiki/3rdparty/libvorbis/lib/codec_internal.h
tiki/3rdparty/libvorbis/lib/envelope.h
tiki/3rdparty/libvorbis/lib/highlevel.h
tiki/3rdparty/libvorbis/lib/lookup.h
tiki/3rdparty/libvorbis/lib/lookup_data.h
tiki/3rdparty/libvorbis/lib/lpc.h
tiki/3rdparty/libvorbis/lib/lsp.h
tiki/3rdparty/libvorbis/lib/masking.h
tiki/3rdparty/libvorbis/lib/mdct.h
tiki/3rdparty/libvorbis/lib/misc.h
tiki/3rdparty/libvorbis/lib/os.h
tiki/3rdparty/libvorbis/lib/psy.h
tiki/3rdparty/libvorbis/lib/registry.h
tiki/3rdparty/libvorbis/lib/scales.h
tiki/3rdparty/libvorbis/lib/smallft.h
tiki/3rdparty/libvorbis/lib/window.h
tiki/3rdparty/zlib/crc32.h
tiki/3rdparty/zlib/deflate.h
tiki/3rdparty/zlib/inffast.h
tiki/3rdparty/zlib/inffixed.h
tiki/3rdparty/zlib/inflate.h
tiki/3rdparty/zlib/inftrees.h
tiki/3rdparty/zlib/trees.h
tiki/3rdparty/zlib/zconf.h
tiki/3rdparty/zlib/zlib.h
tiki/3rdparty/zlib/zutil.h
tiki/dc/include/Tiki/glhdrs.h
tiki/dc/include/Tiki/platthread.h
tiki/dc/include/Tiki/tikitypes.h
tiki/dc/include/pch.h
tiki/dc/include/sys/queue.h
tiki/dc/src/audio/sound.cpp
tiki/dc/src/audio/stream.cpp
tiki/dc/src/init_shutdown.cpp
tiki/dc/src/platgl.cpp
tiki/dc/src/plathid.cpp
tiki/dc/src/platthread.cpp
tiki/dc/src/tikitime.cpp
tiki/gp2x/include/GLES/egl.h
tiki/gp2x/include/GLES/egltypes.h
tiki/gp2x/include/GLES/gl.h
tiki/gp2x/include/GLES/glext.h
tiki/gp2x/include/Tiki/glhdrs.h
tiki/gp2x/include/Tiki/platthread.h
tiki/gp2x/include/Tiki/tikitypes.h
tiki/gp2x/include/minimal.h
tiki/gp2x/include/minimal_940t.h
tiki/gp2x/include/pch.h
tiki/gp2x/include/sys/queue.h
tiki/gp2x/src/init_shutdown.cpp
tiki/gp2x/src/platgl.cpp
tiki/gp2x/src/plathid.cpp
tiki/gp2x/src/platthread.cpp
tiki/gp2x/src/rlyeh-minimal.cpp
tiki/gp2x/src/tikitime.cpp
tiki/include/Tiki/animation.h
tiki/include/Tiki/bspline.h
tiki/include/Tiki/color.h
tiki/include/Tiki/color3.h
tiki/include/Tiki/debug.h
tiki/include/Tiki/drawable.h
tiki/include/Tiki/endian.h
tiki/include/Tiki/eventcollector.h
tiki/include/Tiki/file.h
tiki/include/Tiki/font.h
tiki/include/Tiki/genmenu.h
tiki/include/Tiki/gl.h
tiki/include/Tiki/hid.h
tiki/include/Tiki/image.h
tiki/include/Tiki/imgjpg.h
tiki/include/Tiki/imgpng.h
tiki/include/Tiki/list.h
tiki/include/Tiki/matrix.h
tiki/include/Tiki/object.h
tiki/include/Tiki/oggvorbis.h
tiki/include/Tiki/plxcompat.h
tiki/include/Tiki/refcnt.h
tiki/include/Tiki/scene.h
tiki/include/Tiki/sound.h
tiki/include/Tiki/stream.h
tiki/include/Tiki/tee.h
tiki/include/Tiki/texture.h
tiki/include/Tiki/thread.h
tiki/include/Tiki/tiki.h
tiki/include/Tiki/tikimath.h
tiki/include/Tiki/tikitime.h
tiki/include/Tiki/timeline.h
tiki/include/Tiki/timepoint.h
tiki/include/Tiki/trigger.h
tiki/include/Tiki/vector.h
tiki/include/Tiki/vector3.h
tiki/nds/arm7_template/source/dssoundstream.h
tiki/nds/include/Tiki/glhdrs.h
tiki/nds/include/Tiki/platthread.h
tiki/nds/include/Tiki/tikitypes.h
tiki/nds/include/dssoundstream.h
tiki/nds/include/pch.h
tiki/nds/src/audio/sound.cpp
tiki/nds/src/audio/stream.cpp
tiki/nds/src/init_shutdown.cpp
tiki/nds/src/platgl.cpp
tiki/nds/src/plathid.cpp
tiki/nds/src/platthread.cpp
tiki/nds/src/tikitime.cpp
tiki/osx/include/Tiki/TikiMain.h
tiki/osx/include/Tiki/glhdrs.h
tiki/osx/include/Tiki/platthread.h
tiki/osx/include/Tiki/tikitypes.h
tiki/osx/include/pch.h
tiki/osx/src/init_shutdown.cpp
tiki/osx/src/platgl.cpp
tiki/osx/src/platthread.cpp
tiki/osx/src/tikitime.cpp
tiki/sdl/include/Tiki/glhdrs.h
tiki/sdl/include/Tiki/platthread.h
tiki/sdl/include/Tiki/tikitypes.h
tiki/sdl/include/pch.h
tiki/sdl/include/sys/queue.h
tiki/sdl/src/init_shutdown.cpp
tiki/sdl/src/platgl.cpp
tiki/sdl/src/plathid.cpp
tiki/sdl/src/platthread.cpp
tiki/sdl/src/tikitime.cpp
tiki/src/audio/oggvorbis/misc.h
tiki/src/audio/oggvorbis/sndoggvorbis.cpp
tiki/src/audio/sound.cpp
tiki/src/audio/stream.cpp
tiki/src/base/debug.cpp
tiki/src/base/endian.cpp
tiki/src/base/file.cpp
tiki/src/base/object.cpp
tiki/src/base/timeline.cpp
tiki/src/base/timepoint.cpp
tiki/src/gl/animation.cpp
tiki/src/gl/drawable.cpp
tiki/src/gl/font.cpp
tiki/src/gl/genmenu.cpp
tiki/src/gl/gl.cpp
tiki/src/gl/plxcompat.cpp
tiki/src/gl/texture.cpp
tiki/src/gl/trigger.cpp
tiki/src/hid/eventcollector.cpp
tiki/src/hid/hid.cpp
tiki/src/image/image.cpp
tiki/src/image/loadjpg.cpp
tiki/src/image/loadpng.cpp
tiki/src/math/bspline.cpp
tiki/src/math/math.cpp
tiki/src/math/matrix.cpp
tiki/src/math/vector.cpp
tiki/src/math/vector3.cpp
tiki/src/thread/thread.cpp
tiki/win32/include/Tiki/glhdrs.h
tiki/win32/include/Tiki/tikitypes.h
tiki/win32/include/pch.h
tiki/win32/include/sys/cdefs.h
tiki/win32/include/sys/queue.h
tiki/win32/src/init_shutdown.cpp
tiki/win32/src/platgl.cpp
tiki/win32/src/plathid.cpp
tiki/win32/src/platthread.cpp
tiki/win32/src/tikitime.cpp
Modified: tiki/3rdparty/libjpeg/README
===================================================================
--- tiki/3rdparty/libjpeg/README 2007-08-09 21:57:40 UTC (rev 434)
+++ tiki/3rdparty/libjpeg/README 2007-08-09 22:48:59 UTC (rev 435)
@@ -5,381 +5,392 @@
====================================
This distribution contains the sixth public release of the Independent JPEG
-Group's free JPEG software. You are welcome to redistribute this software and
+Group's free JPEG software. You are welcome to redistribute this software and
to use it for any purpose, subject to the conditions under LEGAL ISSUES, below.
-Serious users of this software (particularly those incorporating it into
-larger programs) should contact IJG at jpe...@uu... to be added to
-our electronic mailing list. Mailing list members are notified of updates
-and have a chance to participate in technical discussions, etc.
+Serious users of this software ( particularly those incorporating it into
+ larger programs )
+ should contact IJG at jpeg - in...@uu... to be added to
+ our electronic mailing list. Mailing list members are notified of updates
+ and have a chance to participate in technical discussions, etc.
-This software is the work of Tom Lane, Philip Gladstone, Jim Boucher,
-Lee Crocker, Julian Minguillon, Luis Ortiz, George Phillips, Davide Rossi,
-Guido Vollbeding, Ge' Weijers, and other members of the Independent JPEG
-Group.
+ This software is the work of Tom Lane, Philip Gladstone, Jim Boucher,
+ Lee Crocker, Julian Minguillon, Luis Ortiz, George Phillips, Davide Rossi,
+ Guido Vollbeding, Ge' Weijers, and other members of the Independent JPEG
+ Group.
-IJG is not affiliated with the official ISO JPEG standards committee.
+ IJG is not affiliated with the official ISO JPEG standards committee.
-DOCUMENTATION ROADMAP
-=====================
+ DOCUMENTATION ROADMAP
+ =====================
-This file contains the following sections:
+ This file contains the following sections:
-OVERVIEW General description of JPEG and the IJG software.
-LEGAL ISSUES Copyright, lack of warranty, terms of distribution.
-REFERENCES Where to learn more about JPEG.
-ARCHIVE LOCATIONS Where to find newer versions of this software.
-RELATED SOFTWARE Other stuff you should get.
-FILE FORMAT WARS Software *not* to get.
-TO DO Plans for future IJG releases.
+ OVERVIEW General description of JPEG and the IJG software.
+ LEGAL ISSUES Copyright, lack of warranty, terms of distribution.
+ REFERENCES Where to learn more about JPEG.
+ ARCHIVE LOCATIONS Where to find newer versions of this software.
+ RELATED SOFTWARE Other stuff you should get.
+ FILE FORMAT WARS Software *not* to get.
+ TO DO Plans for future IJG releases.
-Other documentation files in the distribution are:
+ Other documentation files in the distribution are:
-User documentation:
- install.doc How to configure and install the IJG software.
- usage.doc Usage instructions for cjpeg, djpeg, jpegtran,
- rdjpgcom, and wrjpgcom.
- *.1 Unix-style man pages for programs (same info as usage.doc).
- wizard.doc Advanced usage instructions for JPEG wizards only.
- change.log Version-to-version change highlights.
-Programmer and internal documentation:
- libjpeg.doc How to use the JPEG library in your own programs.
- example.c Sample code for calling the JPEG library.
- structure.doc Overview of the JPEG library's internal structure.
- filelist.doc Road map of IJG files.
- coderules.doc Coding style rules --- please read if you contribute code.
+ User documentation:
+ install.doc How to configure and install the IJG software.
+ usage.doc Usage instructions for cjpeg, djpeg, jpegtran,
+ rdjpgcom, and wrjpgcom.
+ *.1 Unix-style man pages for programs (same info as usage.doc).
+ wizard.doc Advanced usage instructions for JPEG wizards only.
+ change.log Version-to-version change highlights.
+ Programmer and internal documentation:
+ libjpeg.doc How to use the JPEG library in your own programs.
+ example.c Sample code for calling the JPEG library.
+ structure.doc Overview of the JPEG library's internal structure.
+ filelist.doc Road map of IJG files.
+ coderules.doc Coding style rules -- - please read if you contribute code.
-Please read at least the files install.doc and usage.doc. Useful information
-can also be found in the JPEG FAQ (Frequently Asked Questions) article. See
-ARCHIVE LOCATIONS below to find out where to obtain the FAQ article.
+ Please read at least the files install.doc and usage.doc. Useful information
+ can also be found in the JPEG FAQ ( Frequently Asked Questions )
+ article. See
+ ARCHIVE LOCATIONS below to find out where to obtain the FAQ article.
-If you want to understand how the JPEG code works, we suggest reading one or
-more of the REFERENCES, then looking at the documentation files (in roughly
-the order listed) before diving into the code.
+ If you want to understand how the JPEG code works, we suggest reading one or
+ more of the REFERENCES, then looking at the documentation files ( in roughly
+ the order listed ) before diving into the code.
-OVERVIEW
-========
+ OVERVIEW
+ == == == ==
-This package contains C software to implement JPEG image compression and
-decompression. JPEG (pronounced "jay-peg") is a standardized compression
-method for full-color and gray-scale images. JPEG is intended for compressing
-"real-world" scenes; line drawings, cartoons and other non-realistic images
-are not its strong suit. JPEG is lossy, meaning that the output image is not
-exactly identical to the input image. Hence you must not use JPEG if you
-have to have identical output bits. However, on typical photographic images,
+ This package contains C software to implement JPEG image compression and
+ decompression. JPEG ( pronounced "jay-peg" ) is a standardized compression
+ method for full - color and gray - scale images. JPEG is intended for compressing
+ "real-world" scenes;
+line drawings, cartoons and other non - realistic images
+are not its strong suit. JPEG is lossy, meaning that the output image is not
+exactly identical to the input image. Hence you must not use JPEG if you
+have to have identical output bits. However, on typical photographic images,
very good compression levels can be obtained with no visible change, and
remarkably high compression levels are possible if you can tolerate a
-low-quality image. For more details, see the references, or just experiment
-with various compression settings.
+ low - quality image. For more details, see the references, or just experiment
+ with various compression settings.
-This software implements JPEG baseline, extended-sequential, and progressive
-compression processes. Provision is made for supporting all variants of these
-processes, although some uncommon parameter settings aren't implemented yet.
-For legal reasons, we are not distributing code for the arithmetic-coding
-variants of JPEG; see LEGAL ISSUES. We have made no provision for supporting
-the hierarchical or lossless processes defined in the standard.
+ This software implements JPEG baseline, extended - sequential, and progressive
+ compression processes. Provision is made for supporting all variants of these
+ processes, although some uncommon parameter settings aren't implemented yet.
+ For legal reasons, we are not distributing code for the arithmetic-coding
+ variants of JPEG; see LEGAL ISSUES. We have made no provision for supporting
+ the hierarchical or lossless processes defined in the standard.
-We provide a set of library routines for reading and writing JPEG image files,
-plus two sample applications "cjpeg" and "djpeg", which use the library to
-perform conversion between JPEG and some other popular image file formats.
-The library is intended to be reused in other applications.
+ We provide a set of library routines for reading and writing JPEG image files,
+ plus two sample applications "cjpeg" and "djpeg", which use the library to
+ perform conversion between JPEG and some other popular image file formats.
+ The library is intended to be reused in other applications.
-In order to support file conversion and viewing software, we have included
-considerable functionality beyond the bare JPEG coding/decoding capability;
-for example, the color quantization modules are not strictly part of JPEG
-decoding, but they are essential for output to colormapped file formats or
-colormapped displays. These extra functions can be compiled out of the
-library if not required for a particular application. We have also included
-"jpegtran", a utility for lossless transcoding between different JPEG
-processes, and "rdjpgcom" and "wrjpgcom", two simple applications for
-inserting and extracting textual comments in JFIF files.
+ In order to support file conversion and viewing software, we have included
+ considerable functionality beyond the bare JPEG coding/decoding capability;
+ for example, the color quantization modules are not strictly part of JPEG
+ decoding, but they are essential for output to colormapped file formats or
+ colormapped displays. These extra functions can be compiled out of the
+ library if not required for a particular application. We have also included
+ "jpegtran", a utility for lossless transcoding between different JPEG
+ processes, and "rdjpgcom" and "wrjpgcom", two simple applications for
+ inserting and extracting textual comments in JFIF files.
-The emphasis in designing this software has been on achieving portability and
-flexibility, while also making it fast enough to be useful. In particular,
-the software is not intended to be read as a tutorial on JPEG. (See the
-REFERENCES section for introductory material.) Rather, it is intended to
-be reliable, portable, industrial-strength code. We do not claim to have
-achieved that goal in every aspect of the software, but we strive for it.
+ The emphasis in designing this software has been on achieving portability and
+ flexibility, while also making it fast enough to be useful. In particular,
+ the software is not intended to be read as a tutorial on JPEG. (See the
+ REFERENCES section for introductory material.) Rather, it is intended to
+ be reliable, portable, industrial-strength code. We do not claim to have
+ achieved that goal in every aspect of the software, but we strive for it.
-We welcome the use of this software as a component of commercial products.
-No royalty is required, but we do ask for an acknowledgement in product
-documentation, as described under LEGAL ISSUES.
+ We welcome the use of this software as a component of commercial products.
+ No royalty is required, but we do ask for an acknowledgement in product
+ documentation, as described under LEGAL ISSUES.
-LEGAL ISSUES
-============
+ LEGAL ISSUES
+ ============
-In plain English:
+ In plain English:
-1. We don't promise that this software works. (But if you find any bugs,
- please let us know!)
-2. You can use this software for whatever you want. You don't have to pay us.
-3. You may not pretend that you wrote this software. If you use it in a
- program, you must acknowledge somewhere in your documentation that
- you've used the IJG code.
+ 1. We don't promise that this software works. ( But if you find any bugs,
+ please let us know! )
+ 2. You can use this software for whatever you want. You don't have to pay us.
+ 3. You may not pretend that you wrote this software. If you use it in a
+ program, you must acknowledge somewhere in your documentation that
+ you've used the IJG code.
In legalese:
-The authors make NO WARRANTY or representation, either express or implied,
-with respect to this software, its quality, accuracy, merchantability, or
-fitness for a particular purpose. This software is provided "AS IS", and you,
-its user, assume the entire risk as to its quality and accuracy.
+ The authors make NO WARRANTY or representation, either express or implied,
+ with respect to this software, its quality, accuracy, merchantability, or
+ fitness for a particular purpose. This software is provided "AS IS", and you,
+ its user, assume the entire risk as to its quality and accuracy.
-This software is copyright (C) 1991-1998, Thomas G. Lane.
-All Rights Reserved except as specified below.
+ This software is copyright ( C )
+ 1991 - 1998, Thomas G. Lane.
+ All Rights Reserved except as specified below.
-Permission is hereby granted to use, copy, modify, and distribute this
-software (or portions thereof) for any purpose, without fee, subject to these
+ Permission is hereby granted to use, copy, modify, and distribute this
+ software ( or portions thereof ) for any purpose, without fee, subject to these
conditions:
-(1) If any part of the source code for this software is distributed, then this
-README file must be included, with this copyright and no-warranty notice
-unaltered; and any additions, deletions, or changes to the original files
+ ( 1 )
+ If any part of the source code for this software is distributed, then this
+ README file must be included, with this copyright and no - warranty notice
+ unaltered;
+and any additions, deletions, or changes to the original files
must be clearly indicated in accompanying documentation.
-(2) If only executable code is distributed, then the accompanying
+( 2 )
+If only executable code is distributed, then the accompanying
documentation must state that "this software is based in part on the work of
the Independent JPEG Group".
-(3) Permission for use of this software is granted only if the user accepts
-full responsibility for any undesirable consequences; the authors accept
+( 3 ) Permission for use of this software is granted only if the user accepts
+ full responsibility for any undesirable consequences;
+the authors accept
NO LIABILITY for damages of any kind.
These conditions apply to any software derived from or based on the IJG code,
-not just to the unmodified library. If you use our work, you ought to
+not just to the unmodified library. If you use our work, you ought to
acknowledge us.
Permission is NOT granted for the use of any IJG author's name or company name
-in advertising or publicity relating to this software or products derived from
-it. This software may be referred to only as "the Independent JPEG Group's
-software".
+ in advertising or publicity relating to this software or products derived from
+ it. This software may be referred to only as "the Independent JPEG Group's
+ software".
-We specifically permit and encourage the use of this software as the basis of
-commercial products, provided that all warranty or liability claims are
-assumed by the product vendor.
+ We specifically permit and encourage the use of this software as the basis of
+ commercial products, provided that all warranty or liability claims are
+ assumed by the product vendor.
-ansi2knr.c is included in this distribution by permission of L. Peter Deutsch,
-sole proprietor of its copyright holder, Aladdin Enterprises of Menlo Park, CA.
-ansi2knr.c is NOT covered by the above copyright and conditions, but instead
-by the usual distribution terms of the Free Software Foundation; principally,
-that you must include source code if you redistribute it. (See the file
-ansi2knr.c for full details.) However, since ansi2knr.c is not needed as part
-of any program generated from the IJG code, this does not limit you more than
-the foregoing paragraphs do.
+ ansi2knr.c is included in this distribution by permission of L. Peter Deutsch,
+ sole proprietor of its copyright holder, Aladdin Enterprises of Menlo Park, CA.
+ ansi2knr.c is NOT covered by the above copyright and conditions, but instead
+ by the usual distribution terms of the Free Software Foundation; principally,
+ that you must include source code if you redistribute it. (See the file
+ ansi2knr.c for full details.) However, since ansi2knr.c is not needed as part
+ of any program generated from the IJG code, this does not limit you more than
+ the foregoing paragraphs do.
-The Unix configuration script "configure" was produced with GNU Autoconf.
-It is copyright by the Free Software Foundation but is freely distributable.
-The same holds for its supporting scripts (config.guess, config.sub,
-ltconfig, ltmain.sh). Another support script, install-sh, is copyright
-by M.I.T. but is also freely distributable.
+ The Unix configuration script "configure" was produced with GNU Autoconf.
+ It is copyright by the Free Software Foundation but is freely distributable.
+ The same holds for its supporting scripts (config.guess, config.sub,
+ ltconfig, ltmain.sh). Another support script, install-sh, is copyright
+ by M.I.T. but is also freely distributable.
-It appears that the arithmetic coding option of the JPEG spec is covered by
-patents owned by IBM, AT&T, and Mitsubishi. Hence arithmetic coding cannot
-legally be used without obtaining one or more licenses. For this reason,
-support for arithmetic coding has been removed from the free JPEG software.
-(Since arithmetic coding provides only a marginal gain over the unpatented
-Huffman mode, it is unlikely that very many implementations will support it.)
-So far as we are aware, there are no patent restrictions on the remaining
-code.
+ It appears that the arithmetic coding option of the JPEG spec is covered by
+ patents owned by IBM, AT&T, and Mitsubishi. Hence arithmetic coding cannot
+ legally be used without obtaining one or more licenses. For this reason,
+ support for arithmetic coding has been removed from the free JPEG software.
+ (Since arithmetic coding provides only a marginal gain over the unpatented
+ Huffman mode, it is unlikely that very many implementations will support it.)
+ So far as we are aware, there are no patent restrictions on the remaining
+ code.
-The IJG distribution formerly included code to read and write GIF files.
-To avoid entanglement with the Unisys LZW patent, GIF reading support has
-been removed altogether, and the GIF writer has been simplified to produce
-"uncompressed GIFs". This technique does not use the LZW algorithm; the
-resulting GIF files are larger than usual, but are readable by all standard
-GIF decoders.
+ The IJG distribution formerly included code to read and write GIF files.
+ To avoid entanglement with the Unisys LZW patent, GIF reading support has
+ been removed altogether, and the GIF writer has been simplified to produce
+ "uncompressed GIFs". This technique does not use the LZW algorithm; the
+ resulting GIF files are larger than usual, but are readable by all standard
+ GIF decoders.
-We are required to state that
- "The Graphics Interchange Format(c) is the Copyright property of
- CompuServe Incorporated. GIF(sm) is a Service Mark property of
- CompuServe Incorporated."
+ We are required to state that
+ "The Graphics Interchange Format( c )
+ is the Copyright property of
+ CompuServe Incorporated. GIF( sm ) is a Service Mark property of
+ CompuServe Incorporated."
-REFERENCES
-==========
+ REFERENCES
+ ==========
-We highly recommend reading one or more of these references before trying to
-understand the innards of the JPEG software.
+ We highly recommend reading one or more of these references before trying to
+ understand the innards of the JPEG software.
-The best short technical introduction to the JPEG compression algorithm is
- Wallace, Gregory K. "The JPEG Still Picture Compression Standard",
- Communications of the ACM, April 1991 (vol. 34 no. 4), pp. 30-44.
-(Adjacent articles in that issue discuss MPEG motion picture compression,
-applications of JPEG, and related topics.) If you don't have the CACM issue
-handy, a PostScript file containing a revised version of Wallace's article is
-available at ftp://ftp.uu.net/graphics/jpeg/wallace.ps.gz. The file (actually
-a preprint for an article that appeared in IEEE Trans. Consumer Electronics)
-omits the sample images that appeared in CACM, but it includes corrections
-and some added material. Note: the Wallace article is copyright ACM and IEEE,
-and it may not be used for commercial purposes.
+ The best short technical introduction to the JPEG compression algorithm is
+ Wallace, Gregory K. "The JPEG Still Picture Compression Standard",
+ Communications of the ACM, April 1991 (vol. 34 no. 4), pp. 30-44.
+ (Adjacent articles in that issue discuss MPEG motion picture compression,
+ applications of JPEG, and related topics.) If you don't have the CACM issue
+ handy, a PostScript file containing a revised version of Wallace's article is
+ available at ftp://ftp.uu.net/graphics/jpeg/wallace.ps.gz. The file (actually
+ a preprint for an article that appeared in IEEE Trans. Consumer Electronics)
+ omits the sample images that appeared in CACM, but it includes corrections
+ and some added material. Note: the Wallace article is copyright ACM and IEEE,
+ and it may not be used for commercial purposes.
-A somewhat less technical, more leisurely introduction to JPEG can be found in
-"The Data Compression Book" by Mark Nelson and Jean-loup Gailly, published by
-M&T Books (New York), 2nd ed. 1996, ISBN 1-55851-434-1. This book provides
-good explanations and example C code for a multitude of compression methods
-including JPEG. It is an excellent source if you are comfortable reading C
-code but don't know much about data compression in general. The book's JPEG
-sample code is far from industrial-strength, but when you are ready to look
-at a full implementation, you've got one here...
+ A somewhat less technical, more leisurely introduction to JPEG can be found in
+ "The Data Compression Book" by Mark Nelson and Jean-loup Gailly, published by
+ M&T Books (New York), 2nd ed. 1996, ISBN 1-55851-434-1. This book provides
+ good explanations and example C code for a multitude of compression methods
+ including JPEG. It is an excellent source if you are comfortable reading C
+ code but don't know much about data compression in general. The book's JPEG
+ sample cod...
[truncated message content] |
|
From: <at...@us...> - 2007-08-09 23:13:05
|
Revision: 437
http://cadcdev.svn.sourceforge.net/cadcdev/?rev=437&view=rev
Author: atani
Date: 2007-08-09 16:13:03 -0700 (Thu, 09 Aug 2007)
Log Message:
-----------
astyle cleanups
Modified Paths:
--------------
tiki/3rdparty/libjpeg/jquant2.c
tiki/3rdparty/libpng/png.h
tiki/3rdparty/libpng/pngconf.h
tiki/gp2x/Makefile
tiki/sdl/Makefile
Modified: tiki/3rdparty/libjpeg/jquant2.c
===================================================================
--- tiki/3rdparty/libjpeg/jquant2.c 2007-08-09 22:51:20 UTC (rev 436)
+++ tiki/3rdparty/libjpeg/jquant2.c 2007-08-09 23:13:03 UTC (rev 437)
@@ -0,0 +1,1332 @@
+/*
+* jquant2.c
+*
+* Copyright (C) 1991-1996, Thomas G. Lane.
+* This file is part of the Independent JPEG Group's software.
+* For conditions of distribution and use, see the accompanying README file.
+*
+* This file contains 2-pass color quantization (color mapping) routines.
+* These routines provide selection of a custom color map for an image,
+* followed by mapping of the image to that color map, with optional
+* Floyd-Steinberg dithering.
+* It is also possible to use just the second pass to map to an arbitrary
+* externally-given color map.
+*
+* Note: ordered dithering is not supported, since there isn't any fast
+* way to compute intercolor distances; it's unclear that ordered dither's
+* fundamental assumptions even hold with an irregularly spaced color map.
+*/
+
+#define JPEG_INTERNALS
+#include "jinclude.h"
+#include "jpeglib.h"
+
+#ifdef QUANT_2PASS_SUPPORTED
+
+
+/*
+ * This module implements the well-known Heckbert paradigm for color
+ * quantization. Most of the ideas used here can be traced back to
+ * Heckbert's seminal paper
+ * Heckbert, Paul. "Color Image Quantization for Frame Buffer Display",
+ * Proc. SIGGRAPH '82, Computer Graphics v.16 #3 (July 1982), pp 297-304.
+ *
+ * In the first pass over the image, we accumulate a histogram showing the
+ * usage count of each possible color. To keep the histogram to a reasonable
+ * size, we reduce the precision of the input; typical practice is to retain
+ * 5 or 6 bits per color, so that 8 or 4 different input values are counted
+ * in the same histogram cell.
+ *
+ * Next, the color-selection step begins with a box representing the whole
+ * color space, and repeatedly splits the "largest" remaining box until we
+ * have as many boxes as desired colors. Then the mean color in each
+ * remaining box becomes one of the possible output colors.
+ *
+ * The second pass over the image maps each input pixel to the closest output
+ * color (optionally after applying a Floyd-Steinberg dithering correction).
+ * This mapping is logically trivial, but making it go fast enough requires
+ * considerable care.
+ *
+ * Heckbert-style quantizers vary a good deal in their policies for choosing
+ * the "largest" box and deciding where to cut it. The particular policies
+ * used here have proved out well in experimental comparisons, but better ones
+ * may yet be found.
+ *
+ * In earlier versions of the IJG code, this module quantized in YCbCr color
+ * space, processing the raw upsampled data without a color conversion step.
+ * This allowed the color conversion math to be done only once per colormap
+ * entry, not once per pixel. However, that optimization precluded other
+ * useful optimizations (such as merging color conversion with upsampling)
+ * and it also interfered with desired capabilities such as quantizing to an
+ * externally-supplied colormap. We have therefore abandoned that approach.
+ * The present code works in the post-conversion color space, typically RGB.
+ *
+ * To improve the visual quality of the results, we actually work in scaled
+ * RGB space, giving G distances more weight than R, and R in turn more than
+ * B. To do everything in integer math, we must use integer scale factors.
+ * The 2/3/1 scale factors used here correspond loosely to the relative
+ * weights of the colors in the NTSC grayscale equation.
+ * If you want to use this code to quantize a non-RGB color space, you'll
+ * probably need to change these scale factors.
+ */
+
+#define R_SCALE 2 /* scale R distances by this much */
+#define G_SCALE 3 /* scale G distances by this much */
+#define B_SCALE 1 /* and B by this much */
+
+/* Relabel R/G/B as components 0/1/2, respecting the RGB ordering defined
+ * in jmorecfg.h. As the code stands, it will do the right thing for R,G,B
+ * and B,G,R orders. If you define some other weird order in jmorecfg.h,
+ * you'll get compile errors until you extend this logic. In that case
+ * you'll probably want to tweak the histogram sizes too.
+ */
+
+#if RGB_RED == 0
+#define C0_SCALE R_SCALE
+#endif
+#if RGB_BLUE == 0
+#define C0_SCALE B_SCALE
+#endif
+#if RGB_GREEN == 1
+#define C1_SCALE G_SCALE
+#endif
+#if RGB_RED == 2
+#define C2_SCALE R_SCALE
+#endif
+#if RGB_BLUE == 2
+#define C2_SCALE B_SCALE
+#endif
+
+
+/*
+ * First we have the histogram data structure and routines for creating it.
+ *
+ * The number of bits of precision can be adjusted by changing these symbols.
+ * We recommend keeping 6 bits for G and 5 each for R and B.
+ * If you have plenty of memory and cycles, 6 bits all around gives marginally
+ * better results; if you are short of memory, 5 bits all around will save
+ * some space but degrade the results.
+ * To maintain a fully accurate histogram, we'd need to allocate a "long"
+ * (preferably unsigned long) for each cell. In practice this is overkill;
+ * we can get by with 16 bits per cell. Few of the cell counts will overflow,
+ * and clamping those that do overflow to the maximum value will give close-
+ * enough results. This reduces the recommended histogram size from 256Kb
+ * to 128Kb, which is a useful savings on PC-class machines.
+ * (In the second pass the histogram space is re-used for pixel mapping data;
+ * in that capacity, each cell must be able to store zero to the number of
+ * desired colors. 16 bits/cell is plenty for that too.)
+ * Since the JPEG code is intended to run in small memory model on 80x86
+ * machines, we can't just allocate the histogram in one chunk. Instead
+ * of a true 3-D array, we use a row of pointers to 2-D arrays. Each
+ * pointer corresponds to a C0 value (typically 2^5 = 32 pointers) and
+ * each 2-D array has 2^6*2^5 = 2048 or 2^6*2^6 = 4096 entries. Note that
+ * on 80x86 machines, the pointer row is in near memory but the actual
+ * arrays are in far memory (same arrangement as we use for image arrays).
+ */
+
+#define MAXNUMCOLORS (MAXJSAMPLE+1) /* maximum size of colormap */
+
+/* These will do the right thing for either R,G,B or B,G,R color order,
+ * but you may not like the results for other color orders.
+ */
+#define HIST_C0_BITS 5 /* bits of precision in R/B histogram */
+#define HIST_C1_BITS 6 /* bits of precision in G histogram */
+#define HIST_C2_BITS 5 /* bits of precision in B/R histogram */
+
+/* Number of elements along histogram axes. */
+#define HIST_C0_ELEMS (1<<HIST_C0_BITS)
+#define HIST_C1_ELEMS (1<<HIST_C1_BITS)
+#define HIST_C2_ELEMS (1<<HIST_C2_BITS)
+
+/* These are the amounts to shift an input value to get a histogram index. */
+#define C0_SHIFT (BITS_IN_JSAMPLE-HIST_C0_BITS)
+#define C1_SHIFT (BITS_IN_JSAMPLE-HIST_C1_BITS)
+#define C2_SHIFT (BITS_IN_JSAMPLE-HIST_C2_BITS)
+
+
+typedef UINT16 histcell; /* histogram cell; prefer an unsigned type */
+
+typedef histcell FAR * histptr; /* for pointers to histogram cells */
+
+typedef histcell hist1d[ HIST_C2_ELEMS ]; /* typedefs for the array */
+typedef hist1d FAR * hist2d; /* type for the 2nd-level pointers */
+typedef hist2d * hist3d; /* type for top-level pointer */
+
+
+/* Declarations for Floyd-Steinberg dithering.
+ *
+ * Errors are accumulated into the array fserrors[], at a resolution of
+ * 1/16th of a pixel count. The error at a given pixel is propagated
+ * to its not-yet-processed neighbors using the standard F-S fractions,
+ * ... (here) 7/16
+ * 3/16 5/16 1/16
+ * We work left-to-right on even rows, right-to-left on odd rows.
+ *
+ * We can get away with a single array (holding one row's worth of errors)
+ * by using it to store the current row's errors at pixel columns not yet
+ * processed, but the next row's errors at columns already processed. We
+ * need only a few extra variables to hold the errors immediately around the
+ * current column. (If we are lucky, those variables are in registers, but
+ * even if not, they're probably cheaper to access than array elements are.)
+ *
+ * The fserrors[] array has (#columns + 2) entries; the extra entry at
+ * each end saves us from special-casing the first and last pixels.
+ * Each entry is three values long, one value for each color component.
+ *
+ * Note: on a wide image, we might not have enough room in a PC's near data
+ * segment to hold the error array; so it is allocated with alloc_large.
+ */
+
+#if BITS_IN_JSAMPLE == 8
+typedef INT16 FSERROR; /* 16 bits should be enough */
+typedef int LOCFSERROR; /* use 'int' for calculation temps */
+#else
+typedef INT32 FSERROR; /* may need more than 16 bits */
+typedef INT32 LOCFSERROR; /* be sure calculation temps are big enough */
+#endif
+
+typedef FSERROR FAR *FSERRPTR; /* pointer to error array (in FAR storage!) */
+
+
+/* Private subobject */
+
+typedef struct {
+ struct jpeg_color_quantizer pub; /* public fields */
+
+ /* Space for the eventually created colormap is stashed here */
+ JSAMPARRAY sv_colormap; /* colormap allocated at init time */
+ int desired; /* desired # of colors = size of colormap */
+
+ /* Variables for accumulating image statistics */
+ hist3d histogram; /* pointer to the histogram */
+
+ boolean needs_zeroed; /* TRUE if next pass must zero histogram */
+
+ /* Variables for Floyd-Steinberg dithering */
+ FSERRPTR fserrors; /* accumulated errors */
+ boolean on_odd_row; /* flag to remember which row we are on */
+ int * error_limiter; /* table for clamping the applied error */
+}
+my_cquantizer;
+
+typedef my_cquantizer * my_cquantize_ptr;
+
+
+/*
+ * Prescan some rows of pixels.
+ * In this module the prescan simply updates the histogram, which has been
+ * initialized to zeroes by start_pass.
+ * An output_buf parameter is required by the method signature, but no data
+ * is actually output (in fact the buffer controller is probably passing a
+ * NULL pointer).
+ */
+
+METHODDEF( void )
+prescan_quantize ( j_decompress_ptr cinfo, JSAMPARRAY input_buf,
+ JSAMPARRAY output_buf, int num_rows ) {
+ my_cquantize_ptr cquantize = ( my_cquantize_ptr ) cinfo->cquantize;
+ register JSAMPROW ptr;
+ register histptr histp;
+ register hist3d histogram = cquantize->histogram;
+ int row;
+ JDIMENSION col;
+ JDIMENSION width = cinfo->output_width;
+
+ for ( row = 0; row < num_rows; row++ ) {
+ ptr = input_buf[ row ];
+ for ( col = width; col > 0; col-- ) {
+ /* get pixel value and index into the histogram */
+ histp = & histogram[ GETJSAMPLE( ptr[ 0 ] ) >> C0_SHIFT ]
+ [ GETJSAMPLE( ptr[ 1 ] ) >> C1_SHIFT ]
+ [ GETJSAMPLE( ptr[ 2 ] ) >> C2_SHIFT ];
+ /* increment, check for overflow and undo increment if so. */
+ if ( ++( *histp ) <= 0 )
+ ( *histp ) --;
+ ptr += 3;
+ }
+ }
+}
+
+
+/*
+ * Next we have the really interesting routines: selection of a colormap
+ * given the completed histogram.
+ * These routines work with a list of "boxes", each representing a rectangular
+ * subset of the input color space (to histogram precision).
+ */
+
+typedef struct {
+ /* The bounds of the box (inclusive); expressed as histogram indexes */
+ int c0min, c0max;
+ int c1min, c1max;
+ int c2min, c2max;
+ /* The volume (actually 2-norm) of the box */
+ INT32 volume;
+ /* The number of nonzero histogram cells within this box */
+ long colorcount;
+}
+box;
+
+typedef box * boxptr;
+
+
+LOCAL( boxptr )
+find_biggest_color_pop ( boxptr boxlist, int numboxes )
+/* Find the splittable box with the largest color population */
+/* Returns NULL if no splittable boxes remain */
+{
+ register boxptr boxp;
+ register int i;
+ register long maxc = 0;
+ boxptr which = NULL;
+
+ for ( i = 0, boxp = boxlist; i < numboxes; i++, boxp++ ) {
+ if ( boxp->colorcount > maxc && boxp->volume > 0 ) {
+ which = boxp;
+ maxc = boxp->colorcount;
+ }
+ }
+ return which;
+}
+
+
+LOCAL( boxptr )
+find_biggest_volume ( boxptr boxlist, int numboxes )
+/* Find the splittable box with the largest (scaled) volume */
+/* Returns NULL if no splittable boxes remain */
+{
+ register boxptr boxp;
+ register int i;
+ register INT32 maxv = 0;
+ boxptr which = NULL;
+
+ for ( i = 0, boxp = boxlist; i < numboxes; i++, boxp++ ) {
+ if ( boxp->volume > maxv ) {
+ which = boxp;
+ maxv = boxp->volume;
+ }
+ }
+ return which;
+}
+
+
+LOCAL( void )
+update_box ( j_decompress_ptr cinfo, boxptr boxp )
+/* Shrink the min/max bounds of a box to enclose only nonzero elements, */
+/* and recompute its volume and population */
+{
+ my_cquantize_ptr cquantize = ( my_cquantize_ptr ) cinfo->cquantize;
+ hist3d histogram = cquantize->histogram;
+ histptr histp;
+ int c0, c1, c2;
+ int c0min, c0max, c1min, c1max, c2min, c2max;
+ INT32 dist0, dist1, dist2;
+ long ccount;
+
+ c0min = boxp->c0min;
+ c0max = boxp->c0max;
+ c1min = boxp->c1min;
+ c1max = boxp->c1max;
+ c2min = boxp->c2min;
+ c2max = boxp->c2max;
+
+ if ( c0max > c0min )
+ for ( c0 = c0min; c0 <= c0max; c0++ )
+ for ( c1 = c1min; c1 <= c1max; c1++ ) {
+ histp = & histogram[ c0 ][ c1 ][ c2min ];
+ for ( c2 = c2min; c2 <= c2max; c2++ )
+ if ( *histp++ != 0 ) {
+ boxp->c0min = c0min = c0;
+ goto have_c0min;
+ }
+ }
+have_c0min:
+ if ( c0max > c0min )
+ for ( c0 = c0max; c0 >= c0min; c0-- )
+ for ( c1 = c1min; c1 <= c1max; c1++ ) {
+ histp = & histogram[ c0 ][ c1 ][ c2min ];
+ for ( c2 = c2min; c2 <= c2max; c2++ )
+ if ( *histp++ != 0 ) {
+ boxp->c0max = c0max = c0;
+ goto have_c0max;
+ }
+ }
+have_c0max:
+ if ( c1max > c1min )
+ for ( c1 = c1min; c1 <= c1max; c1++ )
+ for ( c0 = c0min; c0 <= c0max; c0++ ) {
+ histp = & histogram[ c0 ][ c1 ][ c2min ];
+ for ( c2 = c2min; c2 <= c2max; c2++ )
+ if ( *histp++ != 0 ) {
+ boxp->c1min = c1min = c1;
+ goto have_c1min;
+ }
+ }
+have_c1min:
+ if ( c1max > c1min )
+ for ( c1 = c1max; c1 >= c1min; c1-- )
+ for ( c0 = c0min; c0 <= c0max; c0++ ) {
+ histp = & histogram[ c0 ][ c1 ][ c2min ];
+ for ( c2 = c2min; c2 <= c2max; c2++ )
+ if ( *histp++ != 0 ) {
+ boxp->c1max = c1max = c1;
+ goto have_c1max;
+ }
+ }
+have_c1max:
+ if ( c2max > c2min )
+ for ( c2 = c2min; c2 <= c2max; c2++ )
+ for ( c0 = c0min; c0 <= c0max; c0++ ) {
+ histp = & histogram[ c0 ][ c1min ][ c2 ];
+ for ( c1 = c1min; c1 <= c1max; c1++, histp += HIST_C2_ELEMS )
+ if ( *histp != 0 ) {
+ boxp->c2min = c2min = c2;
+ goto have_c2min;
+ }
+ }
+have_c2min:
+ if ( c2max > c2min )
+ for ( c2 = c2max; c2 >= c2min; c2-- )
+ for ( c0 = c0min; c0 <= c0max; c0++ ) {
+ histp = & histogram[ c0 ][ c1min ][ c2 ];
+ for ( c1 = c1min; c1 <= c1max; c1++, histp += HIST_C2_ELEMS )
+ if ( *histp != 0 ) {
+ boxp->c2max = c2max = c2;
+ goto have_c2max;
+ }
+ }
+have_c2max:
+
+ /* Update box volume.
+ * We use 2-norm rather than real volume here; this biases the method
+ * against making long narrow boxes, and it has the side benefit that
+ * a box is splittable iff norm > 0.
+ * Since the differences are expressed in histogram-cell units,
+ * we have to shift back to JSAMPLE units to get consistent distances;
+ * after which, we scale according to the selected distance scale factors.
+ */
+ dist0 = ( ( c0max - c0min ) << C0_SHIFT ) * C0_SCALE;
+ dist1 = ( ( c1max - c1min ) << C1_SHIFT ) * C1_SCALE;
+ dist2 = ( ( c2max - c2min ) << C2_SHIFT ) * C2_SCALE;
+ boxp->volume = dist0 * dist0 + dist1 * dist1 + dist2 * dist2;
+
+ /* Now scan remaining volume of box and compute population */
+ ccount = 0;
+ for ( c0 = c0min; c0 <= c0max; c0++ )
+ for ( c1 = c1min; c1 <= c1max; c1++ ) {
+ histp = & histogram[ c0 ][ c1 ][ c2min ];
+ for ( c2 = c2min; c2 <= c2max; c2++, histp++ )
+ if ( *histp != 0 ) {
+ ccount++;
+ }
+ }
+ boxp->colorcount = ccount;
+}
+
+
+LOCAL( int )
+median_cut ( j_decompress_ptr cinfo, boxptr boxlist, int numboxes,
+ int desired_colors )
+/* Repeatedly select and split the largest box until we have enough boxes */
+{
+ int n, lb;
+ int c0, c1, c2, cmax;
+ register boxptr b1, b2;
+
+ while ( numboxes < desired_colors ) {
+ /* Select box to split.
+ * Current algorithm: by population for first half, then by volume.
+ */
+ if ( numboxes * 2 <= desired_colors ) {
+ b1 = find_biggest_color_pop( boxlist, numboxes );
+ } else {
+ b1 = find_biggest_volume( boxlist, numboxes );
+ }
+ if ( b1 == NULL ) /* no splittable boxes left! */
+ break;
+ b2 = &boxlist[ numboxes ]; /* where new box will go */
+ /* Copy the color bounds to the new box. */
+ b2->c0max = b1->c0max;
+ b2->c1max = b1->c1max;
+ b2->c2max = b1->c2max;
+ b2->c0min = b1->c0min;
+ b2->c1min = b1->c1min;
+ b2->c2min = b1->c2min;
+ /* Choose which axis to split the box on.
+ * Current algorithm: longest scaled axis.
+ * See notes in update_box about scaling distances.
+ */
+ c0 = ( ( b1->c0max - b1->c0min ) << C0_SHIFT ) * C0_SCALE;
+ c1 = ( ( b1->c1max - b1->c1min ) << C1_SHIFT ) * C1_SCALE;
+ c2 = ( ( b1->c2max - b1->c2min ) << C2_SHIFT ) * C2_SCALE;
+ /* We want to break any ties in favor of green, then red, blue last.
+ * This code does the right thing for R,G,B or B,G,R color orders only.
+ */
+#if RGB_RED == 0
+
+ cmax = c1;
+ n = 1;
+ if ( c0 > cmax ) {
+ cmax = c0;
+ n = 0;
+ }
+ if ( c2 > cmax ) {
+ n = 2;
+ }
+#else
+ cmax = c1;
+ n = 1;
+ if ( c2 > cmax ) {
+ cmax = c2;
+ n = 2;
+ }
+ if ( c0 > cmax ) {
+ n = 0;
+ }
+#endif
+ /* Choose split point along selected axis, and update box bounds.
+ * Current algorithm: split at halfway point.
+ * (Since the box has been shrunk to minimum volume,
+ * any split will produce two nonempty subboxes.)
+ * Note that lb value is max for lower box, so must be < old max.
+ */
+ switch ( n ) {
+ case 0:
+ lb = ( b1->c0max + b1->c0min ) / 2;
+ b1->c0max = lb;
+ b2->c0min = lb + 1;
+ break;
+ case 1:
+ lb = ( b1->c1max + b1->c1min ) / 2;
+ b1->c1max = lb;
+ b2->c1min = lb + 1;
+ break;
+ case 2:
+ lb = ( b1->c2max + b1->c2min ) / 2;
+ b1->c2max = lb;
+ b2->c2min = lb + 1;
+ break;
+ }
+ /* Update stats for boxes */
+ update_box( cinfo, b1 );
+ update_box( cinfo, b2 );
+ numboxes++;
+ }
+ return numboxes;
+}
+
+
+LOCAL( void )
+compute_color ( j_decompress_ptr cinfo, boxptr boxp, int icolor )
+/* Compute representative color for a box, put it in colormap[icolor] */
+{
+ /* Current algorithm: mean weighted by pixels (not colors) */
+ /* Note it is important to get the rounding correct! */
+ my_cquantize_ptr cquantize = ( my_cquantize_ptr ) cinfo->cquantize;
+ hist3d histogram = cquantize->histogram;
+ histptr histp;
+ int c0, c1, c2;
+ int c0min, c0max, c1min, c1max, c2min, c2max;
+ long count;
+ long total = 0;
+ long c0total = 0;
+ long c1total = 0;
+ long c2total = 0;
+
+ c0min = boxp->c0min;
+ c0max = boxp->c0max;
+ c1min = boxp->c1min;
+ c1max = boxp->c1max;
+ c2min = boxp->c2min;
+ c2max = boxp->c2max;
+
+ for ( c0 = c0min; c0 <= c0max; c0++ )
+ for ( c1 = c1min; c1 <= c1max; c1++ ) {
+ histp = & histogram[ c0 ][ c1 ][ c2min ];
+ for ( c2 = c2min; c2 <= c2max; c2++ ) {
+ if ( ( count = *histp++ ) != 0 ) {
+ total += count;
+ c0total += ( ( c0 << C0_SHIFT ) + ( ( 1 << C0_SHIFT ) >> 1 ) ) * count;
+ c1total += ( ( c1 << C1_SHIFT ) + ( ( 1 << C1_SHIFT ) >> 1 ) ) * count;
+ c2total += ( ( c2 << C2_SHIFT ) + ( ( 1 << C2_SHIFT ) >> 1 ) ) * count;
+ }
+ }
+ }
+
+ cinfo->colormap[ 0 ][ icolor ] = ( JSAMPLE ) ( ( c0total + ( total >> 1 ) ) / total );
+ cinfo->colormap[ 1 ][ icolor ] = ( JSAMPLE ) ( ( c1total + ( total >> 1 ) ) / total );
+ cinfo->colormap[ 2 ][ icolor ] = ( JSAMPLE ) ( ( c2total + ( total >> 1 ) ) / total );
+}
+
+
+LOCAL( void )
+select_colors ( j_decompress_ptr cinfo, int desired_colors )
+/* Master routine for color selection */
+{
+ boxptr boxlist;
+ int numboxes;
+ int i;
+
+ /* Allocate workspace for box list */
+ boxlist = ( boxptr ) ( *cinfo->mem->alloc_small )
+ ( ( j_common_ptr ) cinfo, JPOOL_IMAGE, desired_colors * SIZEOF( box ) );
+ /* Initialize one box containing whole space */
+ numboxes = 1;
+ boxlist[ 0 ].c0min = 0;
+ boxlist[ 0 ].c0max = MAXJSAMPLE >> C0_SHIFT;
+ boxlist[ 0 ].c1min = 0;
+ boxlist[ 0 ].c1max = MAXJSAMPLE >> C1_SHIFT;
+ boxlist[ 0 ].c2min = 0;
+ boxlist[ 0 ].c2max = MAXJSAMPLE >> C2_SHIFT;
+ /* Shrink it to actually-used volume and set its statistics */
+ update_box( cinfo, & boxlist[ 0 ] );
+ /* Perform median-cut to produce final box list */
+ numboxes = median_cut( cinfo, boxlist, numboxes, desired_colors );
+ /* Compute the representative color for each box, fill colormap */
+ for ( i = 0; i < numboxes; i++ )
+ compute_color( cinfo, & boxlist[ i ], i );
+ cinfo->actual_number_of_colors = numboxes;
+ TRACEMS1( cinfo, 1, JTRC_QUANT_SELECTED, numboxes );
+}
+
+
+/*
+ * These routines are concerned with the time-critical task of mapping input
+ * colors to the nearest color in the selected colormap.
+ *
+ * We re-use the histogram space as an "inverse color map", essentially a
+ * cache for the results of nearest-color searches. All colors within a
+ * histogram cell will be mapped to the same colormap entry, namely the one
+ * closest to the cell's center. This may not be quite the closest entry to
+ * the actual input color, but it's almost as good. A zero in the cache
+ * indicates we haven't found the nearest color for that cell yet; the array
+ * is cleared to zeroes before starting the mapping pass. When we find the
+ * nearest color for a cell, its colormap index plus one is recorded in the
+ * cache for future use. The pass2 scanning routines call fill_inverse_cmap
+ * when they need to use an unfilled entry in the cache.
+ *
+ * Our method of efficiently finding nearest colors is based on the "locally
+ * sorted search" idea described by Heckbert and on the incremental distance
+ * calculation described by Spencer W. Thomas in chapter III.1 of Graphics
+ * Gems II (James Arvo, ed. Academic Press, 1991). Thomas points out that
+ * the distances from a given colormap entry to each cell of the histogram can
+ * be computed quickly using an incremental method: the differences between
+ * distances to adjacent cells themselves differ by a constant. This allows a
+ * fairly fast implementation of the "brute force" approach of computing the
+ * distance from every colormap entry to every histogram cell. Unfortunately,
+ * it needs a work array to hold the best-distance-so-far for each histogram
+ * cell (because the inner loop has to be over cells, not colormap entries).
+ * The work array elements have to be INT32s, so the work array would need
+ * 256Kb at our recommended precision. This is not feasible in DOS machines.
+ *
+ * To get around these problems, we apply Thomas' method to compute the
+ * nearest colors for only the cells within a small subbox of the histogram.
+ * The work array need be only as big as the subbox, so the memory usage
+ * problem is solved. Furthermore, we need not fill subboxes that are never
+ * referenced in pass2; many images use only part of the color gamut, so a
+ * fair amount of work is saved. An additional advantage of this
+ * approach is that we can apply Heckbert's locality criterion to quickly
+ * eliminate colormap entries that are far away from the subbox; typically
+ * three-fourths of the colormap entries are rejected by Heckbert's criterion,
+ * and we need not compute their distances to individual cells in the subbox.
+ * The speed of this approach is heavily influenced by the subbox size: too
+ * small means too much overhead, too big loses because Heckbert's criterion
+ * can't eliminate as many colormap entries. Empirically the best subbox
+ * size seems to be about 1/512th of the histogram (1/8th in each direction).
+ *
+ * Thomas' article also describes a refined method which is asymptotically
+ * faster than the brute-force method, but it is also far more complex and
+ * cannot efficiently be applied to small subboxes. It is therefore not
+ * useful for programs intended to be portable to DOS machines. On machines
+ * with plenty of memory, filling the whole histogram in one shot with Thomas'
+ * refined method might be faster than the present code --- but then again,
+ * it might not be any faster, and it's certainly more complicated.
+ */
+
+
+/* log2(histogram cells in update box) for each axis; this can be adjusted */
+#define BOX_C0_LOG (HIST_C0_BITS-3)
+#define BOX_C1_LOG (HIST_C1_BITS-3)
+#define BOX_C2_LOG (HIST_C2_BITS-3)
+
+#define BOX_C0_ELEMS (1<<BOX_C0_LOG) /* # of hist cells in update box */
+#define BOX_C1_ELEMS (1<<BOX_C1_LOG)
+#define BOX_C2_ELEMS (1<<BOX_C2_LOG)
+
+#define BOX_C0_SHIFT (C0_SHIFT + BOX_C0_LOG)
+#define BOX_C1_SHIFT (C1_SHIFT + BOX_C1_LOG)
+#define BOX_C2_SHIFT (C2_SHIFT + BOX_C2_LOG)
+
+
+/*
+ * The next three routines implement inverse colormap filling. They could
+ * all be folded into one big routine, but splitting them up this way saves
+ * some stack space (the mindist[] and bestdist[] arrays need not coexist)
+ * and may allow some compilers to produce better code by registerizing more
+ * inner-loop variables.
+ */
+
+LOCAL( int )
+find_nearby_colors ( j_decompress_ptr cinfo, int minc0, int minc1, int minc2,
+ JSAMPLE colorlist[] )
+/* Locate the colormap entries close enough to an update box to be candidates
+ * for the nearest entry to some cell(s) in the update box. The update box
+ * is specified by the center coordinates of its first cell. The number of
+ * candidate colormap entries is returned, and their colormap indexes are
+ * placed in colorlist[].
+ * This routine uses Heckbert's "locally sorted search" criterion to select
+ * the colors that need further consideration.
+ */
+{
+ int numcolors = cinfo->actual_number_of_colors;
+ int maxc0, maxc1, maxc2;
+ int centerc0, centerc1, centerc2;
+ int i, x, ncolors;
+ INT32 minmaxdist, min_dist, max_dist, tdist;
+ INT32 mindist[ MAXNUMCOLORS ]; /* min distance to colormap entry i */
+
+ /* Compute true coordinates of update box's upper corner and center.
+ * Actually we compute the coordinates of the center of the upper-corner
+ * histogram cell, which are the upper bounds of the volume we care about.
+ * Note that since ">>" rounds down, the "center" values may be closer to
+ * min than to max; hence comparisons to them must be "<=", not "<".
+ */
+ maxc0 = minc0 + ( ( 1 << BOX_C0_SHIFT ) - ( 1 << C0_SHIFT ) );
+ centerc0 = ( minc0 + maxc0 ) >> 1;
+ maxc1 = minc1 + ( ( 1 << BOX_C1_SHIFT ) - ( 1 << C1_SHIFT ) );
+ centerc1 = ( minc1 + maxc1 ) >> 1;
+ maxc2 = minc2 + ( ( 1 << BOX_C2_SHIFT ) - ( 1 << C2_SHIFT ) );
+ centerc2 = ( minc2 + maxc2 ) >> 1;
+
+ /* For each color in colormap, find:
+ * 1. its minimum squared-distance to any point in the update box
+ * (zero if color is within update box);
+ * 2. its maximum squared-distance to any point in the update box.
+ * Both of these can be found by considering only the corners of the box.
+ * We save the minimum distance for each color in mindist[];
+ * only the smallest maximum distance is of interest.
+ */
+ minmaxdist = 0x7FFFFFFFL;
+
+ for ( i = 0; i < numcolors; i++ ) {
+ /* We compute the squared-c0-distance term, then add in the other two. */
+ x = GETJSAMPLE( cinfo->colormap[ 0 ][ i ] );
+ if ( x < minc0 ) {
+ tdist = ( x - minc0 ) * C0_SCALE;
+ min_dist = tdist * tdist;
+ tdist = ( x - maxc0 ) * C0_SCALE;
+ max_dist = tdist * tdist;
+ } else if ( x > maxc0 ) {
+ tdist = ( x - maxc0 ) * C0_SCALE;
+ min_dist = tdist * tdist;
+ tdist = ( x - minc0 ) * C0_SCALE;
+ max_dist = tdist * tdist;
+ } else {
+ /* within cell range so no contribution to min_dist */
+ min_dist = 0;
+ if ( x <= centerc0 ) {
+ tdist = ( x - maxc0 ) * C0_SCALE;
+ max_dist = tdist * tdist;
+ } else {
+ tdist = ( x - minc0 ) * C0_SCALE;
+ max_dist = tdist * tdist;
+ }
+ }
+
+ x = GETJSAMPLE( cinfo->colormap[ 1 ][ i ] );
+ if ( x < minc1 ) {
+ tdist = ( x - minc1 ) * C1_SCALE;
+ min_dist += tdist * tdist;
+ tdist = ( x - maxc1 ) * C1_SCALE;
+ max_dist += tdist * tdist;
+ } else if ( x > maxc1 ) {
+ tdist = ( x - maxc1 ) * C1_SCALE;
+ min_dist += tdist * tdist;
+ tdist = ( x - minc1 ) * C1_SCALE;
+ max_dist += tdist * tdist;
+ } else {
+ /* within cell range so no contribution to min_dist */
+ if ( x <= centerc1 ) {
+ tdist = ( x - maxc1 ) * C1_SCALE;
+ max_dist += tdist * tdist;
+ } else {
+ tdist = ( x - minc1 ) * C1_SCALE;
+ max_dist += tdist * tdist;
+ }
+ }
+
+ x = GETJSAMPLE( cinfo->colormap[ 2 ][ i ] );
+ if ( x < minc2 ) {
+ tdist = ( x - minc2 ) * C2_SCALE;
+ min_dist += tdist * tdist;
+ tdist = ( x - maxc2 ) * C2_SCALE;
+ max_dist += tdist * tdist;
+ } else if ( x > maxc2 ) {
+ tdist = ( x - maxc2 ) * C2_SCALE;
+ min_dist += tdist * tdist;
+ tdist = ( x - minc2 ) * C2_SCALE;
+ max_dist += tdist * tdist;
+ } else {
+ /* within cell range so no contribution to min_dist */
+ if ( x <= centerc2 ) {
+ tdist = ( x - maxc2 ) * C2_SCALE;
+ max_dist += tdist * tdist;
+ } else {
+ tdist = ( x - minc2 ) * C2_SCALE;
+ max_dist += tdist * tdist;
+ }
+ }
+
+ mindist[ i ] = min_dist; /* save away the results */
+ if ( max_dist < minmaxdist )
+ minmaxdist = max_dist;
+ }
+
+ /* Now we know that no cell in the update box is more than minmaxdist
+ * away from some colormap entry. Therefore, only colors that are
+ * within minmaxdist of some part of the box need be considered.
+ */
+ ncolors = 0;
+ for ( i = 0; i < numcolors; i++ ) {
+ if ( mindist[ i ] <= minmaxdist )
+ colorlist[ ncolors++ ] = ( JSAMPLE ) i;
+ }
+ return ncolors;
+}
+
+
+LOCAL( void )
+find_best_colors ( j_decompress_ptr cinfo, int minc0, int minc1, int minc2,
+ int numcol...
[truncated message content] |
|
From: <at...@us...> - 2007-08-12 20:57:07
|
Revision: 441
http://cadcdev.svn.sourceforge.net/cadcdev/?rev=441&view=rev
Author: atani
Date: 2007-08-12 13:57:01 -0700 (Sun, 12 Aug 2007)
Log Message:
-----------
makefile wrapper
Modified Paths:
--------------
tiki/win32/Makefile
Added Paths:
-----------
tiki/Makefile
Added: tiki/Makefile
===================================================================
--- tiki/Makefile (rev 0)
+++ tiki/Makefile 2007-08-12 20:57:01 UTC (rev 441)
@@ -0,0 +1,5 @@
+
+win32 dc gp2x osx sdl:
+ $(MAKE) -C $@ all
+
+.PHONY: win32 dc gp2x osx sdl
Modified: tiki/win32/Makefile
===================================================================
--- tiki/win32/Makefile 2007-08-12 20:48:09 UTC (rev 440)
+++ tiki/win32/Makefile 2007-08-12 20:57:01 UTC (rev 441)
@@ -1,3 +1,3 @@
all:
- vcbuild /rebuild tiki_vc80.sln $$ALL
+ vcbuild /nocolor /rebuild tiki_vc80.sln $$ALL
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <at...@us...> - 2007-08-12 22:16:59
|
Revision: 448
http://cadcdev.svn.sourceforge.net/cadcdev/?rev=448&view=rev
Author: atani
Date: 2007-08-12 15:16:58 -0700 (Sun, 12 Aug 2007)
Log Message:
-----------
examples targets
Modified Paths:
--------------
tiki/dc/Makefile
tiki/examples/TikiTest/TikiTest_vc80.vcproj
tiki/examples/console/TikiSnake/TikiSnake.vcproj
tiki/gp2x/Makefile
tiki/nds/Makefile
tiki/sdl/Makefile
tiki/win32/Makefile
tiki/win32/tiki_vs80.vcproj
Modified: tiki/dc/Makefile
===================================================================
--- tiki/dc/Makefile 2007-08-12 22:06:23 UTC (rev 447)
+++ tiki/dc/Makefile 2007-08-12 22:16:58 UTC (rev 448)
@@ -23,4 +23,11 @@
clean: clean_subdirs
-rm -f $(BASE_OBJS) libtiki.a
+examples:
+ $(MAKE) TIKI_PLAT=dc TIKI_DIR=$(CURDIR)/../ -C$(CURDIR)/../examples/TikiTest
+ $(MAKE) TIKI_PLAT=dc TIKI_DIR=$(CURDIR)/../ -C$(CURDIR)/../examples/console/TikiSnake
+
+
+
+
include Makefile.rules
Modified: tiki/examples/TikiTest/TikiTest_vc80.vcproj
===================================================================
--- tiki/examples/TikiTest/TikiTest_vc80.vcproj 2007-08-12 22:06:23 UTC (rev 447)
+++ tiki/examples/TikiTest/TikiTest_vc80.vcproj 2007-08-12 22:16:58 UTC (rev 448)
@@ -38,7 +38,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
- AdditionalIncludeDirectories="$(SolutionDir)\include;$(SolutionDir)\..\include;"C:\Program Files\OpenAL 1.1 SDK\include""
+ AdditionalIncludeDirectories="$(ProjectDir)..\..\win32\include;$(ProjectDir)\..\..\include;"C:\Program Files\OpenAL 1.1 SDK\include""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;"
MinimalRebuild="true"
BasicRuntimeChecks="3"
@@ -61,7 +61,7 @@
Name="VCLinkerTool"
AdditionalDependencies="gdi32.lib kernel32.lib user32.lib opengl32.lib glu32.lib comdlg32.lib"
LinkIncremental="2"
- AdditionalLibraryDirectories="$(SolutionDir)\Debug;"C:\Program Files\OpenAL 1.1 SDK\libs\Win32""
+ AdditionalLibraryDirectories="$(ProjectDir)\..\..\win32\Debug;"C:\Program Files\OpenAL 1.1 SDK\libs\Win32""
GenerateDebugInformation="true"
SubSystem="2"
TargetMachine="1"
@@ -115,7 +115,7 @@
/>
<Tool
Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="$(SolutionDir)\include;$(SolutionDir)\..\include;"C:\Program Files\OpenAL 1.1 SDK\include""
+ AdditionalIncludeDirectories="$(ProjectDir)..\..\win32\include;$(ProjectDir)\..\..\include;"C:\Program Files\OpenAL 1.1 SDK\include""
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;"
RuntimeLibrary="0"
UsePrecompiledHeader="0"
@@ -136,7 +136,7 @@
Name="VCLinkerTool"
AdditionalDependencies="gdi32.lib kernel32.lib user32.lib opengl32.lib glu32.lib comdlg32.lib"
LinkIncremental="1"
- AdditionalLibraryDirectories="$(SolutionDir)\Release;C:\Program Files\OpenAL 1.1 SDK\libs\Win32"
+ AdditionalLibraryDirectories="$(ProjectDir)\..\..\win32\Release;C:\Program Files\OpenAL 1.1 SDK\libs\Win32"
IgnoreDefaultLibraryNames=""
GenerateDebugInformation="true"
SubSystem="2"
Modified: tiki/examples/console/TikiSnake/TikiSnake.vcproj
===================================================================
--- tiki/examples/console/TikiSnake/TikiSnake.vcproj 2007-08-12 22:06:23 UTC (rev 447)
+++ tiki/examples/console/TikiSnake/TikiSnake.vcproj 2007-08-12 22:16:58 UTC (rev 448)
@@ -38,7 +38,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
- AdditionalIncludeDirectories="..\..\..\win32\include;..\..\..\include;"C:\Program Files\OpenAL 1.1 SDK\include""
+ AdditionalIncludeDirectories="$(ProjectDir)\..\..\..\win32\include;$(ProjectDir)\..\..\..\include;"C:\Program Files\OpenAL 1.1 SDK\include""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;"
MinimalRebuild="true"
BasicRuntimeChecks="3"
@@ -61,7 +61,7 @@
Name="VCLinkerTool"
AdditionalDependencies="gdi32.lib kernel32.lib user32.lib opengl32.lib glu32.lib comdlg32.lib"
LinkIncremental="2"
- AdditionalLibraryDirectories="..\..\..\win32\Debug;"C:\Program Files\OpenAL 1.1 SDK\libs\Win32""
+ AdditionalLibraryDirectories="$(ProjectDir)\..\..\..\win32\Debug;"C:\Program Files\OpenAL 1.1 SDK\libs\Win32""
GenerateDebugInformation="true"
SubSystem="2"
TargetMachine="1"
@@ -115,7 +115,7 @@
/>
<Tool
Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="..\..\..\win32\include;..\..\..\include;"C:\Program Files\OpenAL 1.1 SDK\include""
+ AdditionalIncludeDirectories="$(ProjectDir)\..\..\..\win32\include;$(ProjectDir)\..\..\..\include;"C:\Program Files\OpenAL 1.1 SDK\include""
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;"
RuntimeLibrary="0"
UsePrecompiledHeader="0"
@@ -136,7 +136,7 @@
Name="VCLinkerTool"
AdditionalDependencies="gdi32.lib kernel32.lib user32.lib opengl32.lib glu32.lib comdlg32.lib"
LinkIncremental="1"
- AdditionalLibraryDirectories="..\..\..\win32\Release;C:\Program Files\OpenAL 1.1 SDK\libs\Win32"
+ AdditionalLibraryDirectories="$(ProjectDir)\..\..\..\win32\Release;C:\Program Files\OpenAL 1.1 SDK\libs\Win32"
IgnoreDefaultLibraryNames=""
GenerateDebugInformation="true"
SubSystem="2"
Modified: tiki/gp2x/Makefile
===================================================================
--- tiki/gp2x/Makefile 2007-08-12 22:06:23 UTC (rev 447)
+++ tiki/gp2x/Makefile 2007-08-12 22:16:58 UTC (rev 448)
@@ -54,4 +54,10 @@
clean: clean_subdirs
-rm -f $(BASE_OBJS) $(THIRD_PARTY_OBJS) libtiki.a
+examples:
+ $(MAKE) TIKI_PLAT=gp2x TIKI_DIR=$(CURDIR)/../ -C$(CURDIR)/../examples/TikiTest
+ $(MAKE) TIKI_PLAT=gp2x TIKI_DIR=$(CURDIR)/../ -C$(CURDIR)/../examples/console/TikiSnake
+
+
+
include Makefile.rules
Modified: tiki/nds/Makefile
===================================================================
--- tiki/nds/Makefile 2007-08-12 22:06:23 UTC (rev 447)
+++ tiki/nds/Makefile 2007-08-12 22:16:58 UTC (rev 448)
@@ -53,6 +53,12 @@
clean: clean_subdirs
-rm -f $(BASE_OBJS) $(THIRD_PARTY_OBJS) libtiki.a
+examples:
+ $(MAKE) TIKI_PLAT=nds TIKI_DIR=$(CURDIR)/../ -C$(CURDIR)/../examples/TikiTest
+ $(MAKE) TIKI_PLAT=nds TIKI_DIR=$(CURDIR)/../ -C$(CURDIR)/../examples/console/TikiSnake
+
+
+
DEPSDIR=$(CURDIR)
TIKI_DIR=$(CURDIR)/..
include Makefile.rules
Modified: tiki/sdl/Makefile
===================================================================
--- tiki/sdl/Makefile 2007-08-12 22:06:23 UTC (rev 447)
+++ tiki/sdl/Makefile 2007-08-12 22:16:58 UTC (rev 448)
@@ -54,4 +54,8 @@
clean: clean_subdirs
-rm -f $(BASE_OBJS) $(THIRD_PARTY_OBJS) libtiki.a
+examples:
+ $(MAKE) TIKI_PLAT=sdl TIKI_DIR=$(CURDIR)/../ -C$(CURDIR)/../examples/TikiTest
+ $(MAKE) TIKI_PLAT=sdl TIKI_DIR=$(CURDIR)/../ -C$(CURDIR)/../examples/console/TikiSnake
+
include Makefile.rules
Modified: tiki/win32/Makefile
===================================================================
--- tiki/win32/Makefile 2007-08-12 22:06:23 UTC (rev 447)
+++ tiki/win32/Makefile 2007-08-12 22:16:58 UTC (rev 448)
@@ -1,6 +1,14 @@
all:
- vcbuild /nocolor /rebuild tiki_vc80.sln $$ALL
+ vcbuild /nocolor /rebuild tiki_vs80.vcproj Debug
+ vcbuild /nocolor /rebuild tiki_vs80.vcproj Release
clean:
- vcbuild /nocolor /clean tiki_vc80.sln $$ALL
+ -vcbuild /nocolor /clean tiki_vc80.sln $$ALL
+
+examples:
+ vcbuild /nocolor /rebuild ..\\examples\\TikiTest\\TikiTest_vc80.vcproj Debug
+ vcbuild /nocolor /rebuild ..\\examples\\TikiTest\\TikiTest_vc80.vcproj Release
+ vcbuild /nocolor /rebuild ..\\examples\\console\\TikiSnake\\TikiSnake.vcproj Debug
+ vcbuild /nocolor /rebuild ..\\examples\\console\\TikiSnake\\TikiSnake.vcproj Release
+
Modified: tiki/win32/tiki_vs80.vcproj
===================================================================
--- tiki/win32/tiki_vs80.vcproj 2007-08-12 22:06:23 UTC (rev 447)
+++ tiki/win32/tiki_vs80.vcproj 2007-08-12 22:16:58 UTC (rev 448)
@@ -42,7 +42,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
- AdditionalIncludeDirectories=""$(SolutionDir)\include";"$(SolutionDir)\..\include";"C:\Program Files\OpenAL 1.1 SDK\include";"$(SolutionDir)\..\3rdparty\libjpeg";"$(SolutionDir)\..\3rdparty\libogg\include";"$(SolutionDir)\..\3rdparty\libpng";"$(SolutionDir)\..\3rdparty\libvorbis\include";"$(SolutionDir)\..\3rdparty\zlib""
+ AdditionalIncludeDirectories=""$(ProjectDir)\include";"$(ProjectDir)\..\include";"C:\Program Files\OpenAL 1.1 SDK\include";"$(ProjectDir)\..\3rdparty\libjpeg";"$(ProjectDir)\..\3rdparty\libogg\include";"$(ProjectDir)\..\3rdparty\libpng";"$(ProjectDir)\..\3rdparty\libvorbis\include";"$(ProjectDir)\..\3rdparty\zlib""
PreprocessorDefinitions="_WIN32_WINNT=0x0500;_CRT_SECURE_NO_WARNINGS=1"
MinimalRebuild="true"
BasicRuntimeChecks="3"
@@ -108,7 +108,7 @@
/>
<Tool
Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""$(SolutionDir)\include";"$(SolutionDir)\..\include";"C:\Program Files\OpenAL 1.1 SDK\include";"$(SolutionDir)\..\3rdparty\libjpeg";"$(SolutionDir)\..\3rdparty\libogg\include";"$(SolutionDir)\..\3rdparty\libpng";"$(SolutionDir)\..\3rdparty\libvorbis\include";"$(SolutionDir)\..\3rdparty\zlib""
+ AdditionalIncludeDirectories=""$(ProjectDir)\include";"$(ProjectDir)\..\include";"C:\Program Files\OpenAL 1.1 SDK\include";"$(ProjectDir)\..\3rdparty\libjpeg";"$(ProjectDir)\..\3rdparty\libogg\include";"$(ProjectDir)\..\3rdparty\libpng";"$(ProjectDir)\..\3rdparty\libvorbis\include";"$(ProjectDir)\..\3rdparty\zlib""
PreprocessorDefinitions="_WIN32_WINNT=0x0500; _CRT_SECURE_NO_WARNINGS=1"
RuntimeLibrary="0"
UsePrecompiledHeader="2"
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <c99...@us...> - 2007-08-12 22:29:25
|
Revision: 449
http://cadcdev.svn.sourceforge.net/cadcdev/?rev=449&view=rev
Author: c99koder
Date: 2007-08-12 15:29:24 -0700 (Sun, 12 Aug 2007)
Log Message:
-----------
Tiki: Update OS X Makefile and switch TikiTest to 10.4 universal sdk
Modified Paths:
--------------
tiki/examples/TikiTest/TikiTest.xcodeproj/project.pbxproj
tiki/osx/Makefile
Modified: tiki/examples/TikiTest/TikiTest.xcodeproj/project.pbxproj
===================================================================
--- tiki/examples/TikiTest/TikiTest.xcodeproj/project.pbxproj 2007-08-12 22:16:58 UTC (rev 448)
+++ tiki/examples/TikiTest/TikiTest.xcodeproj/project.pbxproj 2007-08-12 22:29:24 UTC (rev 449)
@@ -19,31 +19,6 @@
C4F50EEF0799E5B40001D0D0 /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C4F50EEE0799E5B40001D0D0 /* OpenGL.framework */; };
/* End PBXBuildFile section */
-/* Begin PBXBuildStyle section */
- 4A9504CCFFE6A4B311CA0CBA /* Development */ = {
- isa = PBXBuildStyle;
- buildSettings = {
- COPY_PHASE_STRIP = NO;
- GCC_DYNAMIC_NO_PIC = NO;
- GCC_ENABLE_FIX_AND_CONTINUE = YES;
- GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
- GCC_OPTIMIZATION_LEVEL = 0;
- PREBINDING = NO;
- ZERO_LINK = NO;
- };
- name = Development;
- };
- 4A9504CDFFE6A4B311CA0CBA /* Deployment */ = {
- isa = PBXBuildStyle;
- buildSettings = {
- COPY_PHASE_STRIP = YES;
- GCC_ENABLE_FIX_AND_CONTINUE = NO;
- ZERO_LINK = NO;
- };
- name = Deployment;
- };
-/* End PBXBuildStyle section */
-
/* Begin PBXCopyFilesBuildPhase section */
C4332D16079B22450025BF39 /* CopyFiles */ = {
isa = PBXCopyFilesBuildPhase;
@@ -184,16 +159,6 @@
);
buildRules = (
);
- buildSettings = {
- FRAMEWORK_SEARCH_PATHS = ../../osx/build;
- GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
- GCC_PRECOMPILE_PREFIX_HEADER = YES;
- GCC_PREFIX_HEADER = TikiTest_Prefix.pch;
- INFOPLIST_FILE = Info.plist;
- INSTALL_PATH = "$(HOME)/Applications";
- PRODUCT_NAME = TikiTest;
- WRAPPER_EXTENSION = app;
- };
dependencies = (
);
name = TikiTest;
@@ -208,12 +173,6 @@
29B97313FDCFA39411CA2CEA /* Project object */ = {
isa = PBXProject;
buildConfigurationList = 64FBB92B092EA33F00427AD0 /* Build configuration list for PBXProject "TikiTest" */;
- buildSettings = {
- };
- buildStyles = (
- 4A9504CCFFE6A4B311CA0CBA /* Development */,
- 4A9504CDFFE6A4B311CA0CBA /* Deployment */,
- );
hasScannedForEncodings = 1;
mainGroup = 29B97314FDCFA39411CA2CEA /* TikiTest */;
projectDirPath = "";
@@ -346,7 +305,7 @@
../../3rdparty/boost,
);
MACOSX_DEPLOYMENT_TARGET = 10.3;
- SDKROOT = /Developer/SDKs/MacOSX10.3.9.sdk;
+ SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
};
name = Development;
};
@@ -360,7 +319,7 @@
../../3rdparty/boost,
);
MACOSX_DEPLOYMENT_TARGET = 10.3;
- SDKROOT = /Developer/SDKs/MacOSX10.3.9.sdk;
+ SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
};
name = Deployment;
};
@@ -374,7 +333,7 @@
../../3rdparty/boost,
);
MACOSX_DEPLOYMENT_TARGET = 10.3;
- SDKROOT = /Developer/SDKs/MacOSX10.3.9.sdk;
+ SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
};
name = Default;
};
Modified: tiki/osx/Makefile
===================================================================
--- tiki/osx/Makefile 2007-08-12 22:16:58 UTC (rev 448)
+++ tiki/osx/Makefile 2007-08-12 22:29:24 UTC (rev 449)
@@ -1,16 +1,18 @@
all:
xcodebuild -target Tiki -configuration Development
xcodebuild -target Tiki -configuration Deployment
+
+examples:
xcodebuild -project ../examples/TikiTest/TikiTest.xcodeproj -configuration Development
xcodebuild -project ../examples/TikiTest/TikiTest.xcodeproj -configuration Deployment
xcodebuild -project ../examples/console/TikiSnake/TikiSnake.xcodeproj -configuration Development
xcodebuild -project ../examples/console/TikiSnake/TikiSnake.xcodeproj -configuration Deployment
clean:
- xcodebuild -target Tiki -configuration Development clean
- xcodebuild -target Tiki -configuration Deployment clean
- xcodebuild -project ../examples/TikiTest/TikiTest.xcodeproj -configuration Development clean
- xcodebuild -project ../examples/TikiTest/TikiTest.xcodeproj -configuration Deployment clean
- xcodebuild -project ../examples/console/TikiSnake/TikiSnake.xcodeproj -configuration Development clean
- xcodebuild -project ../examples/console/TikiSnake/TikiSnake.xcodeproj -configuration Deployment clean
+ -xcodebuild -target Tiki -configuration Development clean
+ -xcodebuild -target Tiki -configuration Deployment clean
+ -xcodebuild -project ../examples/TikiTest/TikiTest.xcodeproj -configuration Development clean
+ -xcodebuild -project ../examples/TikiTest/TikiTest.xcodeproj -configuration Deployment clean
+ -xcodebuild -project ../examples/console/TikiSnake/TikiSnake.xcodeproj -configuration Development clean
+ -xcodebuild -project ../examples/console/TikiSnake/TikiSnake.xcodeproj -configuration Deployment clean
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <at...@us...> - 2007-08-13 06:11:36
|
Revision: 456
http://cadcdev.svn.sourceforge.net/cadcdev/?rev=456&view=rev
Author: atani
Date: 2007-08-12 23:11:34 -0700 (Sun, 12 Aug 2007)
Log Message:
-----------
package targets
Modified Paths:
--------------
tiki/Makefile
tiki/dc/Makefile
tiki/osx/Makefile
tiki/sdl/Makefile
tiki/win32/Makefile
Modified: tiki/Makefile
===================================================================
--- tiki/Makefile 2007-08-12 23:30:06 UTC (rev 455)
+++ tiki/Makefile 2007-08-13 06:11:34 UTC (rev 456)
@@ -5,4 +5,7 @@
win32_examples dc_examples gp2x_examples osx_examples sdl_examples nds_examples:
$(MAKE) -C $(@:_examples=) examples
+win32_package dc_package gp2x_package osx_package sdl_package nds_package:
+ $(MAKE) -C $(@:_package=) package
+
.PHONY: win32 dc gp2x osx sdl nds
Modified: tiki/dc/Makefile
===================================================================
--- tiki/dc/Makefile 2007-08-12 23:30:06 UTC (rev 455)
+++ tiki/dc/Makefile 2007-08-13 06:11:34 UTC (rev 456)
@@ -27,7 +27,12 @@
$(MAKE) TIKI_PLAT=dc TIKI_DIR=$(CURDIR)/../ -C$(CURDIR)/../examples/TikiTest
$(MAKE) TIKI_PLAT=dc TIKI_DIR=$(CURDIR)/../ -C$(CURDIR)/../examples/console/TikiSnake
+SVN_VERSION_TMP=$(shell svnversion)
+SVN_VERSION=$(subst :,_,$(SVN_VERSION_TMP))
+package:
+ -rm -f ../tiki-$(SVN_VERSION)-dc.zip
+ zip -9r ../tiki-$(SVN_VERSION)-dc.zip libtiki.a
+ cd .. && zip -9ru tiki-$(SVN_VERSION)-dc.zip include dc/include -x "*/.svn/*"
+cd .. && zip -9ru tiki-$(SVN_VERSION)-dc.zip examples/TikiTest/tikitest.elf examples/console/TikiSnake/tikisnake.elf -x "*/.svn/*"
-
-
include Makefile.rules
Modified: tiki/osx/Makefile
===================================================================
--- tiki/osx/Makefile 2007-08-12 23:30:06 UTC (rev 455)
+++ tiki/osx/Makefile 2007-08-13 06:11:34 UTC (rev 456)
@@ -16,3 +16,12 @@
-xcodebuild -project ../examples/console/TikiSnake/TikiSnake.xcodeproj -configuration Development clean
-xcodebuild -project ../examples/console/TikiSnake/TikiSnake.xcodeproj -configuration Deployment clean
+SVN_VERSION_TMP=$(shell svnversion)
+SVN_VERSION=$(subst :,_,$(SVN_VERSION_TMP))
+package:
+ zip -9r ../tiki-$(SVN_VERSION)-osx-Debug.zip build/Development/Tiki.framework
+ cd ../examples/TikiTest/build/Development && zip -9r ../../../../tiki-$(SVN_VERSION)-osx-Debug.zip TikiTest.app
+ cd ../examples/console/TikiSnake/build/Development && zip -9r ../../../../../tiki-$(SVN_VERSION)-osx-Debug.zip TikiSnake.app
+ zip -9r ../tiki-$(SVN_VERSION)-osx-Release.zip build/Deployment/Tiki.framework
+ cd ../examples/TikiTest/build/Deployment && zip -9r ../../../../tiki-$(SVN_VERSION)-osx-Release.zip TikiTest.app
+ cd ../examples/console/TikiSnake/build/Deployment && zip -9r ../../../../../tiki-$(SVN_VERSION)-osx-Release.zip TikiSnake.app
Modified: tiki/sdl/Makefile
===================================================================
--- tiki/sdl/Makefile 2007-08-12 23:30:06 UTC (rev 455)
+++ tiki/sdl/Makefile 2007-08-13 06:11:34 UTC (rev 456)
@@ -58,4 +58,12 @@
$(MAKE) TIKI_PLAT=sdl TIKI_DIR=$(CURDIR)/../ -C$(CURDIR)/../examples/TikiTest
$(MAKE) TIKI_PLAT=sdl TIKI_DIR=$(CURDIR)/../ -C$(CURDIR)/../examples/console/TikiSnake
+SVN_VERSION_TMP=$(shell svnversion)
+SVN_VERSION=$(subst :,_,$(SVN_VERSION_TMP))
+package:
+ -rm -f ../tiki-$(SVN_VERSION)-sdl.zip
+ zip -9r ../tiki-$(SVN_VERSION)-sdl.zip libtiki.a
+ cd .. && zip -9ru tiki-$(SVN_VERSION)-sdl.zip include sdl/include -x "*/.svn/*"
+ cd .. && zip -9ru tiki-$(SVN_VERSION)-sdl.zip examples/TikiTest/tikitest examples/console/TikiSnake/tikisnake examples/console/TikiSnake/resources -x "*/.svn/*"
+
include Makefile.rules
Modified: tiki/win32/Makefile
===================================================================
--- tiki/win32/Makefile 2007-08-12 23:30:06 UTC (rev 455)
+++ tiki/win32/Makefile 2007-08-13 06:11:34 UTC (rev 456)
@@ -12,3 +12,12 @@
vcbuild /nocolor /rebuild ..\\examples\\console\\TikiSnake\\TikiSnake.vcproj Debug
vcbuild /nocolor /rebuild ..\\examples\\console\\TikiSnake\\TikiSnake.vcproj Release
+SVN_VERSION_TMP=$(shell svnversion)
+SVN_VERSION=$(subst :,_,$(SVN_VERSION_TMP))
+package:
+ -rm -f ../tiki-$(SVN_VERSION)-win32-Debug.zip
+ -rm -f ../tiki-$(SVN_VERSION)-win32-Release.zip
+ zip -9r ../tiki-$(SVN_VERSION)-win32-Debug.zip Debug/tiki.lib
+ cd .. && zip -9ru tiki-$(SVN_VERSION)-win32-Debug.zip include win32/include examples/TikiTest/Debug/tikitest examples/console/TikiSnake/Debug/tikisnake examples/console/TikiSnake/resources -x "*/.svn/*"
+ zip -9r ../tiki-$(SVN_VERSION)-win32-Release.zip Release/tiki.lib
+ cd .. && zip -9ru tiki-$(SVN_VERSION)-win32-Release.zip include win32/include examples/TikiTest/Release/tikitest examples/console/TikiSnake/Release/tikisnake examples/console/TikiSnake/resources -x "*/.svn/*"
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <c99...@us...> - 2007-08-13 11:08:10
|
Revision: 458
http://cadcdev.svn.sourceforge.net/cadcdev/?rev=458&view=rev
Author: c99koder
Date: 2007-08-13 04:08:07 -0700 (Mon, 13 Aug 2007)
Log Message:
-----------
Tiki: Fix Makefiles for dc and nds
Modified Paths:
--------------
tiki/dc/Makefile
tiki/nds/Makefile
Modified: tiki/dc/Makefile
===================================================================
--- tiki/dc/Makefile 2007-08-13 06:30:27 UTC (rev 457)
+++ tiki/dc/Makefile 2007-08-13 11:08:07 UTC (rev 458)
@@ -33,6 +33,6 @@
-rm -f ../tiki-$(SVN_VERSION)-dc.zip
zip -9r ../tiki-$(SVN_VERSION)-dc.zip libtiki.a
cd .. && zip -9ru tiki-$(SVN_VERSION)-dc.zip include dc/include -x "*/.svn/*"
-cd .. && zip -9ru tiki-$(SVN_VERSION)-dc.zip examples/TikiTest/tikitest.elf examples/console/TikiSnake/tikisnake.elf -x "*/.svn/*"
+ cd .. && zip -9ru tiki-$(SVN_VERSION)-dc.zip examples/TikiTest/tikitest.elf examples/console/TikiSnake/tikisnake.elf -x "*/.svn/*"
include Makefile.rules
Modified: tiki/nds/Makefile
===================================================================
--- tiki/nds/Makefile 2007-08-13 06:30:27 UTC (rev 457)
+++ tiki/nds/Makefile 2007-08-13 11:08:07 UTC (rev 458)
@@ -57,8 +57,14 @@
$(MAKE) TIKI_PLAT=nds TIKI_DIR=$(CURDIR)/../ -C$(CURDIR)/../examples/TikiTest
$(MAKE) TIKI_PLAT=nds TIKI_DIR=$(CURDIR)/../ -C$(CURDIR)/../examples/console/TikiSnake
+SVN_VERSION_TMP=$(shell svnversion)
+SVN_VERSION=$(subst :,_,$(SVN_VERSION_TMP))
+package:
+ -rm -f ../tiki-$(SVN_VERSION)-nds.zip
+ zip -9r ../tiki-$(SVN_VERSION)-nds.zip libtiki.a arm7_template -x "*/.svn/*"
+ cd .. && zip -9ru tiki-$(SVN_VERSION)-nds.zip include nds/include -x "*/.svn/*"
+ cd .. && zip -9ru tiki-$(SVN_VERSION)-nds.zip examples/TikiTest/tikitest examples/console/TikiSnake/tikisnake -x "*/.svn/*"
-
DEPSDIR=$(CURDIR)
TIKI_DIR=$(CURDIR)/..
include Makefile.rules
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <at...@us...> - 2007-08-14 00:29:31
|
Revision: 461
http://cadcdev.svn.sourceforge.net/cadcdev/?rev=461&view=rev
Author: atani
Date: 2007-08-13 17:29:26 -0700 (Mon, 13 Aug 2007)
Log Message:
-----------
package scp to trac
Modified Paths:
--------------
tiki/Makefile
tiki/dc/Makefile
tiki/gp2x/Makefile
tiki/nds/Makefile
tiki/osx/Makefile
tiki/sdl/Makefile
tiki/win32/Makefile
Modified: tiki/Makefile
===================================================================
--- tiki/Makefile 2007-08-13 17:43:40 UTC (rev 460)
+++ tiki/Makefile 2007-08-14 00:29:26 UTC (rev 461)
@@ -1,11 +1,24 @@
-win32 dc gp2x osx sdl nds:
- $(MAKE) -C $@ clean all
+SVN_VERSION_TMP=$(shell svnversion)
+SVN_VERSION=$(subst :,_,$(SVN_VERSION_TMP))
-win32_examples dc_examples gp2x_examples osx_examples sdl_examples nds_examples:
+default:
+ @echo "Use <platform>_all, <platform>_clean, <platform>_examples or <platform>_package"
+
+%_all:
+ $(MAKE) -C $(@:_all=) all
+
+%_clean:
+ $(MAKE) -C $(@:_clean=) clean
+
+%_examples:
$(MAKE) -C $(@:_examples=) examples
-win32_package dc_package gp2x_package osx_package sdl_package nds_package:
- $(MAKE) -C $(@:_package=) package
+%_package:
+ -rm -fr dist
+ -mkdir dist
+ -mkdir dist/$(SVN_VERSION)
+ $(MAKE) -C $(@:_package=) package SVN_VERSION=$(SVN_VERSION)
+ scp -rq dist/$(SVN_VERSION) tr...@at...:public_html/snapshots
.PHONY: win32 dc gp2x osx sdl nds
Modified: tiki/dc/Makefile
===================================================================
--- tiki/dc/Makefile 2007-08-13 17:43:40 UTC (rev 460)
+++ tiki/dc/Makefile 2007-08-14 00:29:26 UTC (rev 461)
@@ -27,12 +27,9 @@
$(MAKE) TIKI_PLAT=dc TIKI_DIR=$(CURDIR)/../ -C$(CURDIR)/../examples/TikiTest
$(MAKE) TIKI_PLAT=dc TIKI_DIR=$(CURDIR)/../ -C$(CURDIR)/../examples/console/TikiSnake
-SVN_VERSION_TMP=$(shell svnversion)
-SVN_VERSION=$(subst :,_,$(SVN_VERSION_TMP))
package:
- -rm -f ../tiki-$(SVN_VERSION)-dc.zip
- zip -9r ../tiki-$(SVN_VERSION)-dc.zip libtiki.a
- cd .. && zip -9ru tiki-$(SVN_VERSION)-dc.zip include dc/include -x "*/.svn/*"
- cd .. && zip -9ru tiki-$(SVN_VERSION)-dc.zip examples/TikiTest/tikitest examples/console/TikiSnake/tikisnake -x "*/.svn/*"
+ zip -9r ../dist/$(SVN_VERSION)/tiki-$(SVN_VERSION)-dc.zip libtiki.a
+ cd .. && zip -9ru dist/$(SVN_VERSION)/tiki-$(SVN_VERSION)-dc.zip include dc/include -x "*/.svn/*"
+ cd .. && zip -9ru dist/$(SVN_VERSION)/tiki-$(SVN_VERSION)-dc.zip examples/TikiTest/tikitest examples/console/TikiSnake/tikisnake -x "*/.svn/*"
include Makefile.rules
Modified: tiki/gp2x/Makefile
===================================================================
--- tiki/gp2x/Makefile 2007-08-13 17:43:40 UTC (rev 460)
+++ tiki/gp2x/Makefile 2007-08-14 00:29:26 UTC (rev 461)
@@ -58,6 +58,9 @@
$(MAKE) TIKI_PLAT=gp2x TIKI_DIR=$(CURDIR)/../ -C$(CURDIR)/../examples/TikiTest
$(MAKE) TIKI_PLAT=gp2x TIKI_DIR=$(CURDIR)/../ -C$(CURDIR)/../examples/console/TikiSnake
+package:
+ zip -9r ../dist/$(SVN_VERSION)/tiki-$(SVN_VERSION)-gp2x.zip libtiki.a
+ cd .. && zip -9ru dist/$(SVN_VERSION)/tiki-$(SVN_VERSION)-gp2x.zip include gp2x/include -x "*/.svn/*"
+ cd .. && zip -9ru dist/$(SVN_VERSION)/tiki-$(SVN_VERSION)-gp2x.zip examples/TikiTest/tikitest examples/console/TikiSnake/tikisnake examples/console/TikiSnake/resources -x "*/.svn/*"
-
include Makefile.rules
Modified: tiki/nds/Makefile
===================================================================
--- tiki/nds/Makefile 2007-08-13 17:43:40 UTC (rev 460)
+++ tiki/nds/Makefile 2007-08-14 00:29:26 UTC (rev 461)
@@ -57,13 +57,10 @@
$(MAKE) TIKI_PLAT=nds TIKI_DIR=$(CURDIR)/../ -C$(CURDIR)/../examples/TikiTest
$(MAKE) TIKI_PLAT=nds TIKI_DIR=$(CURDIR)/../ -C$(CURDIR)/../examples/console/TikiSnake
-SVN_VERSION_TMP=$(shell svnversion)
-SVN_VERSION=$(subst :,_,$(SVN_VERSION_TMP))
package:
- -rm -f ../tiki-$(SVN_VERSION)-nds.zip
- zip -9r ../tiki-$(SVN_VERSION)-nds.zip libtiki.a arm7_template -x "*/.svn/*"
- cd .. && zip -9ru tiki-$(SVN_VERSION)-nds.zip include nds/include -x "*/.svn/*"
- cd .. && zip -9ru tiki-$(SVN_VERSION)-nds.zip examples/TikiTest/tikitest examples/console/TikiSnake/tikisnake -x "*/.svn/*"
+ zip -9r ../dist/$(SVN_VERSION)/tiki-$(SVN_VERSION)-nds.zip libtiki.a arm7_template -x "*/.svn/*"
+ cd .. && zip -9ru dist/$(SVN_VERSION)/tiki-$(SVN_VERSION)-nds.zip include nds/include -x "*/.svn/*"
+ cd .. && zip -9ru dist/$(SVN_VERSION)/tiki-$(SVN_VERSION)-nds.zip examples/TikiTest/tikitest examples/console/TikiSnake/tikisnake -x "*/.svn/*"
DEPSDIR=$(CURDIR)
TIKI_DIR=$(CURDIR)/..
Modified: tiki/osx/Makefile
===================================================================
--- tiki/osx/Makefile 2007-08-13 17:43:40 UTC (rev 460)
+++ tiki/osx/Makefile 2007-08-14 00:29:26 UTC (rev 461)
@@ -16,12 +16,10 @@
-xcodebuild -project ../examples/console/TikiSnake/TikiSnake.xcodeproj -configuration Development clean
-xcodebuild -project ../examples/console/TikiSnake/TikiSnake.xcodeproj -configuration Deployment clean
-SVN_VERSION_TMP=$(shell svnversion)
-SVN_VERSION=$(subst :,_,$(SVN_VERSION_TMP))
package:
- zip -9r ../tiki-$(SVN_VERSION)-osx-Debug.zip build/Development/Tiki.framework
- cd ../examples/TikiTest/build/Development && zip -9r ../../../../tiki-$(SVN_VERSION)-osx-Debug.zip TikiTest.app
- cd ../examples/console/TikiSnake/build/Development && zip -9r ../../../../../tiki-$(SVN_VERSION)-osx-Debug.zip TikiSnake.app
- zip -9r ../tiki-$(SVN_VERSION)-osx-Release.zip build/Deployment/Tiki.framework
- cd ../examples/TikiTest/build/Deployment && zip -9r ../../../../tiki-$(SVN_VERSION)-osx-Release.zip TikiTest.app
- cd ../examples/console/TikiSnake/build/Deployment && zip -9r ../../../../../tiki-$(SVN_VERSION)-osx-Release.zip TikiSnake.app
+ zip -9r ../dist/$(SVN_VERSION)/tiki-$(SVN_VERSION)-osx-Debug.zip build/Development/Tiki.framework
+ cd ../examples/TikiTest/build/Development && zip -9r ../../../../dist/$(SVN_VERSION)/tiki-$(SVN_VERSION)-osx-Debug.zip TikiTest.app
+ cd ../examples/console/TikiSnake/build/Development && zip -9r ../../../../../dist/$(SVN_VERSION)/tiki-$(SVN_VERSION)-osx-Debug.zip TikiSnake.app
+ zip -9r ../dist/$(SVN_VERSION)/tiki-$(SVN_VERSION)-osx-Release.zip build/Deployment/Tiki.framework
+ cd ../examples/TikiTest/build/Deployment && zip -9r ../../../../dist/$(SVN_VERSION)/tiki-$(SVN_VERSION)-osx-Release.zip TikiTest.app
+ cd ../examples/console/TikiSnake/build/Deployment && zip -9r ../../../../../dist/$(SVN_VERSION)/tiki-$(SVN_VERSION)-osx-Release.zip TikiSnake.app
Modified: tiki/sdl/Makefile
===================================================================
--- tiki/sdl/Makefile 2007-08-13 17:43:40 UTC (rev 460)
+++ tiki/sdl/Makefile 2007-08-14 00:29:26 UTC (rev 461)
@@ -58,12 +58,9 @@
$(MAKE) TIKI_PLAT=sdl TIKI_DIR=$(CURDIR)/../ -C$(CURDIR)/../examples/TikiTest
$(MAKE) TIKI_PLAT=sdl TIKI_DIR=$(CURDIR)/../ -C$(CURDIR)/../examples/console/TikiSnake
-SVN_VERSION_TMP=$(shell svnversion)
-SVN_VERSION=$(subst :,_,$(SVN_VERSION_TMP))
package:
- -rm -f ../tiki-$(SVN_VERSION)-sdl.zip
- zip -9r ../tiki-$(SVN_VERSION)-sdl.zip libtiki.a
- cd .. && zip -9ru tiki-$(SVN_VERSION)-sdl.zip include sdl/include -x "*/.svn/*"
- cd .. && zip -9ru tiki-$(SVN_VERSION)-sdl.zip examples/TikiTest/tikitest examples/console/TikiSnake/tikisnake examples/console/TikiSnake/resources -x "*/.svn/*"
+ zip -9r ../dist/$(SVN_VERSION)/tiki-$(SVN_VERSION)-sdl.zip libtiki.a
+ cd .. && zip -9ru dist/$(SVN_VERSION)/tiki-$(SVN_VERSION)-sdl.zip include sdl/include -x "*/.svn/*"
+ cd .. && zip -9ru dist/$(SVN_VERSION)/tiki-$(SVN_VERSION)-sdl.zip examples/TikiTest/tikitest examples/console/TikiSnake/tikisnake examples/console/TikiSnake/resources -x "*/.svn/*"
include Makefile.rules
Modified: tiki/win32/Makefile
===================================================================
--- tiki/win32/Makefile 2007-08-13 17:43:40 UTC (rev 460)
+++ tiki/win32/Makefile 2007-08-14 00:29:26 UTC (rev 461)
@@ -12,12 +12,8 @@
vcbuild /nocolor /rebuild ..\\examples\\console\\TikiSnake\\TikiSnake.vcproj Debug
vcbuild /nocolor /rebuild ..\\examples\\console\\TikiSnake\\TikiSnake.vcproj Release
-SVN_VERSION_TMP=$(shell svnversion)
-SVN_VERSION=$(subst :,_,$(SVN_VERSION_TMP))
package:
- -rm -f ../tiki-$(SVN_VERSION)-win32-Debug.zip
- -rm -f ../tiki-$(SVN_VERSION)-win32-Release.zip
- zip -9r ../tiki-$(SVN_VERSION)-win32-Debug.zip Debug/tiki.lib
- cd .. && zip -9ru tiki-$(SVN_VERSION)-win32-Debug.zip include win32/include examples/TikiTest/Debug/tikitest.exe examples/console/TikiSnake/Debug/tikisnake.exe examples/console/TikiSnake/resources -x "*/.svn/*"
- zip -9r ../tiki-$(SVN_VERSION)-win32-Release.zip Release/tiki.lib
- cd .. && zip -9ru tiki-$(SVN_VERSION)-win32-Release.zip include win32/include examples/TikiTest/Release/tikitest.exe examples/console/TikiSnake/Release/tikisnake.exe examples/console/TikiSnake/resources -x "*/.svn/*"
+ zip -9r ../dist/$(SVN_VERSION)/tiki-$(SVN_VERSION)-win32-Debug.zip Debug/tiki.lib
+ cd .. && zip -9ru dist/$(SVN_VERSION)/tiki-$(SVN_VERSION)-win32-Debug.zip include win32/include examples/TikiTest/Debug/tikitest.exe examples/console/TikiSnake/Debug/tikisnake.exe examples/console/TikiSnake/resources -x "*/.svn/*"
+ zip -9r ../dist/$(SVN_VERSION)/tiki-$(SVN_VERSION)-win32-Release.zip Release/tiki.lib
+ cd .. && zip -9ru dist/$(SVN_VERSION)/tiki-$(SVN_VERSION)-win32-Release.zip include win32/include examples/TikiTest/Release/tikitest.exe examples/console/TikiSnake/Release/tikisnake.exe examples/console/TikiSnake/resources -x "*/.svn/*"
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <at...@us...> - 2007-08-14 05:15:41
|
Revision: 463
http://cadcdev.svn.sourceforge.net/cadcdev/?rev=463&view=rev
Author: atani
Date: 2007-08-13 22:15:40 -0700 (Mon, 13 Aug 2007)
Log Message:
-----------
split package and dist_copy
Modified Paths:
--------------
tiki/Makefile
tiki/win32/Makefile
Modified: tiki/Makefile
===================================================================
--- tiki/Makefile 2007-08-14 05:07:06 UTC (rev 462)
+++ tiki/Makefile 2007-08-14 05:15:40 UTC (rev 463)
@@ -19,6 +19,8 @@
-mkdir dist
-mkdir dist/$(SVN_VERSION)
$(MAKE) -C $(@:_package=) package SVN_VERSION=$(SVN_VERSION)
+
+dist_copy:
scp -rq dist/$(SVN_VERSION) tr...@at...:public_html/snapshots/tiki
.PHONY: win32 dc gp2x osx sdl nds
Modified: tiki/win32/Makefile
===================================================================
--- tiki/win32/Makefile 2007-08-14 05:07:06 UTC (rev 462)
+++ tiki/win32/Makefile 2007-08-14 05:15:40 UTC (rev 463)
@@ -14,6 +14,20 @@
package:
zip -9r ../dist/$(SVN_VERSION)/tiki-$(SVN_VERSION)-win32-Debug.zip Debug/tiki.lib
- cd .. && zip -9ru dist/$(SVN_VERSION)/tiki-$(SVN_VERSION)-win32-Debug.zip include win32/include examples/TikiTest/Debug/tikitest.exe examples/console/TikiSnake/Debug/tikisnake.exe examples/console/TikiSnake/resources -x "*/.svn/*"
+ cp -f ../examples/console/TikiSnake/resources/pc-ascii.png ../examples/console/TikiSnake/Debug
+ cd .. && zip -9ru dist/$(SVN_VERSION)/tiki-$(SVN_VERSION)-win32-Debug.zip \
+ include \
+ win32/include \
+ examples/TikiTest/Debug/tikitest.exe \
+ examples/console/TikiSnake/Debug/tikisnake.exe \
+ examples/console/TikiSnake/Debug/pc-ascii.png \
+ -x "*/.svn/*"
+ cp -f ../examples/console/TikiSnake/resources/pc-ascii.png ../examples/console/TikiSnake/Release
zip -9r ../dist/$(SVN_VERSION)/tiki-$(SVN_VERSION)-win32-Release.zip Release/tiki.lib
- cd .. && zip -9ru dist/$(SVN_VERSION)/tiki-$(SVN_VERSION)-win32-Release.zip include win32/include examples/TikiTest/Release/tikitest.exe examples/console/TikiSnake/Release/tikisnake.exe examples/console/TikiSnake/resources -x "*/.svn/*"
+ cd .. && zip -9ru dist/$(SVN_VERSION)/tiki-$(SVN_VERSION)-win32-Release.zip \
+ include \
+ win32/include \
+ examples/TikiTest/Release/tikitest.exe \
+ examples/console/TikiSnake/Release/tikisnake.exe \
+ examples/console/TikiSnake/Release/pc-ascii.png \
+ -x "*/.svn/*"
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <at...@us...> - 2007-08-14 22:08:39
|
Revision: 464
http://cadcdev.svn.sourceforge.net/cadcdev/?rev=464&view=rev
Author: atani
Date: 2007-08-14 15:08:35 -0700 (Tue, 14 Aug 2007)
Log Message:
-----------
create dmg on OSX, tar.gz for SDL(Linux)
Modified Paths:
--------------
tiki/osx/Makefile
tiki/sdl/Makefile
Modified: tiki/osx/Makefile
===================================================================
--- tiki/osx/Makefile 2007-08-14 05:15:40 UTC (rev 463)
+++ tiki/osx/Makefile 2007-08-14 22:08:35 UTC (rev 464)
@@ -17,9 +17,29 @@
-xcodebuild -project ../examples/console/TikiSnake/TikiSnake.xcodeproj -configuration Deployment clean
package:
- zip -9r ../dist/$(SVN_VERSION)/tiki-$(SVN_VERSION)-osx-Debug.zip build/Development/Tiki.framework
- cd ../examples/TikiTest/build/Development && zip -9r ../../../../dist/$(SVN_VERSION)/tiki-$(SVN_VERSION)-osx-Debug.zip TikiTest.app
- cd ../examples/console/TikiSnake/build/Development && zip -9r ../../../../../dist/$(SVN_VERSION)/tiki-$(SVN_VERSION)-osx-Debug.zip TikiSnake.app
- zip -9r ../dist/$(SVN_VERSION)/tiki-$(SVN_VERSION)-osx-Release.zip build/Deployment/Tiki.framework
- cd ../examples/TikiTest/build/Deployment && zip -9r ../../../../dist/$(SVN_VERSION)/tiki-$(SVN_VERSION)-osx-Release.zip TikiTest.app
- cd ../examples/console/TikiSnake/build/Deployment && zip -9r ../../../../../dist/$(SVN_VERSION)/tiki-$(SVN_VERSION)-osx-Release.zip TikiSnake.app
+ mkdir ../dist/$(SVN_VERSION)/tmp-debug
+ ditto -v build/Development/Tiki.framework \
+ ../dist/$(SVN_VERSION)/tmp-debug/Tiki.framework
+ ditto -v ../examples/TikiTest/build/Development/TikiTest.app \
+ ../dist/$(SVN_VERSION)/tmp-debug/TikiTest.app
+ ditto -v ../examples/console/TikiSnake/build/Development/TikiSnake.app \
+ ../dist/$(SVN_VERSION)/tmp-debug/TikiSnake.app
+ hdiutil create -fs HFS+ \
+ -srcfolder "../dist/$(SVN_VERSION)/tmp-debug" \
+ -volname "Tiki r$(SVN_VERSION) Debug" \
+ "../dist/$(SVN_VERSION)/Tiki-$(SVN_VERSION)-Debug.dmg"
+ rm -rf ../dist/$(SVN_VERSION)/tmp-debug
+ gzip ../dist/$(SVN_VERSION)/Tiki-$(SVN_VERSION)-Debug.dmg
+ mkdir ../dist/$(SVN_VERSION)/tmp-release
+ ditto -v build/Deployment/Tiki.framework \
+ ../dist/$(SVN_VERSION)/tmp-release/Tiki.framework
+ ditto -v ../examples/TikiTest/build/Deployment/TikiTest.app \
+ ../dist/$(SVN_VERSION)/tmp-release/TikiTest.app
+ ditto -v ../examples/console/TikiSnake/build/Deployment/TikiSnake.app \
+ ../dist/$(SVN_VERSION)/tmp-release/TikiSnake.app
+ hdiutil create -fs HFS+ \
+ -srcfolder "../dist/$(SVN_VERSION)/tmp-release" \
+ -volname "Tiki r$(SVN_VERSION) Release" \
+ "../dist/$(SVN_VERSION)/Tiki-$(SVN_VERSION)-Release.dmg"
+ gzip ../dist/$(SVN_VERSION)/Tiki-$(SVN_VERSION)-Release.dmg
+ rm -rf ../dist/$(SVN_VERSION)/tmp-release
Modified: tiki/sdl/Makefile
===================================================================
--- tiki/sdl/Makefile 2007-08-14 05:15:40 UTC (rev 463)
+++ tiki/sdl/Makefile 2007-08-14 22:08:35 UTC (rev 464)
@@ -59,8 +59,16 @@
$(MAKE) TIKI_PLAT=sdl TIKI_DIR=$(CURDIR)/../ -C$(CURDIR)/../examples/console/TikiSnake
package:
- zip -9r ../dist/$(SVN_VERSION)/tiki-$(SVN_VERSION)-sdl.zip libtiki.a
- cd .. && zip -9ru dist/$(SVN_VERSION)/tiki-$(SVN_VERSION)-sdl.zip include sdl/include -x "*/.svn/*"
- cd .. && zip -9ru dist/$(SVN_VERSION)/tiki-$(SVN_VERSION)-sdl.zip examples/TikiTest/tikitest examples/console/TikiSnake/tikisnake examples/console/TikiSnake/resources -x "*/.svn/*"
+ tar -cvf ../dist/$(SVN_VERSION)/tiki-$(SVN_VERSION)-sdl.tar libtiki.a
+ tar -uvf ../dist/$(SVN_VERSION)/tiki-$(SVN_VERSION)-sdl.tar -C ../ \
+ include sdl/include --exclude "*/.svn/*"
+ cp ../examples/console/TikiSnake/resources/pc-ascii.png \
+ ../examples/console/TikiSnake
+ tar -uvf ../dist/$(SVN_VERSION)/tiki-$(SVN_VERSION)-sdl.tar -C ../ \
+ examples/TikiTest/tikitest \
+ examples/console/TikiSnake/tikisnake \
+ examples/console/TikiSnake/pc-ascii.png --exclude "*/.svn/*"
+ rm -f ../examples/console/TikiSnake/pc-ascii.png
+ gzip ../dist/$(SVN_VERISON)/tiki-$(SVN_VERSION)-sdl.tar
include Makefile.rules
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <at...@us...> - 2007-08-15 15:41:29
|
Revision: 467
http://cadcdev.svn.sourceforge.net/cadcdev/?rev=467&view=rev
Author: atani
Date: 2007-08-15 08:41:19 -0700 (Wed, 15 Aug 2007)
Log Message:
-----------
update packaging to include Makefile.rules where possible, gp2x -> tar.gz
Modified Paths:
--------------
tiki/dc/Makefile
tiki/gp2x/Makefile
tiki/nds/Makefile
tiki/sdl/Makefile
Modified: tiki/dc/Makefile
===================================================================
--- tiki/dc/Makefile 2007-08-14 22:50:19 UTC (rev 466)
+++ tiki/dc/Makefile 2007-08-15 15:41:19 UTC (rev 467)
@@ -29,7 +29,16 @@
package:
zip -9r ../dist/$(SVN_VERSION)/tiki-$(SVN_VERSION)-dc.zip libtiki.a
- cd .. && zip -9ru dist/$(SVN_VERSION)/tiki-$(SVN_VERSION)-dc.zip include dc/include -x "*/.svn/*"
- cd .. && zip -9ru dist/$(SVN_VERSION)/tiki-$(SVN_VERSION)-dc.zip examples/TikiTest/tikitest examples/console/TikiSnake/tikisnake -x "*/.svn/*"
+ cd .. && \
+ zip -9ru dist/$(SVN_VERSION)/tiki-$(SVN_VERSION)-dc.zip \
+ include \
+ dc/include \
+ dc/Makefile.rules \
+ -x "*/.svn/*"
+ cd .. && \
+ zip -9ru dist/$(SVN_VERSION)/tiki-$(SVN_VERSION)-dc.zip \
+ examples/TikiTest/tikitest \
+ examples/console/TikiSnake/tikisnake \
+ -x "*/.svn/*"
include Makefile.rules
Modified: tiki/gp2x/Makefile
===================================================================
--- tiki/gp2x/Makefile 2007-08-14 22:50:19 UTC (rev 466)
+++ tiki/gp2x/Makefile 2007-08-15 15:41:19 UTC (rev 467)
@@ -59,8 +59,19 @@
$(MAKE) TIKI_PLAT=gp2x TIKI_DIR=$(CURDIR)/../ -C$(CURDIR)/../examples/console/TikiSnake
package:
- zip -9r ../dist/$(SVN_VERSION)/tiki-$(SVN_VERSION)-gp2x.zip libtiki.a
- cd .. && zip -9ru dist/$(SVN_VERSION)/tiki-$(SVN_VERSION)-gp2x.zip include gp2x/include -x "*/.svn/*"
- cd .. && zip -9ru dist/$(SVN_VERSION)/tiki-$(SVN_VERSION)-gp2x.zip examples/TikiTest/tikitest examples/console/TikiSnake/tikisnake examples/console/TikiSnake/resources -x "*/.svn/*"
+ tar -cvf ../dist/$(SVN_VERSION)/tiki-$(SVN_VERSION)-gp2x.tar libtiki.a
+ tar -uvf ../dist/$(SVN_VERSION)/tiki-$(SVN_VERSION)-gp2x.tar -C ../ \
+ include \
+ gp2x/include \
+ gp2x/Makefile.rules \
+ --exclude "*/.svn/*"
+ cp ../examples/console/TikiSnake/resources/pc-ascii.png \
+ ../examples/console/TikiSnake
+ tar -uvf ../dist/$(SVN_VERSION)/tiki-$(SVN_VERSION)-gp2x.tar -C ../ \
+ examples/TikiTest/tikitest \
+ examples/console/TikiSnake/tikisnake \
+ examples/console/TikiSnake/pc-ascii.png --exclude "*/.svn/*"
+ rm -f ../examples/console/TikiSnake/pc-ascii.png
+ gzip ../dist/$(SVN_VERSION)/tiki-$(SVN_VERSION)-gp2x.tar
include Makefile.rules
Modified: tiki/nds/Makefile
===================================================================
--- tiki/nds/Makefile 2007-08-14 22:50:19 UTC (rev 466)
+++ tiki/nds/Makefile 2007-08-15 15:41:19 UTC (rev 467)
@@ -58,9 +58,21 @@
$(MAKE) TIKI_PLAT=nds TIKI_DIR=$(CURDIR)/../ -C$(CURDIR)/../examples/console/TikiSnake
package:
- zip -9r ../dist/$(SVN_VERSION)/tiki-$(SVN_VERSION)-nds.zip libtiki.a arm7_template -x "*/.svn/*"
- cd .. && zip -9ru dist/$(SVN_VERSION)/tiki-$(SVN_VERSION)-nds.zip include nds/include -x "*/.svn/*"
- cd .. && zip -9ru dist/$(SVN_VERSION)/tiki-$(SVN_VERSION)-nds.zip examples/TikiTest/tikitest examples/console/TikiSnake/tikisnake -x "*/.svn/*"
+ zip -9r ../dist/$(SVN_VERSION)/tiki-$(SVN_VERSION)-nds.zip \
+ libtiki.a \
+ arm7_template \
+ -x "*/.svn/*"
+ cd .. && \
+ zip -9ru dist/$(SVN_VERSION)/tiki-$(SVN_VERSION)-nds.zip \
+ include \
+ nds/include \
+ nds/Makefile.rules \
+ -x "*/.svn/*"
+ cd .. && \
+ zip -9ru dist/$(SVN_VERSION)/tiki-$(SVN_VERSION)-nds.zip \
+ examples/TikiTest/tikitest \
+ examples/console/TikiSnake/tikisnake \
+ -x "*/.svn/*"
DEPSDIR=$(CURDIR)
TIKI_DIR=$(CURDIR)/..
Modified: tiki/sdl/Makefile
===================================================================
--- tiki/sdl/Makefile 2007-08-14 22:50:19 UTC (rev 466)
+++ tiki/sdl/Makefile 2007-08-15 15:41:19 UTC (rev 467)
@@ -61,7 +61,10 @@
package:
tar -cvf ../dist/$(SVN_VERSION)/tiki-$(SVN_VERSION)-sdl.tar libtiki.a
tar -uvf ../dist/$(SVN_VERSION)/tiki-$(SVN_VERSION)-sdl.tar -C ../ \
- include sdl/include --exclude "*/.svn/*"
+ include \
+ sdl/include \
+ sdl/Makefile.rules \
+ --exclude "*/.svn/*"
cp ../examples/console/TikiSnake/resources/pc-ascii.png \
../examples/console/TikiSnake
tar -uvf ../dist/$(SVN_VERSION)/tiki-$(SVN_VERSION)-sdl.tar -C ../ \
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <at...@us...> - 2007-08-16 22:39:11
|
Revision: 473
http://cadcdev.svn.sourceforge.net/cadcdev/?rev=473&view=rev
Author: atani
Date: 2007-08-16 15:39:10 -0700 (Thu, 16 Aug 2007)
Log Message:
-----------
properly exclude .svn from tar files
fix assert when ansi code goes over the 80x25 screen size (allows rendering to col 80)
Modified Paths:
--------------
tiki/gp2x/Makefile
tiki/sdl/Makefile
tiki/src/gl/drawables/console.cpp
Modified: tiki/gp2x/Makefile
===================================================================
--- tiki/gp2x/Makefile 2007-08-16 19:05:47 UTC (rev 472)
+++ tiki/gp2x/Makefile 2007-08-16 22:39:10 UTC (rev 473)
@@ -65,13 +65,14 @@
gp2x/include \
gp2x/lib \
gp2x/Makefile.rules \
- --exclude "*/.svn/*"
+ --exclude .svn
cp ../examples/console/TikiSnake/resources/pc-ascii.png \
../examples/console/TikiSnake
tar -uvf ../dist/$(SVN_VERSION)/tiki-$(SVN_VERSION)-gp2x.tar -C ../ \
examples/TikiTest/tikitest \
examples/console/TikiSnake/tikisnake \
- examples/console/TikiSnake/pc-ascii.png --exclude "*/.svn/*"
+ examples/console/TikiSnake/pc-ascii.png \
+ --exclude .svn
rm -f ../examples/console/TikiSnake/pc-ascii.png
gzip ../dist/$(SVN_VERSION)/tiki-$(SVN_VERSION)-gp2x.tar
Modified: tiki/sdl/Makefile
===================================================================
--- tiki/sdl/Makefile 2007-08-16 19:05:47 UTC (rev 472)
+++ tiki/sdl/Makefile 2007-08-16 22:39:10 UTC (rev 473)
@@ -64,13 +64,14 @@
include \
sdl/include \
sdl/Makefile.rules \
- --exclude "*/.svn/*"
+ --exclude .svn
cp ../examples/console/TikiSnake/resources/pc-ascii.png \
../examples/console/TikiSnake
tar -uvf ../dist/$(SVN_VERSION)/tiki-$(SVN_VERSION)-sdl.tar -C ../ \
examples/TikiTest/tikitest \
examples/console/TikiSnake/tikisnake \
- examples/console/TikiSnake/pc-ascii.png --exclude "*/.svn/*"
+ examples/console/TikiSnake/pc-ascii.png \
+ --exclude .svn
rm -f ../examples/console/TikiSnake/pc-ascii.png
gzip ../dist/$(SVN_VERSION)/tiki-$(SVN_VERSION)-sdl.tar
Modified: tiki/src/gl/drawables/console.cpp
===================================================================
--- tiki/src/gl/drawables/console.cpp 2007-08-16 19:05:47 UTC (rev 472)
+++ tiki/src/gl/drawables/console.cpp 2007-08-16 22:39:10 UTC (rev 473)
@@ -81,7 +81,7 @@
}
void ConsoleText::scroll(int rows, int top, int left, int bottom, int right) {
- assert(top >= 0 && left >= 0 && bottom < m_rows && right < m_cols);
+ assert(top >= 0 && left >= 0 && bottom <= m_rows && right <= m_cols);
for(int y=top; y<=bottom; y++) {
for(int x=left; x<=right; x++) {
@@ -166,7 +166,7 @@
continue;
}
- assert(m_cursor_x >= 0 && m_cursor_y >= 0 && m_cursor_x < m_cols && m_cursor_y < m_rows);
+ assert(m_cursor_x >= 0 && m_cursor_y >= 0 && m_cursor_x <= m_cols && m_cursor_y <= m_rows);
m_charData[(m_cursor_y * m_cols) + m_cursor_x] = buf[i];
m_colorData[(m_cursor_y * m_cols) + m_cursor_x] = m_attr;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <at...@us...> - 2007-08-21 04:09:25
|
Revision: 475
http://cadcdev.svn.sourceforge.net/cadcdev/?rev=475&view=rev
Author: atani
Date: 2007-08-20 21:08:54 -0700 (Mon, 20 Aug 2007)
Log Message:
-----------
Initial cut of Tiki::Net support
currently implemented:
* Address resolution (win32, sdl, OSX maybe [needs testing])
* basic TCPSocket support (connect, disconnect, read, write) for sdl, win32, partial OSX support
* example of connecting to http://www.example.com/ and downloading index.html
Modified Paths:
--------------
tiki/examples/TikiTest/TikiTest_vc80.vcproj
tiki/examples/console/TikiSnake/TikiSnake.vcproj
tiki/osx/src/init_shutdown.cpp
tiki/sdl/Makefile
tiki/sdl/src/init_shutdown.cpp
tiki/win32/tiki_vc80.sln
tiki/win32/tiki_vs80.vcproj
Added Paths:
-----------
tiki/examples/net/
tiki/examples/net/basic/
tiki/examples/net/basic/Makefile
tiki/examples/net/basic/basic.vcproj
tiki/examples/net/basic/src/
tiki/examples/net/basic/src/BasicNetTest.cpp
tiki/examples/net/basic/src/main.cpp
tiki/include/Tiki/net/
tiki/include/Tiki/net/address.h
tiki/include/Tiki/net/buffer.h
tiki/include/Tiki/net/net.h
tiki/include/Tiki/net/socket.h
tiki/include/Tiki/net/tcpserversocket.h
tiki/include/Tiki/net/tcpsocket.h
tiki/include/Tiki/net/udpsocket.h
tiki/osx/include/Tiki/platnet.h
tiki/osx/src/platnet.cpp
tiki/sdl/include/Tiki/platnet.h
tiki/sdl/src/platnet.cpp
tiki/src/net/
tiki/src/net/address.cpp
tiki/src/net/socket.cpp
tiki/src/net/tcpserversocket.cpp
tiki/src/net/tcpsocket.cpp
tiki/win32/include/Tiki/platnet.h
tiki/win32/src/platnet.cpp
Modified: tiki/examples/TikiTest/TikiTest_vc80.vcproj
===================================================================
--- tiki/examples/TikiTest/TikiTest_vc80.vcproj 2007-08-16 23:06:56 UTC (rev 474)
+++ tiki/examples/TikiTest/TikiTest_vc80.vcproj 2007-08-21 04:08:54 UTC (rev 475)
@@ -59,7 +59,7 @@
/>
<Tool
Name="VCLinkerTool"
- AdditionalDependencies="gdi32.lib kernel32.lib user32.lib opengl32.lib glu32.lib comdlg32.lib"
+ AdditionalDependencies="gdi32.lib kernel32.lib user32.lib opengl32.lib glu32.lib comdlg32.lib ws2_32.lib"
LinkIncremental="2"
AdditionalLibraryDirectories="$(ProjectDir)\..\..\win32\Debug;"C:\Program Files\OpenAL 1.1 SDK\libs\Win32""
GenerateDebugInformation="true"
@@ -134,7 +134,7 @@
/>
<Tool
Name="VCLinkerTool"
- AdditionalDependencies="gdi32.lib kernel32.lib user32.lib opengl32.lib glu32.lib comdlg32.lib"
+ AdditionalDependencies="gdi32.lib kernel32.lib user32.lib opengl32.lib glu32.lib comdlg32.lib ws2_32.lib"
LinkIncremental="1"
AdditionalLibraryDirectories="$(ProjectDir)\..\..\win32\Release;C:\Program Files\OpenAL 1.1 SDK\libs\Win32"
IgnoreDefaultLibraryNames=""
Modified: tiki/examples/console/TikiSnake/TikiSnake.vcproj
===================================================================
--- tiki/examples/console/TikiSnake/TikiSnake.vcproj 2007-08-16 23:06:56 UTC (rev 474)
+++ tiki/examples/console/TikiSnake/TikiSnake.vcproj 2007-08-21 04:08:54 UTC (rev 475)
@@ -59,7 +59,7 @@
/>
<Tool
Name="VCLinkerTool"
- AdditionalDependencies="gdi32.lib kernel32.lib user32.lib opengl32.lib glu32.lib comdlg32.lib"
+ AdditionalDependencies="gdi32.lib kernel32.lib user32.lib opengl32.lib glu32.lib comdlg32.lib ws2_32.lib"
LinkIncremental="2"
AdditionalLibraryDirectories="$(ProjectDir)\..\..\..\win32\Debug;"C:\Program Files\OpenAL 1.1 SDK\libs\Win32""
GenerateDebugInformation="true"
@@ -134,7 +134,7 @@
/>
<Tool
Name="VCLinkerTool"
- AdditionalDependencies="gdi32.lib kernel32.lib user32.lib opengl32.lib glu32.lib comdlg32.lib"
+ AdditionalDependencies="gdi32.lib kernel32.lib user32.lib opengl32.lib glu32.lib comdlg32.lib ws2_32.lib"
LinkIncremental="1"
AdditionalLibraryDirectories="$(ProjectDir)\..\..\..\win32\Release;C:\Program Files\OpenAL 1.1 SDK\libs\Win32"
IgnoreDefaultLibraryNames=""
Added: tiki/examples/net/basic/Makefile
===================================================================
--- tiki/examples/net/basic/Makefile (rev 0)
+++ tiki/examples/net/basic/Makefile 2007-08-21 04:08:54 UTC (rev 475)
@@ -0,0 +1,13 @@
+
+TIKI_DIR=../../../
+CFLAGS=-I$(TIKI_DIR)$(TIKI_PLAT)/include -I$(TIKI_DIR)include
+OBJS = $(patsubst %.cpp,%.o,$(wildcard src/*.cpp))
+
+all: $(OBJS)
+ $(CXX) $(LDFLAGS) -L$(TIKI_DIR)$(TIKI_PLAT) -L$(TIKI_DIR)$(TIKI_PLAT)/lib $(OBJS) $(TIKI_BASE_LIBS) -o basic
+
+clean:
+ -rm -f $(OBJS) basic
+
+DEPSDIR=$(CURDIR)
+include $(TIKI_DIR)$(TIKI_PLAT)/Makefile.rules
Added: tiki/examples/net/basic/basic.vcproj
===================================================================
--- tiki/examples/net/basic/basic.vcproj (rev 0)
+++ tiki/examples/net/basic/basic.vcproj 2007-08-21 04:08:54 UTC (rev 475)
@@ -0,0 +1,205 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="BasicNet"
+ ProjectGUID="{7B823C96-860C-4578-95CC-1087A45AF1AA}"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="$(ProjectDir)\..\..\..\win32\include;$(ProjectDir)\..\..\..\include;"C:\Program Files\OpenAL 1.1 SDK\include""
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="gdi32.lib kernel32.lib user32.lib opengl32.lib glu32.lib comdlg32.lib ws2_32.lib"
+ LinkIncremental="2"
+ AdditionalLibraryDirectories="$(ProjectDir)\..\..\..\win32\Debug;"C:\Program Files\OpenAL 1.1 SDK\libs\Win32""
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="$(ProjectDir)\..\..\..\win32\include;$(ProjectDir)\..\..\..\include;"C:\Program Files\OpenAL 1.1 SDK\include""
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;"
+ RuntimeLibrary="0"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="gdi32.lib kernel32.lib user32.lib opengl32.lib glu32.lib comdlg32.lib ws2_32.lib"
+ LinkIncremental="1"
+ AdditionalLibraryDirectories="$(ProjectDir)\..\..\..\win32\Release;C:\Program Files\OpenAL 1.1 SDK\libs\Win32"
+ IgnoreDefaultLibraryNames=""
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+ >
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+ >
+ </Filter>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+ >
+ <File
+ RelativePath=".\src\BasicNetTest.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\src\main.cpp"
+ >
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
Added: tiki/examples/net/basic/src/BasicNetTest.cpp
===================================================================
--- tiki/examples/net/basic/src/BasicNetTest.cpp (rev 0)
+++ tiki/examples/net/basic/src/BasicNetTest.cpp 2007-08-21 04:08:54 UTC (rev 475)
@@ -0,0 +1,27 @@
+/*
+* Basic.cpp
+* Basic Network test
+*
+* Copyright (C)2007 Atani Software
+*
+*/
+
+#include <Tiki/tiki.h>
+#include <pch.h>
+
+#if TIKI_PLAT == TIKI_WIN32
+#include <windows.h>
+
+static char szAppName[] = "BasicNetTest";
+int APIENTRY WinMain( HINSTANCE hInst, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow )
+#else
+extern "C" int tiki_main( int argc, char *argv[] );
+int main( int argc, char *argv[] )
+#endif
+{
+#if TIKI_PLAT != TIKI_WIN32
+ return tiki_main( argc, argv );
+#else
+ return Tiki::DoMain( szAppName, hInst, hPrevInstance, lpCmdLine, nCmdShow );
+#endif
+}
Added: tiki/examples/net/basic/src/main.cpp
===================================================================
--- tiki/examples/net/basic/src/main.cpp (rev 0)
+++ tiki/examples/net/basic/src/main.cpp 2007-08-21 04:08:54 UTC (rev 475)
@@ -0,0 +1,55 @@
+/*
+* Basic.cpp
+* Basic Network test
+*
+* Copyright (C)2007 Atani Software
+*
+*/
+
+#include <Tiki/tiki.h>
+#include <Tiki/refcnt.h>
+#include <Tiki/tikitime.h>
+#include <Tiki/net/net.h>
+
+using namespace Tiki;
+using namespace Tiki::Debug;
+using namespace Tiki::Net;
+using namespace Tiki::Net::TCP;
+using namespace Tiki::Time;
+
+extern "C" int tiki_main( int argc, char **argv) {
+
+ Tiki::Net::init();
+
+ RefPtr<Address> address = new Address();
+ address->setHostName("www.example.com");
+ address->setPort(80);
+ Tiki::Debug::printf("%s -> %s\n",
+ address->getHostName().c_str(),
+ address->getIPAddressString().c_str());
+
+ RefPtr<TCPSocket> socket = new TCPSocket(address);
+
+ Tiki::Debug::printf("localaddress: %s\n", socket->getLocalAddress()->getIPAddressString().c_str());
+ socket->open();
+
+ RefPtr<Buffer> buf = new Buffer(1024);
+ Tiki::Debug::printf("Requesting www.example.com/index.html");
+ string str = "GET /index.html HTTP/1.1\r\nHost: " + address->getHostName() + "\r\n\r\n";
+ buf->setData((uint8 *)str.c_str(), str.length());
+
+ socket->send(buf);
+
+ Tiki::Time::sleep(50000);
+
+ RefPtr<Buffer> reply = new Buffer(1024);
+ socket->recv(reply);
+ if(reply != NULL) {
+ Tiki::Debug::printf("%s\n", reply->getData());
+ }
+
+ socket->close();
+
+ Tiki::Net::shutdown();
+ return 0;
+}
Added: tiki/include/Tiki/net/address.h
===================================================================
--- tiki/include/Tiki/net/address.h (rev 0)
+++ tiki/include/Tiki/net/address.h 2007-08-21 04:08:54 UTC (rev 475)
@@ -0,0 +1,55 @@
+/*
+ Tiki
+
+ address.h
+
+ Copyright (C)2007 Atani Software
+*/
+#ifndef __TIKI_NET_ADDRESS_H
+#define __TIKI_NET_ADDRESS_H
+
+#include "Tiki/refcnt.h"
+
+namespace Tiki {
+
+namespace Net {
+
+class Address : public RefCnt
+{
+ public:
+ Address();
+
+ typedef enum AddressType {
+ AddressUnknown = 0x00000000,
+ AddressAny = 0x00000001,
+ AddressNone = 0x00000002,
+ AddressBroadcast = 0x00000003
+ };
+
+
+ int getPort() {
+ return m_port;
+ }
+
+ void setPort(int port) {
+ m_port = port;
+ }
+
+ string getHostName();
+ void setHostName(string hostname);
+
+ uint32 getIPAddress();
+ string getIPAddressString();
+ void setIPAddress(uint32 ip);
+
+ private:
+ string m_hostname;
+ uint32 m_ip;
+ int m_port;
+};
+
+} // namespace Net
+
+} // namespace Tiki
+
+#endif // __TIKI_NET_ADDRESS_H
Added: tiki/include/Tiki/net/buffer.h
===================================================================
--- tiki/include/Tiki/net/buffer.h (rev 0)
+++ tiki/include/Tiki/net/buffer.h 2007-08-21 04:08:54 UTC (rev 475)
@@ -0,0 +1,68 @@
+/*
+ Tiki
+
+ buffer.h
+
+ Copyright (C)2007 Atani Software
+*/
+#ifndef __TIKI_NET_BUFFER_H
+#define __TIKI_NET_BUFFER_H
+
+#include "Tiki/object.h"
+
+namespace Tiki {
+
+namespace Net {
+
+class Buffer : public Object
+{
+ public:
+ Buffer(size_t len) {
+ m_data = new uint8[len];
+ memset(m_data, 0, len);
+ m_dataLen = len;
+ }
+ Buffer(size_t len, uint8 *data) {
+ m_data = new uint8[len];
+ memset(m_data, 0, len);
+ m_dataLen = len;
+ memcpy(m_data, data, len);
+ }
+
+ uint8 *getData() const {
+ return m_data;
+ }
+
+ size_t getDataLen() const {
+ return m_dataLen;
+ }
+
+ size_t getUsedDataLen() const {
+ return m_usedDataLen;
+ }
+
+ void setData(uint8 *data, size_t len) {
+ memset(m_data, 0, m_dataLen);
+ if(len > m_dataLen)
+ {
+ memcpy(m_data, data, m_dataLen);
+ m_usedDataLen = m_dataLen;
+ }
+ else
+ {
+ memcpy(m_data, data, len);
+ m_usedDataLen = len;
+ }
+ }
+
+ private:
+ uint8 *m_data;
+ size_t m_dataLen;
+ size_t m_usedDataLen;
+};
+
+} // namespace Net
+
+} // namespace Tiki
+
+#endif // __TIKI_NET_UDPPACKET_H
Added: tiki/include/Tiki/net/net.h
===================================================================
--- tiki/include/Tiki/net/net.h (rev 0)
+++ tiki/include/Tiki/net/net.h 2007-08-21 04:08:54 UTC (rev 475)
@@ -0,0 +1,28 @@
+/*
+ Tiki
+
+ net.h
+
+ Copyright (C)2007 Atani Software
+*/
+#ifndef __TIKI_NET_H
+#define __TIKI_NET_H
+
+#include "Tiki/platnet.h"
+
+namespace Tiki {
+
+namespace Net {
+
+void init();
+void shutdown();
+
+} // namespace Net
+
+} // namespace Tiki
+
+#endif // __TIKI_NET_H
+
+#include <Tiki/net/buffer.h>
+#include <Tiki/net/address.h>
+#include <Tiki/net/tcpsocket.h>
Added: tiki/include/Tiki/net/socket.h
===================================================================
--- tiki/include/Tiki/net/socket.h (rev 0)
+++ tiki/include/Tiki/net/socket.h 2007-08-21 04:08:54 UTC (rev 475)
@@ -0,0 +1,79 @@
+/*
+ Tiki
+
+ socket.h
+
+ Copyright (C)2007 Atani Software
+*/
+#ifndef __TIKI_NET_SOCKET_H
+#define __TIKI_NET_SOCKET_H
+
+#include "Tiki/object.h"
+#include "Tiki/net/address.h"
+#include "Tiki/net/buffer.h"
+
+namespace Tiki {
+
+namespace Net {
+
+class Socket : public Object
+{
+ public:
+ Socket();
+ Socket(RefPtr<Address> address);
+
+ RefPtr<Address> getPeerAddress()
+ {
+ return m_peerAddress;
+ }
+
+ void setPeerAddress(RefPtr<Address> address)
+ {
+ m_peerAddress = address;
+ }
+
+ RefPtr<Address> getLocalAddress()
+ {
+ return m_localAddress;
+ }
+
+ bool isNonBlocking()
+ {
+ return m_blocking;
+ }
+
+ void setNonBlocking(bool blocking)
+ {
+ m_blocking = blocking;
+ }
+
+ bool isReuse()
+ {
+ return m_reuse;
+ }
+
+ void setReuse(bool reuse)
+ {
+ m_reuse = reuse;
+ }
+
+ virtual void send(RefPtr<Buffer> data) = 0;
+
+ virtual void recv(RefPtr<Buffer> data) = 0;
+
+ virtual void open() = 0;
+
+ virtual void close() = 0;
+
+ private:
+ RefPtr<Address> m_peerAddress;
+ RefPtr<Address> m_localAddress;
+ bool m_blocking;
+ bool m_reuse;
+};
+
+} // namespace Net
+
+} // namespace Tiki
+
+#endif // __TIKI_NET_SOCKET_H
Added: tiki/include/Tiki/net/tcpserversocket.h
===================================================================
--- tiki/include/Tiki/net/tcpserversocket.h (rev 0)
+++ tiki/include/Tiki/net/tcpserversocket.h 2007-08-21 04:08:54 UTC (rev 475)
@@ -0,0 +1,36 @@
+/*
+ Tiki
+
+ tcpservesocket.h
+
+ Copyright (C)2007 Atani Software
+*/
+#ifndef __TIKI_NET_TCPSERVERSOCKET_H
+#define __TIKI_NET_TCPSERVERSOCKET_H
+
+#include "Tiki/net/tcpsocket.h"
+
+namespace Tiki {
+
+namespace Net {
+
+namespace TCP {
+
+class TCPServerSocket : public TCPSocket
+{
+ public:
+ TCPServerSocket() : TCPSocket() {};
+ TCPServerSocket(RefPtr<Address> address) : TCPSocket(address) {};
+
+ void bind();
+
+ RefPtr<TCPSocket> accept();
+};
+
+} // namespace TCP
+
+} // namespace Net
+
+} // namespace Tiki
+
+#endif // __TIKI_NET_TCPSERVERSOCKET_H
Added: tiki/include/Tiki/net/tcpsocket.h
===================================================================
--- tiki/include/Tiki/net/tcpsocket.h (rev 0)
+++ tiki/include/Tiki/net/tcpsocket.h 2007-08-21 04:08:54 UTC (rev 475)
@@ -0,0 +1,71 @@
+/*
+ Tiki
+
+ tcpsocket.h
+
+ Copyright (C)2007 Atani Software
+*/
+#ifndef __TIKI_NET_TCPSOCKET_H
+#define __TIKI_NET_TCPSOCKET_H
+
+#include "Tiki/platnet.h"
+#include "Tiki/net/buffer.h"
+#include "Tiki/net/socket.h"
+
+namespace Tiki {
+
+namespace Net {
+
+namespace TCP {
+
+using Tiki::Net::Buffer;
+
+class TCPSocket : public Tiki::Net::Socket
+{
+ public:
+
+#ifndef INVALID_SOCKET
+ enum {
+ INVALID_SOCKET = -1,
+ SOCKET_ERROR = -1
+ };
+#endif
+ TCPSocket() : Socket() {};
+ TCPSocket(RefPtr<Address> address) : Socket(address) {};
+
+ virtual void send(RefPtr<Buffer> data);
+
+ virtual void recv(RefPtr<Buffer> data);
+
+ uint32 getPort()
+ {
+ return m_port;
+ }
+
+ void setPort(uint32 port)
+ {
+ m_port = port;
+ }
+ virtual void open();
+
+ virtual void close();
+
+ private:
+ uint32 m_port;
+#if TIKI_PLAT == TIKI_OSX
+ ;
+#elif TIKI_PLAT == TIKI_WIN32
+ SOCKET m_socket;
+#else
+ int m_socket;
+#endif
+
+};
+
+} // namespace TCP
+
+} // namespace Net
+
+} // namespace Tiki
+
+#endif // __TIKI_NET_TCPSOCKET_H
Added: tiki/include/Tiki/net/udpsocket.h
===================================================================
--- tiki/include/Tiki/net/udpsocket.h (rev 0)
+++ tiki/include/Tiki/net/udpsocket.h 2007-08-21 04:08:54 UTC (rev 475)
@@ -0,0 +1,36 @@
+/*
+ Tiki
+
+ tcpsocket.h
+
+ Copyright (C)2007 Atani Software
+*/
+#ifndef __TIKI_NET_UDPSOCKET_H
+#define __TIKI_NET_UDPSOCKET_H
+
+namespace Tiki {
+
+namespace Net {
+
+namespace UDP {
+
+#define MAX_UDP_CHANNELS 32
+
+class UDPSocket : public Tiki::Net::Socket
+{
+ public:
+ virtual void send(RefPtr<Buffer> data);
+ virtual void recv(RefPtr<Buffer> data);
+
+ void open(uint32 port);
+
+ void bind(RefPtr<UDPSocket> socket, int channel, RefPtr<Address> address);
+};
+
+} // namespace UDP
+
+} // namespace Net
+
+} // namespace Tiki
+
+#endif // __TIKI_NET_UDPSOCKET_H
Added: tiki/osx/include/Tiki/platnet.h
===================================================================
--- tiki/osx/include/Tiki/platnet.h (rev 0)
+++ tiki/osx/include/Tiki/platnet.h 2007-08-21 04:08:54 UTC (rev 475)
@@ -0,0 +1,33 @@
+/*
+ Tiki
+
+ platnet.h
+
+ Copyright (C)2007 Atani Software
+*/
+
+#ifndef TIKI_PLATFORM_NET_H
+#define TIKI_PLATFORM_NET_H
+#include <OpenTransport.h>
+#include <OpenTptInternet.h>
+#include <Events.h>
+
+namespace Tiki {
+
+namespace Net {
+
+enum DNS_STATUS {
+ NOT_READY = 0,
+ READY,
+ RESOLVED,
+ ERROR
+};
+
+extern DNS_STATUS g_tikiDNSStatus;
+extern InetSvcRef g_tikiDNSRef;
+
+}; // namespace Net
+
+}; // namespace Tiki
+
+#endif // TIKI_PLATFORM_NET_H
Modified: tiki/osx/src/init_shutdown.cpp
===================================================================
--- tiki/osx/src/init_shutdown.cpp 2007-08-16 23:06:56 UTC (rev 474)
+++ tiki/osx/src/init_shutdown.cpp 2007-08-21 04:08:54 UTC (rev 475)
@@ -71,4 +71,5 @@
}
};
+
};
Added: tiki/osx/src/platnet.cpp
===================================================================
--- tiki/osx/src/platnet.cpp (rev 0)
+++ tiki/osx/src/platnet.cpp 2007-08-21 04:08:54 UTC (rev 475)
@@ -0,0 +1,82 @@
+/*
+ Tiki
+
+ platnet.cpp
+
+ Copyright (C)2007 Atani Software
+*/
+
+#include "Tiki/tiki.h"
+#include "Tiki/net/net.h"
+
+namespace Tiki {
+
+namespace Net {
+
+DNS_STATUS g_tikiDNSStatus;
+InetSvcRef g_tikiDNSRef;
+
+static pascal void dnsNotifier(void *context, OTEventCode code, OTResult result, void *cookie) {
+ switch(code) {
+ case T_OPENCOMPLETE:
+ if(result == kOTNoError) {
+ g_tikiDNSStatus = READY;
+ g_tikiDNSRef = (InetSvcRef)cookie;
+ }
+ else {
+ g_tikiDNSStatus = ERROR;
+ Tiki::Debug::printf("T_DNRSTRINGTOADDRCOMPLETE event returned an error\n");
+ }
+ break;
+ case T_DNRSTRINGTOADDRCOMPLETE:
+ g_tikiDNSStatus = RESOLVED;
+ break;
+ default:
+ if(result != kOTNoError) {
+ g_tikiDNSStatus = ERROR;
+ Tiki::Debug::printf("Error in DNS Resolver\n");
+ }
+ }
+}
+
+void startDNS() {
+ OSStatus status;
+
+ status = OTAsyncOpenInternetServices(
+ kDefaultInternetServicesPath, 0, dnsNotifier, NULL);
+ if(status != noErr) {
+ Tiki::Debug::printf("Unable to initialize DNS Handler\n");
+ }
+}
+
+void stopDNS() {
+ if(g_dnsRef != 0) {
+ OTCloseProvider(g_tikiDNSRef);
+ g_tikiDNSStatus = NOT_READY;
+ g_tikiDNSRef = 0;
+ }
+}
+
+void init() {
+ OSStatus status;
+
+ g_tikiDNSStatus = NOT_READY;
+ g_tikiDNSRef = 0;
+
+ status = InitOpenTransport();
+ if(status == noErr) {
+ StartDNS();
+ }
+ else {
+ Tiki::Debug::printf("Unable to initialize OpenTransport\n");
+ }
+}
+
+void shutdown() {
+ stopDNS();
+}
+
+
+}
+
+};
Modified: tiki/sdl/Makefile
===================================================================
--- tiki/sdl/Makefile 2007-08-16 23:06:56 UTC (rev 474)
+++ tiki/sdl/Makefile 2007-08-21 04:08:54 UTC (rev 475)
@@ -10,6 +10,7 @@
BASE_IMAGE_OBJ=$(patsubst %.cpp,%.o,$(wildcard ../src/image/*.cpp))
BASE_MATH_OBJ=$(patsubst %.cpp,%.o,$(wildcard ../src/math/*.cpp))
BASE_THREAD_OBJ=$(patsubst %.cpp,%.o,$(wildcard ../src/thread/*.cpp))
+BASE_NET_OBJ=$(patsubst %.cpp,%.o,$(wildcard ../src/net/*.cpp))
JPEG_OBJ=$(patsubst %.c,%.o,$(wildcard ../3rdparty/libjpeg/*.c))
PNG_OBJ=$(patsubst %.c,%.o,$(wildcard ../3rdparty/libpng/*.c))
@@ -39,7 +40,7 @@
BASE_OBJS = $(BASE_AUDIO_OBJ) $(BASE_BASE_OBJ) $(BASE_GL_OBJ) \
$(BASE_HID_OBJ) $(BASE_IMAGE_OBJ) $(BASE_MATH_OBJ) \
- $(BASE_THREAD_OBJ)
+ $(BASE_THREAD_OBJ) $(BASE_NET_OBJ)
THIRD_PARTY_OBJS = $(JPEG_OBJ) $(OGG_OBJ) $(VORBIS_OBJ) $(PNG_OBJ) $(ZLIB_OBJ)
Added: tiki/sdl/include/Tiki/platnet.h
===================================================================
--- tiki/sdl/include/Tiki/platnet.h (rev 0)
+++ tiki/sdl/include/Tiki/platnet.h 2007-08-21 04:08:54 UTC (rev 475)
@@ -0,0 +1,12 @@
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <netinet/in.h>
+#include <netinet/tcp.h>
+#include <netdb.h>
+#include <sys/socket.h>
+#include <sys/time.h>
+
Modified: tiki/sdl/src/init_shutdown.cpp
===================================================================
--- tiki/sdl/src/init_shutdown.cpp 2007-08-16 23:06:56 UTC (rev 474)
+++ tiki/sdl/src/init_shutdown.cpp 2007-08-21 04:08:54 UTC (rev 475)
@@ -59,4 +59,15 @@
}
}
+namespace Net {
+
+void init()
+{
}
+
+void shutdown()
+{
+}
+}
+
+}
Added: tiki/sdl/src/platnet.cpp
===================================================================
--- tiki/sdl/src/platnet.cpp (rev 0)
+++ tiki/sdl/src/platnet.cpp 2007-08-21 04:08:54 UTC (rev 475)
@@ -0,0 +1,26 @@
+/*
+ Tiki
+
+ platnet.cpp
+
+ Copyright (C)2007 Atani Software
+*/
+
+#include "Tiki/tiki.h"
+#include "Tiki/net/net.h"
+
+namespace Tiki {
+
+namespace Net {
+
+void init()
+{
+}
+
+void shutdown()
+{
+}
+
+} // namespace Net
+
+} // namespace Tiki
Added: tiki/src/net/address.cpp
===================================================================
--- tiki/src/net/address.cpp (rev 0)
+++ tiki/src/net/address.cpp 2007-08-21 04:08:54 UTC (rev 475)
@@ -0,0 +1,129 @@
+/*
+ Tiki
+
+ address.cpp
+
+ Copyright (C)2007 Atani Software
+*/
+
+#include "pch.h"
+#include "Tiki/tiki.h"
+#include "Tiki/platnet.h"
+#include "Tiki/net/address.h"
+
+#include <sstream>
+
+namespace Tiki {
+
+namespace Net {
+
+Address::Address()
+{
+ m_hostname = "";
+ m_ip = AddressUnknown;
+ m_port = 0;
+}
+
+string Address::getHostName()
+{
+ if(m_hostname.empty() &&
+ m_ip != AddressUnknown &&
+ m_ip != AddressBroadcast &&
+ m_ip != AddressAny &&
+ m_ip != AddressNone )
+ {
+#if TIKI_PLAT == TIKI_OSX
+ InetHost ip;
+ InetDomainName domainName;
+ OSStatus status;
+
+ domainName[0] = '\0';
+ ip = m_ip;
+ status = OTInetAddressToName(g_tikiDNSRef, ip, domainName);
+ if(status == kOTNoError) {
+ while(g_tikiDNSStatus != RESOLVED)
+ {
+ ;
+ }
+ return domainName;
+ }
+#else
+ struct hostent *hp = gethostbyaddr((char *)&m_ip, 4, AF_INET);
+ if(hp != NULL)
+ {
+ m_hostname = string(hp->h_name);
+ }
+#endif
+ }
+
+ return m_hostname;
+}
+
+void Address::setHostName(string hostname)
+{
+ m_hostname = hostname;
+ m_ip = AddressUnknown;
+}
+
+uint32 Address::getIPAddress()
+{
+ if(m_ip == AddressUnknown)
+ {
+ Tiki::Debug::printf("resolving host: %s\n", m_hostname.c_str());
+#if TIKI_PLAT == TIKI_OSX
+ InetHostInfo host;
+ if(OTInetStringToAddress(g_tikiDNSRef, m_hostname.c_str(), &info) == noErr) {
+ while( g_tikiDNSStatus != RESOLVED)
+ {
+ WaitNextEvent(everyEvent, 0, 1, NULL);
+ }
+ return info.addrs[0];
+ }
+#else
+ struct hostent *hp = gethostbyname(m_hostname.c_str());
+ if(hp != NULL)
+ {
+ memcpy(&m_ip, hp->h_addr, hp->h_length);
+ }
+#endif
+ }
+ return m_ip;
+}
+
+string Address::getIPAddressString()
+{
+ if(m_ip == AddressAny)
+ {
+ return "0.0.0.0";
+ }
+ else if(m_ip == AddressBroadcast || m_ip == AddressNone)
+ {
+ return "255.255.255.255";
+ }
+
+ uint32 ipnums = getIPAddress();
+ uint8 *ip = (uint8 *)(&ipnums);
+ //Tiki::Debug::printf("host ip: %d.%d.%d.%d\n", ip[0], ip[1], ip[2], ip[3]);
+
+ std::ostringstream address;
+
+ address << (int)ip[0];
+ address << ".";
+ address << (int)ip[1];
+ address << ".";
+ address << (int)ip[2];
+ address << ".";
+ address << (int)ip[3];
+
+ return address.str();
+}
+
+void Address::setIPAddress(uint32 ip)
+{
+ m_ip = ip;
+ m_hostname = "";
+}
+
+} // namespace Net
+
+} // namespace Tiki
Added: tiki/src/net/socket.cpp
===================================================================
--- tiki/src/net/socket.cpp (rev 0)
+++ tiki/src/net/socket.cpp 2007-08-21 04:08:54 UTC (rev 475)
@@ -0,0 +1,37 @@
+/*
+ Tiki
+
+ socket.cpp
+
+ Copyright (C)2007 Atani Software
+*/
+
+#include "pch.h"
+#include "Tiki/tiki.h"
+#include "Tiki/platnet.h"
+#include "Tiki/net/socket.h"
+
+namespace Tiki {
+
+namespace Net {
+
+Socket::Socket()
+{
+ m_localAddress = new Address();
+ m_localAddress->setHostName("localhost");
+ m_blocking = true;
+ m_reuse = true;
+}
+
+Socket::Socket(RefPtr<Address> address)
+{
+ m_peerAddress = address;
+ m_localAddress = new Address();
+ m_localAddress->setHostName("localhost");
+ m_blocking = true;
+ m_reuse = true;
+}
+
+} // namespace Net
+
+} // namespace Tiki
Added: tiki/src/net/tcpserversocket.cpp
===================================================================
--- tiki/src/net/tcpserversocket.cpp (rev 0)
+++ tiki/src/net/tcpserversocket.cpp 2007-08-21 04:08:54 UTC (rev 475)
@@ -0,0 +1,34 @@
+/*
+ Tiki
+
+ tcpserversocket.cpp
+
+ Copyright (C)2007 Atani Software
+*/
+
+#include "pch.h"
+#include "Tiki/tiki.h"
+#include "Tiki/platnet.h"
+#include "Tiki/net/tcpserversocket.h"
+
+namespace Tiki {
+
+namespace Net {
+
+namespace TCP {
+
+void TCPServerSocket::bind()
+{
+
+}
+
+RefPtr<TCPSocket> TCPServerSocket::accept()
+{
+ return NULL;
+}
+
+} // namespace TCP
+
+} // namespace Net
+
+} // namespace Tiki
Added: tiki/src/net/tcpsocket.cpp
===================================================================
--- tiki/src/net/tcpsocket.cpp (rev 0)
+++ tiki/src/net/tcpsocket.cpp 2007-08-21 04:08:54 UTC (rev 475)
@@ -0,0 +1,131 @@
+/*
+ Tiki
+
+ tcpsocket.cpp
+
+ Copyright (C)2007 Atani Software
+*/
+
+#include "pch.h"
+#include "Tiki/tiki.h"
+#include "Tiki/platnet.h"
+
+#include <errno.h>
+
+namespace Tiki {
+
+namespace Net {
+
+namespace TCP {
+
+void TCPSocket::send(const RefPtr<Buffer> buffer) {
+#if TIKI_PLAT == TIKI_OSX
+#else
+ uint8 *data = buffer->getData();
+ size_t dataLen = buffer->getUsedDataLen();
+ int len;
+
+ do {
+ Tiki::Debug::printf("sending %d bytes\n", dataLen);
+ len = ::send(m_socket, (const char *)data, (int)dataLen, 0);
+ if(len > 0) {
+ Tiki::Debug::printf("sent %d bytes\n", len);
+ dataLen -= len;
+ data += len;
+ }
+ else {
+ Tiki::Debug::printf("sent %d bytes\n", len);
+ }
+ } while(dataLen > 0 && (len > 0 || errno == EINTR));
+ Tiki::Debug::printf("errno: %d [%x]\n", errno, errno);
+#endif
+}
+
+void TCPSocket::recv(RefPtr<Buffer> data) {
+#if TIKI_PLAT == TIKI_OSX
+#else
+ uint8 *tmp = new uint8[data->getDataLen()];
+ memset(tmp, 0, data->getDataLen());
+ int recvlen = 0;
+ errno = 0;
+ do {
+ Tiki::Debug::printf("receiving %d bytes\n", data->getDataLen());
+ recvlen = ::recv(m_socket, (char *)tmp, (int)data->getDataLen(), 0);
+ } while(errno == EINTR && (recvlen < 0 ...
[truncated message content] |
|
From: <at...@us...> - 2007-08-21 04:24:13
|
Revision: 476
http://cadcdev.svn.sourceforge.net/cadcdev/?rev=476&view=rev
Author: atani
Date: 2007-08-20 21:24:11 -0700 (Mon, 20 Aug 2007)
Log Message:
-----------
oops, correct includes
Modified Paths:
--------------
tiki/include/Tiki/net/net.h
tiki/src/net/address.cpp
tiki/src/net/socket.cpp
tiki/src/net/tcpserversocket.cpp
tiki/src/net/tcpsocket.cpp
Modified: tiki/include/Tiki/net/net.h
===================================================================
--- tiki/include/Tiki/net/net.h 2007-08-21 04:08:54 UTC (rev 475)
+++ tiki/include/Tiki/net/net.h 2007-08-21 04:24:11 UTC (rev 476)
@@ -23,6 +23,9 @@
#endif // __TIKI_NET_H
+#include <Tiki/net/address.h>
#include <Tiki/net/buffer.h>
-#include <Tiki/net/address.h>
+#include <Tiki/net/socket.h>
#include <Tiki/net/tcpsocket.h>
+#include <Tiki/net/tcpserversocket.h>
+#include <Tiki/net/udpsocket.h>
Modified: tiki/src/net/address.cpp
===================================================================
--- tiki/src/net/address.cpp 2007-08-21 04:08:54 UTC (rev 475)
+++ tiki/src/net/address.cpp 2007-08-21 04:24:11 UTC (rev 476)
@@ -8,8 +8,7 @@
#include "pch.h"
#include "Tiki/tiki.h"
-#include "Tiki/platnet.h"
-#include "Tiki/net/address.h"
+#include "Tiki/net.h"
#include <sstream>
Modified: tiki/src/net/socket.cpp
===================================================================
--- tiki/src/net/socket.cpp 2007-08-21 04:08:54 UTC (rev 475)
+++ tiki/src/net/socket.cpp 2007-08-21 04:24:11 UTC (rev 476)
@@ -8,8 +8,7 @@
#include "pch.h"
#include "Tiki/tiki.h"
-#include "Tiki/platnet.h"
-#include "Tiki/net/socket.h"
+#include "Tiki/net.h"
namespace Tiki {
Modified: tiki/src/net/tcpserversocket.cpp
===================================================================
--- tiki/src/net/tcpserversocket.cpp 2007-08-21 04:08:54 UTC (rev 475)
+++ tiki/src/net/tcpserversocket.cpp 2007-08-21 04:24:11 UTC (rev 476)
@@ -8,8 +8,7 @@
#include "pch.h"
#include "Tiki/tiki.h"
-#include "Tiki/platnet.h"
-#include "Tiki/net/tcpserversocket.h"
+#include "Tiki/net.h"
namespace Tiki {
Modified: tiki/src/net/tcpsocket.cpp
===================================================================
--- tiki/src/net/tcpsocket.cpp 2007-08-21 04:08:54 UTC (rev 475)
+++ tiki/src/net/tcpsocket.cpp 2007-08-21 04:24:11 UTC (rev 476)
@@ -8,7 +8,7 @@
#include "pch.h"
#include "Tiki/tiki.h"
-#include "Tiki/platnet.h"
+#include "Tiki/net.h"
#include <errno.h>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|