# HG changeset patch # User zzzzrrr # Date 1238431289 14400 # Node ID d63faa81a5e4bc5dc7f19e3df6a3e23a9e1c0e0e # Parent 88cca12cc8b9a945bad80a6d2e567de36a1feba2 removed Dog, added derelict and glfw diff -r 88cca12cc8b9 -r d63faa81a5e4 ai/human.d --- a/ai/human.d Fri Mar 27 19:26:01 2009 -0400 +++ b/ai/human.d Mon Mar 30 12:41:29 2009 -0400 @@ -30,11 +30,9 @@ */ module openmelee.ai.human; -import xf.hybrid.Event; -import xf.input.KeySym; - -import openmelee.ships.ship; +import openmelee.ships.ship : Ship; import openmelee.melee.melee : Melee; +import openmelee.glfw.glfw; class Human { @@ -46,67 +44,45 @@ this.ship = ship; } - EventHandling onClick(MouseButtonEvent e) { - return EventHandling.Stop; - } - - EventHandling onKey(KeyboardEvent e) { + void onKey(int key, int state) { // Key pressed - if (e.down) { - switch (e.keySym) { - case KeySym.space: + if (state == 257 || state == 1) { + switch (key) { + case GLFW_KEY_SPACE: drawAABBs = !drawAABBs; break; - case KeySym.Escape: + case GLFW_KEY_ESC: quit = true; break; - case KeySym.Up: + case GLFW_KEY_UP: thrust = true; break; - case KeySym.Left: + case GLFW_KEY_LEFT: ship.turnLeft(); break; - case KeySym.Right: + case GLFW_KEY_RIGHT: ship.turnRight(); break; - case KeySym.Down: + case GLFW_KEY_DOWN: break; - case KeySym.Delete: + case GLFW_KEY_DEL: melee.ship2.explode(); melee.objectList.remove(melee.ship2); melee.world.destroyBody(melee.ship2.rBody); melee.ship2 = null; - melee.draw.ship2 = null; + melee.render.ship2 = null; melee.ai.ship = null; default: break; } // Key released } else { - if(e.keySym == KeySym.Up) { + if(key == GLFW_KEY_UP) { thrust = false; - } else if (e.keySym == KeySym.Left || e.keySym == KeySym.Right) { + } else if (key == GLFW_KEY_LEFT || key == GLFW_KEY_RIGHT) { ship.rBody.angularVelocity = 0.0f; } } - return EventHandling.Stop; - } - - // Mouse move - EventHandling onMove(MouseMoveEvent e) { - return EventHandling.Stop; - } - - EventHandling onDT(TimeUpdateEvent e){ - return EventHandling.Continue; - } - - EventHandling onMouseEnter(MouseEnterEvent e) { - return EventHandling.Continue; - } - - EventHandling onMouseLeave(MouseLeaveEvent e) { - return EventHandling.Continue; } bool quit; diff -r 88cca12cc8b9 -r d63faa81a5e4 game.d --- a/game.d Fri Mar 27 19:26:01 2009 -0400 +++ b/game.d Mon Mar 30 12:41:29 2009 -0400 @@ -41,7 +41,7 @@ } void run() { - melee.init(); + melee.run(); } } diff -r 88cca12cc8b9 -r d63faa81a5e4 glfw.dll Binary file glfw.dll has changed diff -r 88cca12cc8b9 -r d63faa81a5e4 glfw/glfw.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/glfw/glfw.d Mon Mar 30 12:41:29 2009 -0400 @@ -0,0 +1,558 @@ +/* + * Copyright (c) 2004-2007 Derelict Developers + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the names 'Derelict', 'DerelictGLFW', nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +module openmelee.glfw.glfw; + +private +{ + import derelict.util.loader; +} + +private void load(SharedLib lib) +{ + bindFunc(glfwInit)("glfwInit", lib); + bindFunc(glfwTerminate)("glfwTerminate", lib); + bindFunc(glfwGetVersion)("glfwGetVersion", lib); + bindFunc(glfwOpenWindow)("glfwOpenWindow", lib); + bindFunc(glfwOpenWindowHint)("glfwOpenWindowHint", lib); + bindFunc(glfwCloseWindow)("glfwCloseWindow", lib); + bindFunc(glfwSetWindowTitle)("glfwSetWindowTitle", lib); + bindFunc(glfwGetWindowSize)("glfwGetWindowSize", lib); + bindFunc(glfwSetWindowSize)("glfwSetWindowSize", lib); + bindFunc(glfwSetWindowPos)("glfwSetWindowPos", lib); + bindFunc(glfwIconifyWindow)("glfwIconifyWindow", lib); + bindFunc(glfwRestoreWindow)("glfwRestoreWindow", lib); + bindFunc(glfwSwapBuffers)("glfwSwapBuffers", lib); + bindFunc(glfwSwapInterval)("glfwSwapInterval", lib); + bindFunc(glfwGetWindowParam)("glfwGetWindowParam", lib); + bindFunc(glfwSetWindowSizeCallback)("glfwSetWindowSizeCallback", lib); + bindFunc(glfwSetWindowCloseCallback)("glfwSetWindowCloseCallback", lib); + bindFunc(glfwSetWindowRefreshCallback)("glfwSetWindowRefreshCallback", lib); + bindFunc(glfwGetVideoModes)("glfwGetVideoModes", lib); + bindFunc(glfwGetDesktopMode)("glfwGetDesktopMode", lib); + bindFunc(glfwPollEvents)("glfwPollEvents", lib); + bindFunc(glfwWaitEvents)("glfwWaitEvents", lib); + bindFunc(glfwGetKey)("glfwGetKey", lib); + bindFunc(glfwGetMouseButton)("glfwGetMouseButton", lib); + bindFunc(glfwGetMousePos)("glfwGetMousePos", lib); + bindFunc(glfwSetMousePos)("glfwSetMousePos", lib); + bindFunc(glfwGetMouseWheel)("glfwGetMouseWheel", lib); + bindFunc(glfwSetMouseWheel)("glfwSetMouseWheel", lib); + bindFunc(glfwSetKeyCallback)("glfwSetKeyCallback", lib); + bindFunc(glfwSetCharCallback)("glfwSetCharCallback", lib); + bindFunc(glfwSetMouseButtonCallback)("glfwSetMouseButtonCallback", lib); + bindFunc(glfwSetMousePosCallback)("glfwSetMousePosCallback", lib); + bindFunc(glfwSetMouseWheelCallback)("glfwSetMouseWheelCallback", lib); + bindFunc(glfwGetJoystickParam)("glfwGetJoystickParam", lib); + bindFunc(glfwGetJoystickPos)("glfwGetJoystickPos", lib); + bindFunc(glfwGetJoystickButtons)("glfwGetJoystickButtons", lib); + bindFunc(glfwGetTime)("glfwGetTime", lib); + bindFunc(glfwSetTime)("glfwSetTime", lib); + bindFunc(glfwSleep)("glfwSetTime", lib); + bindFunc(glfwExtensionSupported)("glfwExtensionSupported", lib); + bindFunc(glfwGetProcAddress)("glfwGetProcAddress", lib); + bindFunc(glfwGetGLVersion)("glfwGetGLVersion", lib); + bindFunc(glfwCreateThread)("glfwCreateThread", lib); + bindFunc(glfwDestroyThread)("glfwDestroyThread", lib); + bindFunc(glfwWaitThread)("glfwWaitThread", lib); + bindFunc(glfwGetThreadID)("glfwGetThreadID", lib); + bindFunc(glfwCreateMutex)("glfwCreateMutex", lib); + bindFunc(glfwDestroyMutex)("glfwDestroyMutex", lib); + bindFunc(glfwLockMutex)("glfwLockMutex", lib); + bindFunc(glfwUnlockMutex)("glfwUnlockMutex", lib); + bindFunc(glfwCreateCond)("glfwCreateCond", lib); + bindFunc(glfwDestroyCond)("glfwDestroyCond", lib); + bindFunc(glfwWaitCond)("glfwWaitCond", lib); + bindFunc(glfwSignalCond)("glfwSignalCond", lib); + bindFunc(glfwBroadcastCond)("glfwBroadcastCond", lib); + bindFunc(glfwGetNumberOfProcessors)("glfwGetNumberOfProcessors", lib); + bindFunc(glfwEnable)("glfwEnable", lib); + bindFunc(glfwDisable)("glfwDisable", lib); + bindFunc(glfwReadImage)("glfwReadImage", lib); + bindFunc(glfwReadMemoryImage)("glfwReadMemoryImage", lib); + bindFunc(glfwFreeImage)("glfwFreeImage", lib); + bindFunc(glfwLoadTexture2D)("glfwLoadTexture2D", lib); + bindFunc(glfwLoadMemoryTexture2D)("glfwLoadMemoryTexture2D", lib); + bindFunc(glfwLoadTextureImage2D)("glfwLoadTextureImage2D", lib); +} + +GenericLoader DerelictGLFW; +static this() { + DerelictGLFW.setup( + "glfw.dll", + "libglfw.so", + "", + &load + ); +} + +//============================================================================== +//DLL FUNCTIONS +//============================================================================== +private const char[] Funcs = +" +// GLFW initialization, termination and version querying + /*! @fn glfwInit + */ + typedef int function() pfglfwInit; + typedef void function() pfglfwTerminate; + typedef void function( int *major, int *minor, int *rev ) pfglfwGetVersion; + +// Window handling + typedef int function( int width, int height, int redbits, int greenbits, int bluebits, int alphabits, int depthbits, int stencilbits, int mode ) pfglfwOpenWindow; + typedef void function( int target, int hint ) pfglfwOpenWindowHint; + typedef void function() pfglfwCloseWindow; + typedef void function( char *title ) pfglfwSetWindowTitle; + typedef void function( int *width, int *height ) pfglfwGetWindowSize; + typedef void function( int width, int height ) pfglfwSetWindowSize; + typedef void function( int x, int y ) pfglfwSetWindowPos; + typedef void function() pfglfwIconifyWindow; + typedef void function() pfglfwRestoreWindow; + typedef void function() pfglfwSwapBuffers; + typedef void function( int interval ) pfglfwSwapInterval; + typedef int function( int param ) pfglfwGetWindowParam; + typedef void function( GLFWwindowsizefun cbfun ) pfglfwSetWindowSizeCallback; + typedef void function( GLFWwindowclosefun cbfun ) pfglfwSetWindowCloseCallback; + typedef void function( GLFWwindowrefreshfun cbfun ) pfglfwSetWindowRefreshCallback; + +// Video mode functions + typedef int function( GLFWvidmode *list, int maxcount ) pfglfwGetVideoModes; + typedef void function( GLFWvidmode *mode ) pfglfwGetDesktopMode; + +// Input handling + typedef void function() pfglfwPollEvents; + typedef void function( ) pfglfwWaitEvents; + typedef int function( int key ) pfglfwGetKey; + typedef int function( int button ) pfglfwGetMouseButton; + typedef void function( int *xpos, int *ypos ) pfglfwGetMousePos; + typedef void function( int xpos, int ypos ) pfglfwSetMousePos; + typedef int function() pfglfwGetMouseWheel; + typedef void function( int pos ) pfglfwSetMouseWheel; + typedef void function( GLFWkeyfun cbfun ) pfglfwSetKeyCallback; + typedef void function( GLFWcharfun cbfun ) pfglfwSetCharCallback; + typedef void function( GLFWmousebuttonfun cbfun ) pfglfwSetMouseButtonCallback; + typedef void function( GLFWmouseposfun cbfun ) pfglfwSetMousePosCallback; + typedef void function( GLFWmousewheelfun cbfun ) pfglfwSetMouseWheelCallback; + +// Joystick input + typedef int function( int joy, int param ) pfglfwGetJoystickParam; + typedef int function( int joy, float *pos, int numaxes ) pfglfwGetJoystickPos; + typedef int function( int joy, ubyte* buttons, int numbuttons ) pfglfwGetJoystickButtons; + +// Time + typedef double function() pfglfwGetTime; + typedef void function( double time ) pfglfwSetTime; + typedef void function( double time ) pfglfwSleep; + +// Extension support + typedef int function( char *extension ) pfglfwExtensionSupported; + typedef void* function( char *procname ) pfglfwGetProcAddress; + typedef void function( int *major, int *minor, int *rev ) pfglfwGetGLVersion; + +// Threading support + typedef GLFWthread function( GLFWthreadfun fun, void *arg ) pfglfwCreateThread; + typedef void function( GLFWthread ID ) pfglfwDestroyThread; + typedef int function( GLFWthread ID, int waitmode ) pfglfwWaitThread; + typedef GLFWthread function() pfglfwGetThreadID; + typedef GLFWmutex function() pfglfwCreateMutex; + typedef void function(GLFWmutex mutex ) pfglfwDestroyMutex; + typedef void function(GLFWmutex mutex ) pfglfwLockMutex; + typedef void function(GLFWmutex mutex ) pfglfwUnlockMutex; + typedef GLFWcond function() pfglfwCreateCond; + typedef void function(GLFWcond cond ) pfglfwDestroyCond; + typedef void function(GLFWcond cond, GLFWmutex mutex, double timeout ) pfglfwWaitCond; + typedef void function(GLFWcond cond ) pfglfwSignalCond; + typedef void function( GLFWcond cond ) pfglfwBroadcastCond; + typedef int function( ) pfglfwGetNumberOfProcessors; + +// Enable/disable functions + typedef void function(int token ) pfglfwEnable; + typedef void function(int token ) pfglfwDisable; + +// Image/texture I/O support + typedef int function(char *name, GLFWimage *img, int flags ) pfglfwReadImage; + typedef int function( void *data, long size, GLFWimage *img, int flags ) pfglfwReadMemoryImage; + typedef void function( GLFWimage *img ) pfglfwFreeImage; + typedef int function( char *name, int flags ) pfglfwLoadTexture2D; + typedef int function( void *data, long size, int flags ) pfglfwLoadMemoryTexture2D; + typedef int function(GLFWimage *img, int flags ) pfglfwLoadTextureImage2D; +"; + +version(Windows) +{ + extern(Windows): mixin(Funcs); +} +else +{ + extern(C): mixin(Funcs); +} + +pfglfwInit glfwInit; +pfglfwTerminate glfwTerminate; +pfglfwGetVersion glfwGetVersion; +pfglfwOpenWindow glfwOpenWindow; +pfglfwOpenWindowHint glfwOpenWindowHint; +pfglfwCloseWindow glfwCloseWindow; +pfglfwSetWindowTitle glfwSetWindowTitle; +pfglfwGetWindowSize glfwGetWindowSize; +pfglfwSetWindowSize glfwSetWindowSize; +pfglfwSetWindowPos glfwSetWindowPos; +pfglfwIconifyWindow glfwIconifyWindow; +pfglfwRestoreWindow glfwRestoreWindow; +pfglfwSwapBuffers glfwSwapBuffers; +pfglfwSwapInterval glfwSwapInterval; +pfglfwGetWindowParam glfwGetWindowParam; +pfglfwSetWindowSizeCallback glfwSetWindowSizeCallback; +pfglfwSetWindowCloseCallback glfwSetWindowCloseCallback; +pfglfwSetWindowRefreshCallback glfwSetWindowRefreshCallback; +pfglfwGetVideoModes glfwGetVideoModes; +pfglfwGetDesktopMode glfwGetDesktopMode; +pfglfwPollEvents glfwPollEvents; +pfglfwWaitEvents glfwWaitEvents; +pfglfwGetKey glfwGetKey; +pfglfwGetMouseButton glfwGetMouseButton; +pfglfwGetMousePos glfwGetMousePos; +pfglfwSetMousePos glfwSetMousePos; +pfglfwGetMouseWheel glfwGetMouseWheel; +pfglfwSetMouseWheel glfwSetMouseWheel; +pfglfwSetKeyCallback glfwSetKeyCallback; +pfglfwSetCharCallback glfwSetCharCallback; +pfglfwSetMouseButtonCallback glfwSetMouseButtonCallback; +pfglfwSetMousePosCallback glfwSetMousePosCallback; +pfglfwSetMouseWheelCallback glfwSetMouseWheelCallback; +pfglfwGetJoystickParam glfwGetJoystickParam; +pfglfwGetJoystickPos glfwGetJoystickPos; +pfglfwGetJoystickButtons glfwGetJoystickButtons; +pfglfwGetTime glfwGetTime; +pfglfwSetTime glfwSetTime; +pfglfwSleep glfwSleep; +pfglfwExtensionSupported glfwExtensionSupported; +pfglfwGetProcAddress glfwGetProcAddress; +pfglfwGetGLVersion glfwGetGLVersion; +pfglfwCreateThread glfwCreateThread; +pfglfwDestroyThread glfwDestroyThread; +pfglfwWaitThread glfwWaitThread; +pfglfwGetThreadID glfwGetThreadID; +pfglfwCreateMutex glfwCreateMutex; +pfglfwDestroyMutex glfwDestroyMutex; +pfglfwLockMutex glfwLockMutex;; +pfglfwUnlockMutex glfwUnlockMutex; +pfglfwCreateCond glfwCreateCond;; +pfglfwDestroyCond glfwDestroyCond; +pfglfwWaitCond glfwWaitCond;; +pfglfwSignalCond glfwSignalCond; +pfglfwBroadcastCond glfwBroadcastCond;; +pfglfwGetNumberOfProcessors glfwGetNumberOfProcessors;; +pfglfwEnable glfwEnable;; +pfglfwDisable glfwDisable; +pfglfwReadImage glfwReadImage; +pfglfwReadMemoryImage glfwReadMemoryImage; +pfglfwFreeImage glfwFreeImage; +pfglfwLoadTexture2D glfwLoadTexture2D; +pfglfwLoadMemoryTexture2D glfwLoadMemoryTexture2D; +pfglfwLoadTextureImage2D glfwLoadTextureImage2D; + +//======================================================================== +//GLFW version +//======================================================================== + +enum +{ + GLFW_VERSION_MAJOR = 2, + GLFW_VERSION_MINOR = 6, + GLFW_VERSION_REVISION = 0 +} + +//======================================================================== +//Input handling definitions +//======================================================================== + +//Key and button state/action definitions +enum +{ + GLFW_RELEASE = 0, + GLFW_PRESS = 1 +} + +//Keyboard key definitions: 8-bit ISO-8859-1 (Latin 1) encoding is used +//for printable keys (such as A-Z, 0-9 etc), and values above 256 +//represent special (non-printable) keys (e.g. F1, Page Up etc). +enum +{ +GLFW_KEY_UNKNOWN = -1, + GLFW_KEY_SPACE = 32, + GLFW_KEY_SPECIAL = 256, + GLFW_KEY_ESC = (GLFW_KEY_SPECIAL+1), + GLFW_KEY_F1 = (GLFW_KEY_SPECIAL+2), + GLFW_KEY_F2 = (GLFW_KEY_SPECIAL+3), + GLFW_KEY_F3 = (GLFW_KEY_SPECIAL+4), + GLFW_KEY_F4 = (GLFW_KEY_SPECIAL+5), + GLFW_KEY_F5 = (GLFW_KEY_SPECIAL+6), + GLFW_KEY_F6 = (GLFW_KEY_SPECIAL+7), + GLFW_KEY_F7 = (GLFW_KEY_SPECIAL+8), + GLFW_KEY_F8 = (GLFW_KEY_SPECIAL+9), + GLFW_KEY_F9 = (GLFW_KEY_SPECIAL+10), + GLFW_KEY_F10 = (GLFW_KEY_SPECIAL+11), + GLFW_KEY_F11 = (GLFW_KEY_SPECIAL+12), + GLFW_KEY_F12 = (GLFW_KEY_SPECIAL+13), + GLFW_KEY_F13 = (GLFW_KEY_SPECIAL+14), + GLFW_KEY_F14 = (GLFW_KEY_SPECIAL+15), + GLFW_KEY_F15 = (GLFW_KEY_SPECIAL+16), + GLFW_KEY_F16 = (GLFW_KEY_SPECIAL+17), + GLFW_KEY_F17 = (GLFW_KEY_SPECIAL+18), + GLFW_KEY_F18 = (GLFW_KEY_SPECIAL+19), + GLFW_KEY_F19 = (GLFW_KEY_SPECIAL+20), + GLFW_KEY_F20 = (GLFW_KEY_SPECIAL+21), + GLFW_KEY_F21 = (GLFW_KEY_SPECIAL+22), + GLFW_KEY_F22 = (GLFW_KEY_SPECIAL+23), + GLFW_KEY_F23 = (GLFW_KEY_SPECIAL+24), + GLFW_KEY_F24 = (GLFW_KEY_SPECIAL+25), + GLFW_KEY_F25 = (GLFW_KEY_SPECIAL+26), + GLFW_KEY_UP = (GLFW_KEY_SPECIAL+27), + GLFW_KEY_DOWN = (GLFW_KEY_SPECIAL+28), + GLFW_KEY_LEFT = (GLFW_KEY_SPECIAL+29), + GLFW_KEY_RIGHT = (GLFW_KEY_SPECIAL+30), + GLFW_KEY_LSHIFT = (GLFW_KEY_SPECIAL+31), + GLFW_KEY_RSHIFT = (GLFW_KEY_SPECIAL+32), + GLFW_KEY_LCTRL = (GLFW_KEY_SPECIAL+33), + GLFW_KEY_RCTRL = (GLFW_KEY_SPECIAL+34), + GLFW_KEY_LALT = (GLFW_KEY_SPECIAL+35), + GLFW_KEY_RALT = (GLFW_KEY_SPECIAL+36), + GLFW_KEY_TAB = (GLFW_KEY_SPECIAL+37), + GLFW_KEY_ENTER = (GLFW_KEY_SPECIAL+38), + GLFW_KEY_BACKSPACE = (GLFW_KEY_SPECIAL+39), + GLFW_KEY_INSERT = (GLFW_KEY_SPECIAL+40), + GLFW_KEY_DEL = (GLFW_KEY_SPECIAL+41), + GLFW_KEY_PAGEUP = (GLFW_KEY_SPECIAL+42), + GLFW_KEY_PAGEDOWN = (GLFW_KEY_SPECIAL+43), + GLFW_KEY_HOME = (GLFW_KEY_SPECIAL+44), + GLFW_KEY_END = (GLFW_KEY_SPECIAL+45), + GLFW_KEY_KP_0 = (GLFW_KEY_SPECIAL+46), + GLFW_KEY_KP_1 = (GLFW_KEY_SPECIAL+47), + GLFW_KEY_KP_2 = (GLFW_KEY_SPECIAL+48), + GLFW_KEY_KP_3 = (GLFW_KEY_SPECIAL+49), + GLFW_KEY_KP_4 = (GLFW_KEY_SPECIAL+50), + GLFW_KEY_KP_5 = (GLFW_KEY_SPECIAL+51), + GLFW_KEY_KP_6 = (GLFW_KEY_SPECIAL+52), + GLFW_KEY_KP_7 = (GLFW_KEY_SPECIAL+53), + GLFW_KEY_KP_8 = (GLFW_KEY_SPECIAL+54), + GLFW_KEY_KP_9 = (GLFW_KEY_SPECIAL+55), + GLFW_KEY_KP_DIVIDE = (GLFW_KEY_SPECIAL+56), + GLFW_KEY_KP_MULTIPLY = (GLFW_KEY_SPECIAL+57), + GLFW_KEY_KP_SUBTRACT = (GLFW_KEY_SPECIAL+58), + GLFW_KEY_KP_ADD = (GLFW_KEY_SPECIAL+59), + GLFW_KEY_KP_DECIMAL = (GLFW_KEY_SPECIAL+60), + GLFW_KEY_KP_EQUAL = (GLFW_KEY_SPECIAL+61), + GLFW_KEY_KP_ENTER = (GLFW_KEY_SPECIAL+62), + GLFW_KEY_LAST = GLFW_KEY_KP_ENTER +} + +//Mouse button definitions +enum +{ + GLFW_MOUSE_BUTTON_1 = 0, + GLFW_MOUSE_BUTTON_2 = 1, + GLFW_MOUSE_BUTTON_3 = 2, + GLFW_MOUSE_BUTTON_4 = 3, + GLFW_MOUSE_BUTTON_5 = 4, + GLFW_MOUSE_BUTTON_6 = 5, + GLFW_MOUSE_BUTTON_7 = 6, + GLFW_MOUSE_BUTTON_8 = 7, + GLFW_MOUSE_BUTTON_LAST = GLFW_MOUSE_BUTTON_8 +} + +//Mouse button aliases +enum +{ + GLFW_MOUSE_BUTTON_LEFT = GLFW_MOUSE_BUTTON_1, + GLFW_MOUSE_BUTTON_RIGHT = GLFW_MOUSE_BUTTON_2, + GLFW_MOUSE_BUTTON_MIDDLE = GLFW_MOUSE_BUTTON_3 +} + + +//Joystick identifiers +enum +{ + GLFW_JOYSTICK_1 = 0, + GLFW_JOYSTICK_2 = 1, + GLFW_JOYSTICK_3 = 2, + GLFW_JOYSTICK_4 = 3, + GLFW_JOYSTICK_5 = 4, + GLFW_JOYSTICK_6 = 5, + GLFW_JOYSTICK_7 = 6, + GLFW_JOYSTICK_8 = 7, + GLFW_JOYSTICK_9 = 8, + GLFW_JOYSTICK_10 = 9, + GLFW_JOYSTICK_11 = 10, + GLFW_JOYSTICK_12 = 11, + GLFW_JOYSTICK_13 = 12, + GLFW_JOYSTICK_14 = 13, + GLFW_JOYSTICK_15 = 14, + GLFW_JOYSTICK_16 = 15, + GLFW_JOYSTICK_LAST = GLFW_JOYSTICK_16 +} + +//======================================================================== +//Other definitions +//======================================================================== + +//glfwOpenWindow modes +enum +{ + GLFW_WINDOW = 0x00010001, + GLFW_FULLSCREEN = 0x00010002 +} + +//glfwGetWindowParam tokens +enum +{ + GLFW_OPENED = 0x00020001, + GLFW_ACTIVE = 0x00020002, + GLFW_ICONIFIED = 0x00020003, + GLFW_ACCELERATED = 0x00020004, + GLFW_RED_BITS = 0x00020005, + GLFW_GREEN_BITS = 0x00020006, + GLFW_BLUE_BITS = 0x00020007, + GLFW_ALPHA_BITS = 0x00020008, + GLFW_DEPTH_BITS = 0x00020009, + GLFW_STENCIL_BITS = 0x0002000A +} + +//The following constants are used for both glfwGetWindowParam +//and glfwOpenWindowHint +enum +{ + GLFW_REFRESH_RATE = 0x0002000B, + GLFW_ACCUM_RED_BITS = 0x0002000C, + GLFW_ACCUM_GREEN_BITS = 0x0002000D, + GLFW_ACCUM_BLUE_BITS = 0x0002000E, + GLFW_ACCUM_ALPHA_BITS = 0x0002000F, + GLFW_AUX_BUFFERS = 0x00020010, + GLFW_STEREO = 0x00020011, + GLFW_WINDOW_NO_RESIZE = 0x00020012, + GLFW_FSAA_SAMPLES = 0x00020013 +} + +//glfwEnable/glfwDisable tokens +enum +{ + GLFW_MOUSE_CURSOR = 0x00030001, + GLFW_STICKY_KEYS = 0x00030002, + GLFW_STICKY_MOUSE_BUTTONS = 0x00030003, + GLFW_SYSTEM_KEYS = 0x00030004, + GLFW_KEY_REPEAT = 0x00030005, + GLFW_AUTO_POLL_EVENTS = 0x00030006 +} + +//glfwWaitThread wait modes +enum +{ + GLFW_WAIT = 0x00040001, + GLFW_NOWAIT = 0x00040002 +} + +//glfwGetJoystickParam tokens +enum +{ + GLFW_PRESENT = 0x00050001, + GLFW_AXES = 0x00050002, + GLFW_BUTTONS = 0x00050003 +} + +//glfwReadImage/glfwLoadTexture2D flags +enum +{ + GLFW_NO_RESCALE_BIT = 0x00000001, // Only for glfwReadImage + GLFW_ORIGIN_UL_BIT = 0x00000002, + GLFW_BUILD_MIPMAPS_BIT = 0x00000004, // Only for glfwLoadTexture2D + GLFW_ALPHA_MAP_BIT = 0x00000008 +} + +//Time spans longer than this (seconds) are considered to be infinity +enum +{ + GLFW_INFINITY = 100000 +} + +//======================================================================== +// Structs +//======================================================================== + +//The video mode structure used by glfwGetVideoModes() +struct GLFWvidmode +{ + int Width, Height; + int RedBits, BlueBits, GreenBits; +} + +//Image/texture information +struct GLFWimage +{ + int Width, Height; + int Format; + int BytesPerPixel; + ubyte *Data; +} + +//Thread ID +alias int GLFWthread; + +//Mutex object +alias void* GLFWmutex; + +//Condition variable object +alias void* GLFWcond; + +//Function pointer types +typedef void function(int, int) GLFWwindowsizefun; +typedef int function() GLFWwindowclosefun; +typedef void function() GLFWwindowrefreshfun; +typedef void function(int, int) GLFWmousebuttonfun; +typedef void function(int, int) GLFWmouseposfun; +typedef void function(int) GLFWmousewheelfun; +typedef void function(int, int) GLFWkeyfun; +typedef void function(int, int) GLFWcharfun; +typedef void function(void*) GLFWthreadfun; + + + + + + + + + + + + + + + diff -r 88cca12cc8b9 -r d63faa81a5e4 gui.cfg --- a/gui.cfg Fri Mar 27 19:26:01 2009 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,12 +0,0 @@ -import "themes/default.cfg" - -new FramedTopLevelWindow main { - frame.text = "OpenMelee"; - showCursor = false; - size = 900 610; - [hexpand hfill vexpand vfill] new GLViewport glview; -} @overlay { - [hexpand vexpand hfill vfill] new Group .overlay { - layout = Ghost; - } -} diff -r 88cca12cc8b9 -r d63faa81a5e4 melee/melee.d --- a/melee/melee.d Fri Mar 27 19:26:01 2009 -0400 +++ b/melee/melee.d Mon Mar 30 12:41:29 2009 -0400 @@ -38,10 +38,6 @@ import fc = tango.text.convert.Float : toString; import tango.util.log.Trace; -import xf.core.JobHub; -import xf.hybrid.Hybrid; -import xf.hybrid.backend.GL; - import blaze.common.bzMath : bzVec2; import blaze.bzWorld : bzWorld; import blaze.collision.bzCollision : bzAABB; @@ -101,7 +97,7 @@ float timeStep; const bzVec2 gravity = bzVec2(0.0f, 0.0f); bool allowSleep; - Render draw; + Render render; AI ai; Human human; @@ -121,83 +117,52 @@ int pointCount; this() { - + timeStep = settings.hz > 0.0f ? 1.0f / settings.hz : 0.0f; objectList = new ObjectList; - } - - void init() { - - timeStep = settings.hz > 0.0f ? 1.0f / settings.hz : 0.0f; - version(distrib) gui.vfs.mount(new ZipFolder("./gui.zip")); - scope cfg = loadHybridConfig("./gui.cfg"); - scope renderer = new Renderer; - m_boundaryListener = new BoundaryListener(this); + + initWorld(); running = true; - draw = new Render(world, ship1, ship2, settings); human = new Human(ship1, this); + ai = new AI(ship2, objectList); + + render = new Render(world, ship1, ship2, human, settings); + render.keys(); objectList.add(planet); objectList.add(ship1); objectList.add(ship2); - - ai = new AI(ship2, objectList); - - gui.begin(cfg).retained; - gui.push(`main`); - GLViewport(`glview`).renderingHandler(&draw.draw) - .addHandler(&human.onClick) - .addHandler(&human.onMove) - .addHandler(&human.onKey) - .addHandler(&human.onDT) - .addHandler(&human.onMouseEnter) - .addHandler(&human.onMouseLeave) - .grabKeyboardFocus; - gui.pop(); - gui.immediate.end; + } - jobHub.addRepeatableJob( { - // Update physics - world.step(timeStep, settings.velocityIterations, settings.positionIterations); - }, ITERS_PER_SECOND); - - jobHub.addPreFrameJob( { + void run() { + // Main game loop + while (running && !human.quit) { + + float delta = timer.stop; + timer.start; + // Update AI ai.move(ship1); - }); - - jobHub.addPostFrameJob( { + // Update Physics + world.step(timeStep, settings.velocityIterations, settings.positionIterations); + // Update screen + render.update(); - // Limit velocity + // Limit velocities foreach(o; objectList) { o.limitVelocity(); o.updateState(); } - gui.begin(cfg); - gui.push(`main`); - if (gui().getProperty!(bool)("frame.closeClicked")) { - running = false; + // Apply thrust + if(human.thrust && ship1) { + ship1.thrust(); } - - if(human.thrust && ship1) { - ship1.thrust(); - } - - gui().setProperty!(bool)("showCursor", true); - gui.pop(); - gui.end; - gui.render(renderer); - - }); + } - while (running && !human.quit) { - float delta = timer.stop; - timer.start; - jobHub.update(delta); - } + delete render; } void initWorld() { diff -r 88cca12cc8b9 -r d63faa81a5e4 render/render.d --- a/render/render.d Fri Mar 27 19:26:01 2009 -0400 +++ b/render/render.d Mon Mar 30 12:41:29 2009 -0400 @@ -30,12 +30,7 @@ */ module openmelee.render.render; -import tango.math.Math : PI; - -import xf.dog.Dog; -import xf.omg.core.LinearAlgebra; -import xf.hybrid.Event; -import xf.hybrid.Font; +import tango.math.Math : PI, cos, sin; import blaze.bzWorld : bzWorld; import blaze.dynamics.bzBody : bzBody; @@ -51,6 +46,11 @@ import openmelee.ships.ship : Ship, State; import openmelee.melee.melee : Settings; +import openmelee.ai.human : Human; + +import derelict.opengl.gl; +import derelict.opengl.glu; +import openmelee.glfw.glfw; // Cursor scale factor const CURSORSIZE = 0.05f; @@ -65,6 +65,8 @@ const MIN_DIMENSION = 0.1; const MAX_CIRCLE_RES = 32; +Human human; + /// Color for drawing. Each value has the range [0,1]. struct Color { static Color opCall(float r, float g, float b) @@ -81,28 +83,69 @@ float b = 0; } +void key(int a, int b) { + human.onKey(a, b); +} + class Render { float zoom = 40; - vec2 viewCenter; + bzVec2 viewCenter; bzWorld world; - vec2i screenSize; + bzVec2 screenSize; bool scaling = false; bool full = false; Settings settings; Ship ship1, ship2; - this(bzWorld world, Ship s1, Ship s2, Settings settings) { + this(bzWorld world, Ship s1, Ship s2, Human h, Settings settings) { + + human = h; this.settings = settings; ship1 = s1; ship2 = s2; this.world = world; - viewCenter = vec2(10, 10); - screenSize = vec2i.zero; + viewCenter = bzVec2(10, 10); + screenSize = bzVec2(800, 600); + + DerelictGL.load(); + DerelictGLU.load(); + DerelictGLFW.load(); + glfwInit(); + + // Open window + int width = cast(int) screenSize.x; + int height = cast(int) screenSize.y; + int ok = glfwOpenWindow(width, height, 8, 8, 8, 8, 8, 0, GLFW_WINDOW); + + if(!ok) { + assert(0, "error loading window"); + } + + glfwSetWindowTitle("OpenMelee"); + glfwEnable(GLFW_STICKY_KEYS); + + } + + ~this() { + glfwTerminate(); + } + + void update() { + // Limit the fps + glfwSwapInterval(1); + draw(); + glfwSwapBuffers(); + } + + void keys() { + GLFWkeyfun cbfun; + cbfun = &key; + glfwSetKeyCallback(cbfun); } - void drawCircle(GL gl, vec2 center, float radius, bool water = false, float theta = float.nan) + void drawCircle(bzVec2 center, float radius, bool water = false, float theta = float.nan) { int segs = cast(int)(radius) + 20; if (segs > MAX_CIRCLE_RES) segs = MAX_CIRCLE_RES; @@ -110,114 +153,123 @@ auto realTheta = (theta <>= 0 ? theta : 0); if (water) { - gl.immediate(GL_TRIANGLE_FAN, + glBegin(GL_TRIANGLE_FAN); { - gl.Vertex2fv(center.ptr); + glVertex2f(center.x, center.y); for (int n = 0; n <= segs; n++) { double rads = n * coef; - gl.Vertex2f(radius * cos(rads + realTheta) + center.x, radius * sin(rads + realTheta) + center.y); + glVertex2f(radius * cos(rads + realTheta) + center.x, radius * sin(rads + realTheta) + center.y); } - }); + } + glEnd(); } - gl.immediate(GL_LINE_STRIP, + glBegin(GL_LINE_STRIP); { for (int n = 0; n <= segs; n++) { double rads = n * coef; - gl.Vertex2f(radius * cos(rads + realTheta) + center.x, radius * sin(rads + realTheta) + center.y); + glVertex2f(radius * cos(rads + realTheta) + center.x, radius * sin(rads + realTheta) + center.y); } if (theta <>= 0) - gl.Vertex2fv(center.ptr); - }); + glVertex2f(center.x, center.y); + } + glEnd(); } - void drawSolidCircle(GL gl, vec2 center, float radius, vec2 axis, Color color) + void drawSolidCircle(bzVec2 center, float radius, bzVec2 axis, Color color) { const k_segments = 25.0f; const k_increment = 2.0f * PI / k_segments; float theta = 0.0f; - gl.Enable(GL_BLEND); - gl.BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - gl.Color4f(0.5f * color.r, 0.5f * color.g, 0.5f * color.b, 0.5f); - gl.Begin(GL_TRIANGLE_FAN); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glColor4f(0.5f * color.r, 0.5f * color.g, 0.5f * color.b, 0.5f); + glBegin(GL_TRIANGLE_FAN); for (int i = 0; i < k_segments; ++i) { - vec2 v = center + radius * vec2(cos(theta), sin(theta)); - gl.Vertex2f(v.x, v.y); + bzVec2 v = center + radius * bzVec2(cos(theta), sin(theta)); + glVertex2f(v.x, v.y); theta += k_increment; } - gl.End(); - gl.Disable(GL_BLEND); + glEnd(); + glDisable(GL_BLEND); theta = 0.0f; - gl.Color4f(color.r, color.g, color.b, 1.0f); - gl.Begin(GL_LINE_LOOP); + glColor4f(color.r, color.g, color.b, 1.0f); + glBegin(GL_LINE_LOOP); for (int i = 0; i < k_segments; ++i) { - vec2 v = center + radius * vec2(cos(theta), sin(theta)); - gl.Vertex2f(v.x, v.y); + bzVec2 v = center + radius * bzVec2(cos(theta), sin(theta)); + glVertex2f(v.x, v.y); theta += k_increment; } - gl.End(); + glEnd(); - vec2 p = center + radius * axis; - gl.Begin(GL_LINES); - gl.Vertex2f(center.x, center.y); - gl.Vertex2f(p.x, p.y); - gl.End(); + bzVec2 p = center + radius * axis; + glBegin(GL_LINES); + glVertex2f(center.x, center.y); + glVertex2f(p.x, p.y); + glEnd(); } - void drawPolygon(GL gl, vec2[] glVerts, Color color) + void drawPolygon(bzVec2[] glVerts, Color color) { - gl.Color3f(color.r, color.g, color.b); - gl.immediate(GL_LINE_LOOP, + glColor3f(color.r, color.g, color.b); + glBegin(GL_LINE_LOOP); { - foreach (v; glVerts) - gl.Vertex2fv(v.ptr); - }); + foreach (v; glVerts) { + glVertex2f(v.x, v.y); + } + } + glEnd(); } - void drawSolidPolygon(GL gl, vec2[] vertices, Color color) + void drawSolidPolygon(bzVec2[] vertices, Color color) { - gl.Enable(GL_BLEND); - gl.BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - gl.Color4f(0.5f * color.r, 0.5f * color.g, 0.5f * color.b, 0.5f); - gl.Begin(GL_TRIANGLE_FAN); - for (int i = 0; i < vertices.length; ++i) { - gl.Vertex2f(vertices[i].x, vertices[i].y); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glColor4f(0.5f * color.r, 0.5f * color.g, 0.5f * color.b, 0.5f); + glBegin(GL_TRIANGLE_FAN); + { + for (int i = 0; i < vertices.length; ++i) { + glVertex2f(vertices[i].x, vertices[i].y); + } } - gl.End(); - gl.Disable(GL_BLEND); + glEnd(); + glDisable(GL_BLEND); - gl.Color4f(color.r, color.g, color.b, 1.0f); - gl.Begin(GL_LINE_LOOP); - for (int i = 0; i < vertices.length; ++i) { - gl.Vertex2f(vertices[i].x, vertices[i].y); + glColor4f(color.r, color.g, color.b, 1.0f); + glBegin(GL_LINE_LOOP); + { + for (int i = 0; i < vertices.length; ++i) { + glVertex2f(vertices[i].x, vertices[i].y); + } } - gl.End(); + glEnd(); } - void drawPoint(GL gl, vec2 p, float size, Color color) + void drawPoint(bzVec2 p, float size, Color color) { - gl.Color3f(color.r, color.g, color.b); - gl.PointSize(size); - gl.Begin(GL_POINTS); - gl.Vertex2f(p.x, p.y); - gl.End(); - gl.PointSize(1.0f); + glColor3f(color.r, color.g, color.b); + glPointSize(size); + glBegin(GL_POINTS); + glVertex2f(p.x, p.y); + glEnd(); + glPointSize(1.0f); } - void drawSegment(GL gl, vec2 begin, vec2 end, Color color) + void drawSegment(bzVec2 begin, bzVec2 end, Color color) { - gl.Color3f(color.r, color.g, color.b); - gl.immediate(GL_LINES, + glColor3f(color.r, color.g, color.b); + glBegin(GL_LINES); { - gl.Vertex2fv(begin.ptr); - gl.Vertex2fv(end.ptr); - }); + glVertex2f(begin.x, begin.y); + glVertex2f(end.x, end.y); + } + glEnd(); } // TODO: handle inequal radii correctly - void connectCircles(GL gl, vec2 center1, float radius1, vec2 center2, float radius2) + void connectCircles(bzVec2 center1, float radius1, bzVec2 center2, float radius2) { auto d = center2 - center1; if (!d.length) @@ -225,58 +277,60 @@ d *= (d.length - radius1) / d.length; center1 += d; center2 -= d; - gl.immediate(GL_LINES, + glBegin(GL_LINES); { - gl.Vertex2fv(center1.ptr); - gl.Vertex2fv(center2.ptr); - }); + glVertex2f(center1.x, center1.y); + glVertex2f(center2.x, center2.y); + } + glEnd(); } - void drawXForm(GL gl, bzXForm xf) + void drawXForm(bzXForm xf) { bzVec2 p1 = xf.position, p2; const k_axisScale = 0.4f; - gl.Begin(GL_LINES); + glBegin(GL_LINES); { - gl.Color3f(1.0f, 0.0f, 0.0f); - gl.Vertex2f(p1.x, p1.y); + glColor3f(1.0f, 0.0f, 0.0f); + glVertex2f(p1.x, p1.y); p2 = p1 + k_axisScale * xf.R.col1; - gl.Vertex2f(p2.x, p2.y); + glVertex2f(p2.x, p2.y); - gl.Color3f(0.0f, 1.0f, 0.0f); - gl.Vertex2f(p1.x, p1.y); + glColor3f(0.0f, 1.0f, 0.0f); + glVertex2f(p1.x, p1.y); p2 = p1 + k_axisScale * xf.R.col2; - gl.Vertex2f(p2.x, p2.y); + glVertex2f(p2.x, p2.y); } - gl.End(); + glEnd(); } - void drawSpring(GL gl, vec2 a, vec2 b, uint zigs) + void drawSpring(bzVec2 a, bzVec2 b, uint zigs) { zigs++; // Portion of length dedicated to connectors const float connPart = 0.2; - vec2 inc = (b - a) / (zigs); + bzVec2 inc = (b - a) / (zigs); // One step from a to b - vec2 zigLen = inc * (1 - connPart); + bzVec2 zigLen = inc * (1 - connPart); // Length of a connector - vec2 connLen = inc * (connPart / 2) * zigs; + bzVec2 connLen = inc * (connPart / 2) * zigs; // Width of a zig - vec2 zigWidth = (b - a).rotatedHalfPi.normalized; - gl.immediate(GL_LINE_STRIP, + bzVec2 zigWidth = (b - a).rotate(PI/2); + zigWidth.normalize; + glBegin(GL_LINE_STRIP); { - gl.Vertex2fv(a.ptr); + glVertex2f(a.x, a.y); a += connLen; - gl.Vertex2fv(a.ptr); + glVertex2f(a.x, a.y); bool dir = true; a += zigWidth / 2 + zigLen / 2; for (int i = 0; i < zigs; i++) { - gl.Vertex2fv(a.ptr); + glVertex2f(a.x, a.y); a += zigLen; if (dir) { a -= zigWidth; @@ -286,12 +340,13 @@ dir = !dir; } - gl.Vertex2fv((b - connLen).ptr); - gl.Vertex2fv(b.ptr); - }); + glVertex2f((b - connLen).x, (b - connLen).y); + glVertex2f(b.x, b.y); + } + glEnd(); } - void drawShape(GL gl, bzShape shape, bzXForm xf, Color color, bool core) + void drawShape(bzShape shape, bzXForm xf, Color color, bool core) { Color coreColor = Color(0.9f, 0.6f, 0.6f); @@ -299,36 +354,30 @@ case bzShapeType.CIRCLE: auto circle = cast(bzCircle)shape; - vec2 center = vec2.from(bzMul(xf, circle.localPosition)); + bzVec2 center = bzMul(xf, circle.localPosition); float radius = circle.radius; - vec2 axis = vec2.from(xf.R.col1); + bzVec2 axis = xf.R.col1; - gl.drawSolidCircle(center, radius, axis, color); + drawSolidCircle(center, radius, axis, color); if (core) { - gl.Color3f(coreColor.r, coreColor.g, coreColor.b); - gl.drawCircle(center, radius - k_toiSlop); + glColor3f(coreColor.r, coreColor.g, coreColor.b); + drawCircle(center, radius - k_toiSlop); } break; case bzShapeType.POLYGON: { bzPolygon poly = cast(bzPolygon)shape; bzVec2[] vertices = poly.worldVertices; - vec2[] verts; - verts.length = vertices.length; - foreach (int i, v; vertices) { - verts[i] = vec2.from(v); - } - - gl.drawSolidPolygon(verts, color); + drawSolidPolygon(vertices, color); if (core) { bzVec2[] localCoreVertices = poly.coreVertices; - verts.length = localCoreVertices.length; + vertices.length = localCoreVertices.length; for (int i = 0; i < localCoreVertices.length; ++i) { - verts[i] = vec2.from(bzMul(xf, localCoreVertices[i])); + vertices[i] = bzMul(xf, localCoreVertices[i]); } - gl.drawPolygon(verts, coreColor); + drawPolygon(vertices, coreColor); } } break; @@ -337,50 +386,48 @@ { bzEdge edge = cast(bzEdge)shape; - vec2 p1 = vec2.from(bzMul(xf, edge.vertex1)); - vec2 p2 = vec2.from(bzMul(xf, edge.vertex2)); - gl.drawSegment(p1, p2, color); + bzVec2 p1 = bzMul(xf, edge.vertex1); + bzVec2 p2 = bzMul(xf, edge.vertex2); + drawSegment(p1, p2, color); if (core) { - p1 = vec2.from(bzMul(xf, edge.coreVertex1)); - p2 = vec2.from(bzMul(xf, edge.coreVertex2)); - gl.drawSegment(p1, p2, coreColor); + p1 = bzMul(xf, edge.coreVertex1); + p2 = bzMul(xf, edge.coreVertex2); + drawSegment(p1, p2, coreColor); } } break; } } - void draw(vec2i screenSize, GL gl) - { + void draw() { + if(ship2) { - vec2 point1 = vec2.from(ship1.rBody.position); - vec2 point2 = vec2.from(ship2.rBody.position); - vec2 range = point1 - point2; + bzVec2 point1 = ship1.rBody.position; + bzVec2 point2 = ship2.rBody.position; + bzVec2 range = point1 - point2; zoom = bzClamp(1000/range.length, 2, 60); viewCenter = point1 - (range * 0.5f); } else { - viewCenter = vec2.from(ship1.rBody.position); + viewCenter = ship1.rBody.position; zoom = 10; } - - this.screenSize = screenSize; - - gl.LoadIdentity(); - gl.MatrixMode(GL_PROJECTION); - gl.LoadIdentity(); + + glLoadIdentity(); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); float left = -screenSize.x / zoom; float right = screenSize.x / zoom; float bottom = -screenSize.y / zoom; float top = screenSize.y / zoom; - gl.gluOrtho2D(left, right, bottom, top); - gl.Translatef(-viewCenter.x, -viewCenter.y, 0); - gl.MatrixMode(GL_MODELVIEW); - gl.Disable(GL_DEPTH_TEST); - gl.LoadIdentity(); - gl.Clear(GL_COLOR_BUFFER_BIT); + gluOrtho2D(left, right, bottom, top); + glTranslatef(-viewCenter.x, -viewCenter.y, 0); + glMatrixMode(GL_MODELVIEW); + glDisable(GL_DEPTH_TEST); + glLoadIdentity(); + glClear(GL_COLOR_BUFFER_BIT); // Draw dynamic bodies if (settings.drawShapes) { @@ -389,15 +436,15 @@ bzShape s = shape; bzXForm xf = b.xf; if (b.isStatic) { - gl.drawShape(s, xf, Color(0.5f, 0.9f, 0.5f), settings.drawCoreShapes); + drawShape(s, xf, Color(0.5f, 0.9f, 0.5f), settings.drawCoreShapes); }else if (b.isSleeping) { - gl.drawShape(s, xf, Color(0.5f, 0.5f, 0.9f), settings.drawCoreShapes); + drawShape(s, xf, Color(0.5f, 0.5f, 0.9f), settings.drawCoreShapes); }else { - gl.drawShape(s, xf, Color(0.9f, 0.9f, 0.9f), settings.drawCoreShapes); + drawShape(s, xf, Color(0.9f, 0.9f, 0.9f), settings.drawCoreShapes); } - gl.LoadIdentity(); - gl.Flush(); + glLoadIdentity(); + glFlush(); } } } @@ -418,18 +465,18 @@ if (distance) { color = Color(.5, .5, 0); // Endpoints - vec2 a = vec2.from(distance.anchor1); - vec2 b = vec2.from(distance.anchor2); + bzVec2 a = bzVec2.from(distance.anchor1); + bzVec2 b = bzVec2.from(distance.anchor2); // Circles gl.drawCircle(a, HINGE_RADIUS); gl.drawCircle(b, HINGE_RADIUS); // Connecting line gl.connectCircles(a, HINGE_RADIUS, b, HINGE_RADIUS); }else if (pulley) { - auto a = vec2.from(pulley.anchor1); - auto b = vec2.from(pulley.groundAnchor1); - auto c = vec2.from(pulley.groundAnchor2); - auto d = vec2.from(pulley.anchor2); + auto a = bzVec2.from(pulley.anchor1); + auto b = bzVec2.from(pulley.groundAnchor1); + auto c = bzVec2.from(pulley.groundAnchor2); + auto d = bzVec2.from(pulley.anchor2); gl.drawCircle(a, HINGE_RADIUS); gl.drawCircle(b, HINGE_RADIUS); gl.connectCircles(a, HINGE_RADIUS, b, HINGE_RADIUS); @@ -438,27 +485,27 @@ gl.drawCircle(d, HINGE_RADIUS); gl.connectCircles(c, HINGE_RADIUS, d, HINGE_RADIUS); }else if (revolute) { - auto a = vec2.from(revolute.rBody1.position); - auto b = vec2.from(revolute.anchor1); - auto c = vec2.from(revolute.rBody2.position); + auto a = bzVec2.from(revolute.rBody1.position); + auto b = bzVec2.from(revolute.anchor1); + auto c = bzVec2.from(revolute.rBody2.position); gl.drawCircle(a, HINGE_RADIUS); gl.drawCircle(b, HINGE_RADIUS); gl.connectCircles(a, HINGE_RADIUS, b, HINGE_RADIUS); gl.drawCircle(c, HINGE_RADIUS); gl.connectCircles(b, HINGE_RADIUS, c, HINGE_RADIUS); }else if (prismatic) { - auto a = vec2.from(prismatic.rBody1.position); - auto b = vec2.from(prismatic.anchor1); - auto c = vec2.from(prismatic.rBody2.position); + auto a = bzVec2.from(prismatic.rBody1.position); + auto b = bzVec2.from(prismatic.anchor1); + auto c = bzVec2.from(prismatic.rBody2.position); gl.drawCircle(a, HINGE_RADIUS); gl.drawCircle(b, HINGE_RADIUS); gl.connectCircles(a, HINGE_RADIUS, b, HINGE_RADIUS); gl.drawCircle(c, HINGE_RADIUS); gl.connectCircles(b, HINGE_RADIUS, c, HINGE_RADIUS); }else if (line) { - auto a = vec2.from(line.rBody1.position); - auto b = vec2.from(line.anchor1); - auto c = vec2.from(line.rBody2.position); + auto a = bzVec2.from(line.rBody1.position); + auto b = bzVec2.from(line.anchor1); + auto c = bzVec2.from(line.rBody2.position); gl.drawCircle(a, HINGE_RADIUS); gl.drawCircle(b, HINGE_RADIUS); gl.connectCircles(a, HINGE_RADIUS, b, HINGE_RADIUS); @@ -480,8 +527,8 @@ if (bungee1) { gl.Color3f(.5, .5, 0); // Endpoints - vec2 a = vec2.from(bungee1.rBody.position); - vec2 b = vec2.from(bungee1.anchor); + bzVec2 a = bzVec2.from(bungee1.rBody.position); + bzVec2 b = bzVec2.from(bungee1.anchor); // Circles gl.drawCircle(a, HINGE_RADIUS); gl.drawCircle(b, HINGE_RADIUS); @@ -489,8 +536,8 @@ gl.connectCircles(a, HINGE_RADIUS, b, HINGE_RADIUS); }else { uint zigs = 10; - auto anchor1 = vec2.from(spring1.anchor); - auto anchor2 = vec2.from(spring1.rBody.position); + auto anchor1 = bzVec2.from(spring1.anchor); + auto anchor2 = bzVec2.from(spring1.rBody.position); gl.drawSpring(anchor1, anchor2, zigs); } } @@ -500,8 +547,8 @@ if (bungee2) { gl.Color3f(.5, .5, 0); // Endpoints - vec2 a = vec2.from(bungee2.rBody.position); - vec2 b = vec2.from(bungee2.otherBody.position); + bzVec2 a = bzVec2.from(bungee2.rBody.position); + bzVec2 b = bzVec2.from(bungee2.otherBody.position); // Circles gl.drawCircle(a, HINGE_RADIUS); gl.drawCircle(b, HINGE_RADIUS); @@ -509,16 +556,16 @@ gl.connectCircles(a, HINGE_RADIUS, b, HINGE_RADIUS); }else { uint zigs = 10; - auto anchor1 = vec2.from(spring2.otherBody.position); - auto anchor2 = vec2.from(spring2.rBody.position); + auto anchor1 = bzVec2.from(spring2.otherBody.position); + auto anchor2 = bzVec2.from(spring2.rBody.position); gl.drawSpring(anchor1, anchor2, zigs); } } if(buoyancy) { float plane = buoyancy.planeOffset; - vec2 p1 = vec2(-50, plane); - vec2 p2 = vec2(50, plane); + bzVec2 p1 = bzVec2(-50, plane); + bzVec2 p2 = bzVec2(50, plane); gl.drawSegment(p1, p2, color); } } @@ -531,12 +578,12 @@ bzVec2 worldLower = bp.m_worldAABB.lowerBound; bzVec2 worldUpper = bp.m_worldAABB.upperBound; Color color = Color(0.3f, 0.9f, 0.9f); - vec2 vs[4]; - vs[0] = vec2(worldLower.x, worldLower.y); - vs[1] = vec2(worldUpper.x, worldLower.y); - vs[2] = vec2(worldUpper.x, worldUpper.y); - vs[3] = vec2(worldLower.x, worldUpper.y); - drawPolygon(gl, vs, color); + bzVec2 vs[4]; + vs[0] = bzVec2(worldLower.x, worldLower.y); + vs[1] = bzVec2(worldUpper.x, worldLower.y); + vs[2] = bzVec2(worldUpper.x, worldUpper.y); + vs[3] = bzVec2(worldLower.x, worldUpper.y); + drawPolygon(vs, color); // Draw axis aligned bounding boxes (bzAABB) if (settings.drawAABBs) { @@ -556,12 +603,12 @@ b.upperBound.x = worldLower.x + invQ.x * bp.m_bounds[0][p.upperBounds[0]].value; b.upperBound.y = worldLower.y + invQ.y * bp.m_bounds[1][p.upperBounds[1]].value; - vs[0] = vec2(b.lowerBound.x, b.lowerBound.y); - vs[1] = vec2(b.upperBound.x, b.lowerBound.y); - vs[2] = vec2(b.upperBound.x, b.upperBound.y); - vs[3] = vec2(b.lowerBound.x, b.upperBound.y); + vs[0] = bzVec2(b.lowerBound.x, b.lowerBound.y); + vs[1] = bzVec2(b.upperBound.x, b.lowerBound.y); + vs[2] = bzVec2(b.upperBound.x, b.upperBound.y); + vs[3] = bzVec2(b.lowerBound.x, b.upperBound.y); - drawPolygon(gl, vs, color); + drawPolygon(vs, color); } } } diff -r 88cca12cc8b9 -r d63faa81a5e4 themes/default.cfg --- a/themes/default.cfg Fri Mar 27 19:26:01 2009 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +0,0 @@ -import "themes/default/Button.cfg" -import "themes/default/Check.cfg" -import "themes/default/Combo.cfg" -import "themes/default/FramedTopLevelWindow.cfg" -import "themes/default/Input.cfg" -import "themes/default/Menu.cfg" -import "themes/default/Picker.cfg" -import "themes/default/Progressbar.cfg" -import "themes/default/Scrollbar.cfg" -import "themes/default/ScrollbarButton.cfg" -import "themes/default/ScrollView.cfg" -import "themes/default/TabButton.cfg" -import "themes/default/TabView.cfg" -import "themes/default/TextList.cfg" -import "themes/default/TickBox.cfg" -import "themes/default/WindowFrame.cfg" -import "themes/default/WindowFrameButton.cfg" -import "themes/default/XCheck.cfg" -import "themes/default/Slider.cfg" -import "themes/default/Spinner.cfg" -import "themes/default/Angle.cfg" \ No newline at end of file diff -r 88cca12cc8b9 -r d63faa81a5e4 themes/default/Angle.cfg --- a/themes/default/Angle.cfg Fri Mar 27 19:26:01 2009 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,13 +0,0 @@ -widget Angle { - layout = Layered; - size = 40 40; - shape = Rectangle; - - [hexpand hfill vexpand vfill] new GLViewport glView; - glView = sub(glView); - - radians = false; - filled = true; - angleWidth = 2; - limitWidth = 1; -} diff -r 88cca12cc8b9 -r d63faa81a5e4 themes/default/Button.cfg --- a/themes/default/Button.cfg Fri Mar 27 19:26:01 2009 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +0,0 @@ -// define what a Button really is... -widget Button { - layout = Layered; - size = 30 0; - - [hfill vfill] new Graphic body { - size = 0 23; - - style.normal = { - image = grid("themes/default/img/button.png", hline(2, 73), vline(2, 21)); - background = solid(white); - } - - style.active = { - image = grid("themes/default/img/button_active.png", hline(2, 73), vline(2, 21)); - } - } - - [hfill vfill] new Graphic bodyOver { - style.normal = { - background = solid(rgba(1, 1, 1, 0)); - } - - style.hover = { - background = solid(rgba(1, 1, 1, .07)); - deactivation = .3; - } - } - - [hfill vfill] new HBox { - layout = { - padding = 6 3; - spacing = 2; - } - - [hexpand vexpand] new HBox leftExtra; - [vexpand] new Label text { - style.normal = { - color = rgb(.8, .8, .8); - } - - text = "Button"; - fontSize = 11; - } - [hexpand vexpand] new HBox rightExtra; - } - - leftExtra = sub(leftExtra); - rightExtra = sub(rightExtra); - label = sub(text); - text = prop(text.text); -} diff -r 88cca12cc8b9 -r d63faa81a5e4 themes/default/Check.cfg --- a/themes/default/Check.cfg Fri Mar 27 19:26:01 2009 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,12 +0,0 @@ -widget Check { - layout = HBox; - layout = { - spacing = 5; - } - - [vexpand] new TickBox tick; - new Label label; - - text = prop(label.text); - checked = prop(tick.checked); -} diff -r 88cca12cc8b9 -r d63faa81a5e4 themes/default/Combo.cfg --- a/themes/default/Combo.cfg Fri Mar 27 19:26:01 2009 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ -widget Combo { - layout = VBox; - size = 100 0; - - [hexpand hfill] new HBox { - [hexpand hfill] new Input input { - size = 80 0; - } - - [vexpand vfill] new ScrollbarButton button { - arrowDir = 3; - } - } - - - new HBox popup { - [hexpand hfill vexpand vfill] new ScrollView { - children.useChildSize = 1; - - [hexpand hfill vexpand vfill] new VBox { - shape = Rectangle; - style.normal = { - background = solid(rgba(.1, .1, .1, .8)); - border = 1 rgba(.4, .4, .4, .7); - } - layout = { - padding = 1 1; - } - - [hexpand hfill vexpand vfill] new TextList textList; - } - } - } - - input = sub(input); - popup = sub(popup); - button = sub(button); - textList = sub(popup.textList); -} diff -r 88cca12cc8b9 -r d63faa81a5e4 themes/default/FramedTopLevelWindow.cfg --- a/themes/default/FramedTopLevelWindow.cfg Fri Mar 27 19:26:01 2009 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -widget FramedTopLevelWindow { - layout = Layered; - - [hfill vfill] new WindowFrame frame { - text = "Hybrid test app 1"; - - shape = Rectangle; - style.normal = { - background = solid(rgb(.22, .22, .22)); - } - - layout = Bin; - new Group clientArea { - shape = Rectangle; - style.normal = { - background = solid(rgb(.22, .22, .22)); - } - } - } - - [hfill vfill] new Group overlay { - } - - frame = sub(frame); - children = sub(frame.clientArea); - overlay = sub(overlay); -} diff -r 88cca12cc8b9 -r d63faa81a5e4 themes/default/Input.cfg --- a/themes/default/Input.cfg Fri Mar 27 19:26:01 2009 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -widget Input { - shape = Rectangle; - layout = Bin; - layout = { - padding = 3 3; - } - - style.normal = { - background = solid(rgba(.3, .3, .3, 1)); - border = 1 black; - } - - [hexpand vexpand hfill vfill] new InputArea area { - style.normal = { - textInput = { - caretColor = white; - } - } - } - - text = prop(area.text); - font = prop(area.font); - fontFace = prop(area.fontFace); - fontSize = prop(area.fontSize); - hasFocus = prop(area.hasFocus); - inputArea = sub(area); -} diff -r 88cca12cc8b9 -r d63faa81a5e4 themes/default/Menu.cfg --- a/themes/default/Menu.cfg Fri Mar 27 19:26:01 2009 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,96 +0,0 @@ -widget HMenu { - new HBox children { - layout = { - spacing = 8; - padding = 8 2; - } - } - - children = sub(children); -} - - -widget HMenuItem { - [hexpand hfill] new Group { - shape = Rectangle; - style.active = { - background = solid(rgba(1, 1, 1, .1)); - border = 1 black; - } - layout = { - padding = 2 2; - } - - new Label label { - fontSize = 11; - style.normal = { - color = rgb(.8, .8, .8); - } - } - } - - label = sub(label); - text = prop(label.text); - - childDir = 3; -} - - -widget VMenu { - [hexpand hfill vexpand vfill] new Graphic { - renderOversize = 8 8; - renderOffset = 2 2; - style.normal = { - background = solid(rgba(0, 0, 0, .5)); - image = grid("themes/default/img/menuShadow.png", hline(14, 66), vline(14, 66)); - } - - [hexpand hfill vexpand vfill] new Group { - size = 80 0; - shape = Rectangle; - style.normal = { - background = solid(rgb(.18, .18, .18)); - border = 1 rgb(.25, .25, .25); - } - layout = { - padding = 4 3; - } - - [hfill hexpand] new VBox children { - layout = { - spacing = 2; - padding = 2 2; - attribs = "hexpand hfill"; - } - } - } - } - - children = sub(children); -} - - -widget VMenuItem { - [hexpand hfill] new Group { - shape = Rectangle; - style.active = { - background = solid(rgba(1, 1, 1, .05)); - border = 1 black; - } - layout = { - padding = 2 2; - } - - new Label label { - fontSize = 11; - style.normal = { - color = rgb(.8, .8, .8); - } - } - } - - label = sub(label); - text = prop(label.text); - - childDir = 0; -} diff -r 88cca12cc8b9 -r d63faa81a5e4 themes/default/Picker.cfg --- a/themes/default/Picker.cfg Fri Mar 27 19:26:01 2009 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,22 +0,0 @@ -widget Picker { - layout = Layered; - - [hfill vfill] new Group { - layout = Free; - new Group background { - } - } - - [hfill vfill] new VBox main { - } - - [hfill vfill] new Group { - layout = Free; - new Group foreground { - } - } - - children = sub(main); - background = sub(background); - foreground = sub(foreground); -} diff -r 88cca12cc8b9 -r d63faa81a5e4 themes/default/Progressbar.cfg --- a/themes/default/Progressbar.cfg Fri Mar 27 19:26:01 2009 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,18 +0,0 @@ -widget Progressbar { - layout = HBox; - layout = { - padding = 2 2; - } - shape = Rectangle; - style.normal = { - background = solid(white); - image = grid("themes/default/img/progress.png", hline(1, 20), vline(1, 11)); - } - - [hexpand hfill vexpand vfill] new HTiledImage img { - size = 0 13; - file = "themes/default/img/progress_box.png"; - } - - img = sub(img); -} \ No newline at end of file diff -r 88cca12cc8b9 -r d63faa81a5e4 themes/default/ScrollView.cfg --- a/themes/default/ScrollView.cfg Fri Mar 27 19:26:01 2009 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -widget ScrollView { - layout = HBox; - - //[hexpand vexpand hfill vfill] new HBox { - [hexpand vexpand hfill vfill] new VBox { - [hexpand vexpand hfill vfill] new ClipView clipView { - } - - [hexpand hfill] new HScrollbar hscroll; - } - - [vexpand vfill] new VBox { - [vexpand vfill] new VScrollbar vscroll; - - new Graphic corner { - size = 17 17; - } - } - //} - - hscroll = sub(hscroll); - vscroll = sub(vscroll); - clipView = sub(clipView); - corner = sub(corner); - - children = sub(clipView); -} diff -r 88cca12cc8b9 -r d63faa81a5e4 themes/default/Scrollbar.cfg --- a/themes/default/Scrollbar.cfg Fri Mar 27 19:26:01 2009 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,79 +0,0 @@ -widget HScrollbar { - [hexpand hfill] new HBox { - shape = Rectangle; - style.normal = { - background = solid(rgba(0.26, 0.26, 0.26, 1)); - } - - new ScrollbarButton button1 { - arrowDir = 2; - } - - [hexpand hfill] new HWidgetSlider slider { - new Graphic { - size = 17 17; - style.normal = { - image = grid("themes/default/img/scrollhandle.png", hline(3, 14), vline(3, 14)); - background = solid(white); - border = 1 rgba(.1, .1, .1, .8); - } - } - - handleSize = .2; - skip = false; - } - - new ScrollbarButton button2 { - arrowDir = 0; - } - } - - handleSize = prop(slider.handleSize); - position = prop(slider.position); - skipSize = prop(slider.skipSize); - - button1 = sub(button1); - button2 = sub(button2); - slider = sub(slider); -} - - - -widget VScrollbar { - [vexpand vfill] new VBox { - shape = Rectangle; - style.normal = { - background = solid(rgba(0.26, 0.26, 0.26, 1)); - } - - new ScrollbarButton button1 { - arrowDir = 1; - } - - [vexpand vfill] new VWidgetSlider slider { - new Graphic { - size = 17 17; - style.normal = { - image = grid("themes/default/img/scrollhandle.png", hline(3, 14), vline(3, 14)); - background = solid(white); - border = 1 rgba(.1, .1, .1, .8); - } - } - - handleSize = .2; - skip = false; - } - - new ScrollbarButton button2 { - arrowDir = 3; - } - } - - handleSize = prop(slider.handleSize); - position = prop(slider.position); - skipSize = prop(slider.skipSize); - - button1 = sub(button1); - button2 = sub(button2); - slider = sub(slider); -} diff -r 88cca12cc8b9 -r d63faa81a5e4 themes/default/ScrollbarButton.cfg --- a/themes/default/ScrollbarButton.cfg Fri Mar 27 19:26:01 2009 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +0,0 @@ -widget ScrollbarButton { - layout = Layered; - - [hfill vfill] new Graphic { - size = 17 17; - - style.normal = { - image = grid("themes/default/img/scrollbutton.png", hline(3, 14), vline(3, 14)); - background = solid(white); - } - - style.active = { - background = solid(rgba(1, 1, 1, 0)); - } - } - - [hfill vfill] new Graphic { - size = 17 17; - - style.normal = { - image = grid("themes/default/img/scrollbutton_active.png", hline(3, 14), vline(3, 14)); - background = solid(rgba(1, 1, 1, 0)); - } - - style.active = { - background = solid(white); - } - } - - new Icon icon { - addIcon = "themes/default/img/arrow0.png"; - addIcon = "themes/default/img/arrow1.png"; - addIcon = "themes/default/img/arrow2.png"; - addIcon = "themes/default/img/arrow3.png"; - } - - arrowDir = prop(icon.iconIndex); -} diff -r 88cca12cc8b9 -r d63faa81a5e4 themes/default/Slider.cfg --- a/themes/default/Slider.cfg Fri Mar 27 19:26:01 2009 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ -widget HSlider { - shape = Rectangle; - style.normal = { - border = 1 rgb(.118, .118, .118); - background = hgradient(rgb(0, 0, 0), rgb(.4, .4, .4)); - } - - [hexpand hfill] new HWidgetSlider wslider { - shape = Rectangle; - style.normal = { - } - - new Graphic { - size = 13 13; - style.normal = { - background = solid(white); - image = file("themes/default/img/hsliderarrow.png"); - } - } - } - - wslider = sub(wslider); -} - - - -widget VSlider { - shape = Rectangle; - style.normal = { - border = 1 rgb(.118, .118, .118); - background = vgradient(rgb(.4, .4, .4), rgb(0, 0, 0)); - } - - [vexpand vfill] new VWidgetSlider wslider { - shape = Rectangle; - style.normal = { - } - - new Graphic { - size = 13 13; - style.normal = { - background = solid(white); - image = file("themes/default/img/vsliderarrow.png"); - } - } - } - - wslider = sub(wslider); -} diff -r 88cca12cc8b9 -r d63faa81a5e4 themes/default/Spinner.cfg --- a/themes/default/Spinner.cfg Fri Mar 27 19:26:01 2009 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,80 +0,0 @@ -widget Spinner { - new VBox { - new SpinnerButton button2 { - icon.iconIndex = 0; - } - - new SpinnerButton button1 { - icon.iconIndex = 1; - } - } - - button1 = sub(button1); - button2 = sub(button2); -} - - -widget SpinnerButton { - layout = Layered; - - [hfill vfill] new Icon icon { - addIcon = "themes/default/img/spinner_up.png"; - addIcon = "themes/default/img/spinner_down.png"; - } - - [hfill vfill] new Graphic { - style.normal = { - background = solid(rgba(1, 1, 1, 0)); - } - style.hover = { - background = solid(rgba(1, 1, 1, .2)); - deactivation = .3; - } - style.active = { - background = solid(rgba(1, 1, 1, .4)); - } - } - - icon = sub(icon); -} - - -widget InputSpinner { - size = 60 0; - shape = Rectangle; - style.normal = { - border = 1 black; - background = solid(rgb(.2, .21, .24)); - } - layout = HBox; - layout = { - spacing = 2; - } - - [hexpand hfill vexpand hfill] new Group { - layout = { - padding = 2 2; - } - - [hexpand hfill vexpand] new InputArea input { - shape = Rectangle; - style.normal = { - background = solid(black); - textInput = { - caretColor = rgb(.6, .7, 1); - } - } - - fontSize = 11; - text = "0"; - } - } - new Spinner spinner; - - - spinner = sub(spinner); - input = sub(input); - value = prop(spinner.value); - - value = 0; -} diff -r 88cca12cc8b9 -r d63faa81a5e4 themes/default/TabButton.cfg --- a/themes/default/TabButton.cfg Fri Mar 27 19:26:01 2009 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -widget TabButton { - layout = HBox; - layout = { - spacing = -1; - } - size = 80 0; - - [vexpand vfill hexpand hfill] new Group { - layout = Layered; - - [hfill vfill] new Graphic { - size = 0 22; - style.normal = { - background = solid(white); - image = grid("themes/default/img/tbw.png", hline(1, 47), vline(3, 19)); - } - style.active = { - image = grid("themes/default/img/tbw_active.png", hline(1, 72), vline(1, 21)); - } - style.hover = { - image = grid("themes/default/img/tbw_hover.png", hline(1, 51), vline(3, 19)); - } - } - - [hfill vfill] new HBox { - layout = { - padding = 6 3; - spacing = 2; - } - - [hexpand vexpand] new HBox leftExtra; - [vexpand] new Label label { - style.normal = { - color = rgb(.6, .6, .6); - } - style.active = { - color = rgb(.8, .8, .8); - } - } - [hexpand vexpand] new HBox rightExtra; - } - } - - leftExtra = sub(leftExtra); - rightExtra = sub(rightExtra); - label = sub(label); - text = prop(label.text); - - text = "Tab"; -} diff -r 88cca12cc8b9 -r d63faa81a5e4 themes/default/TabView.cfg --- a/themes/default/TabView.cfg Fri Mar 27 19:26:01 2009 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +0,0 @@ -widget TabView { - layout = VBox; - layout = { - spacing = -2; - } - - new HBox tabList { - layout = { - spacing = -1; - } - } - - [hexpand hfill vexpand vfill] new Group clientArea { - shape = Rectangle; - style.normal = { - background = solid(rgb(.255, .255, .255)); - border = 1 rgb(.118, .118, .118); - } - layout = { - padding = 5 5; - } - } - - tabList = sub(tabList); - clientArea = sub(clientArea); -} diff -r 88cca12cc8b9 -r d63faa81a5e4 themes/default/TextList.cfg --- a/themes/default/TextList.cfg Fri Mar 27 19:26:01 2009 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,19 +0,0 @@ -widget TextList { - [hexpand hfill] new Picker picker { - } @background { - [hexpand vexpand hfill vfill] new Graphic { - style.normal = { - background = solid(rgba(1, 1, 1, .4)); - } - } - } @foreground { - [hexpand vexpand hfill vfill] new Graphic { - style.normal = { - background = solid(rgba(0, 0, 0, .2)); - } - } - } - - picker = sub(picker); - pickedIdx = prop(picker.pickedIdx); -} diff -r 88cca12cc8b9 -r d63faa81a5e4 themes/default/TickBox.cfg --- a/themes/default/TickBox.cfg Fri Mar 27 19:26:01 2009 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,37 +0,0 @@ -widget TickBox { - layout = Layered; - - [hfill vfill] new Graphic { - size = 13 13; - - style.normal = { - background = solid(white); - image = file("themes/default/img/tick.png"); - } - } - - [hfill vfill] new Graphic { - style.normal = { - background = solid(rgba(1, 1, 1, 0)); - image = file("themes/default/img/tick_active.png"); - } - - style.active = { - background = solid(white); - deactivation = .2; - } - } - - [hfill vfill] new Graphic { - style.normal = { - background = solid(rgba(1, 1, 1, 0)); - image = file("themes/default/img/tick_hover.png"); - } - - style.hover = { - background = solid(white); - activation = .1; - deactivation = .7; - } - } -} diff -r 88cca12cc8b9 -r d63faa81a5e4 themes/default/WindowFrame.cfg --- a/themes/default/WindowFrame.cfg Fri Mar 27 19:26:01 2009 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -widget WindowFrame { - layout = VBox; - shape = Rectangle; - style.normal = { - border = 1 black; - } - - [hexpand hfill] new HBox handle { - size = 0 23; - shape = Rectangle; - layout = { - padding = 5 0; - spacing = 4; - } - - style.normal = { - border = 1 black; - background = solid(rgb(.6, .6, .6)); - image = grid("themes/default/img/winframe_bg.png", hline(1, 9), vline(0, 23)); - } - style.active = { - background = solid(white); - } - - [hexpand vexpand] new Label caption { - } - - [vexpand] new WindowFrameButton minimizeButton { - addIcon = "themes/default/img/winframe_minimize.png"; - } - [vexpand] new WindowFrameButton maximizeButton { - addIcon = "themes/default/img/winframe_maximize.png"; - addIcon = "themes/default/img/winframe_restore.png"; - } - [vexpand] new WindowFrameButton closeButton { - addIcon = "themes/default/img/winframe_close.png"; - } - } - - [hexpand hfill vexpand vfill] new VBox clientArea { - } - - children = sub(clientArea); - handle = sub(handle); - - minimizeClicked = prop(handle.minimizeButton.clicked); - maximizeClicked = prop(handle.maximizeButton.clicked); - closeClicked = prop(handle.closeButton.clicked); - text = prop(handle.caption.text); -} diff -r 88cca12cc8b9 -r d63faa81a5e4 themes/default/WindowFrameButton.cfg --- a/themes/default/WindowFrameButton.cfg Fri Mar 27 19:26:01 2009 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,20 +0,0 @@ -widget WindowFrameButton { - layout = Layered; - - new Icon icon { - } - - [hfill vfill] new Graphic hlight { - style.normal = { - background = solid(rgba(1, 1, 1, 0)); - } - - style.active = { - background = solid(rgba(1, 1, 1, .2)); - } - } - - addIcon = prop(icon.addIcon); - icon = sub(icon); - hlight = sub(hlight); -} diff -r 88cca12cc8b9 -r d63faa81a5e4 themes/default/XCheck.cfg --- a/themes/default/XCheck.cfg Fri Mar 27 19:26:01 2009 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ -widget XCheck { - layout = HBox; - layout = { - spacing = 5; - } - - [vexpand] new Group tick { - layout = Layered; - - [hfill vfill] new Graphic { - size = 13 13; - - style.normal = { - background = solid(white); - image = file("themes/default/img/radio.png"); - } - } - - [hfill vfill] new Graphic { - style.normal = { - background = solid(rgba(1, 1, 1, 0)); - image = file("themes/default/img/radio_active.png"); - } - - style.active = { - background = solid(white); - deactivation = .2; - } - } - - [hfill vfill] new Graphic { - style.normal = { - background = solid(rgba(1, 1, 1, 0)); - image = file("themes/default/img/radio_hover.png"); - } - - style.hover = { - background = solid(white); - activation = .5; - deactivation = .7; - } - } - } - new Label label; - - text = prop(label.text); -} diff -r 88cca12cc8b9 -r d63faa81a5e4 themes/default/img/Thumbs.db Binary file themes/default/img/Thumbs.db has changed diff -r 88cca12cc8b9 -r d63faa81a5e4 themes/default/img/arrow0.png Binary file themes/default/img/arrow0.png has changed diff -r 88cca12cc8b9 -r d63faa81a5e4 themes/default/img/arrow1.png Binary file themes/default/img/arrow1.png has changed diff -r 88cca12cc8b9 -r d63faa81a5e4 themes/default/img/arrow2.png Binary file themes/default/img/arrow2.png has changed diff -r 88cca12cc8b9 -r d63faa81a5e4 themes/default/img/arrow3.png Binary file themes/default/img/arrow3.png has changed diff -r 88cca12cc8b9 -r d63faa81a5e4 themes/default/img/button.png Binary file themes/default/img/button.png has changed diff -r 88cca12cc8b9 -r d63faa81a5e4 themes/default/img/button_active.png Binary file themes/default/img/button_active.png has changed diff -r 88cca12cc8b9 -r d63faa81a5e4 themes/default/img/hsliderarrow.png Binary file themes/default/img/hsliderarrow.png has changed diff -r 88cca12cc8b9 -r d63faa81a5e4 themes/default/img/menuShadow.png Binary file themes/default/img/menuShadow.png has changed diff -r 88cca12cc8b9 -r d63faa81a5e4 themes/default/img/progress.png Binary file themes/default/img/progress.png has changed diff -r 88cca12cc8b9 -r d63faa81a5e4 themes/default/img/progress_box.png Binary file themes/default/img/progress_box.png has changed diff -r 88cca12cc8b9 -r d63faa81a5e4 themes/default/img/radio.png Binary file themes/default/img/radio.png has changed diff -r 88cca12cc8b9 -r d63faa81a5e4 themes/default/img/radio_active.png Binary file themes/default/img/radio_active.png has changed diff -r 88cca12cc8b9 -r d63faa81a5e4 themes/default/img/radio_hover.png Binary file themes/default/img/radio_hover.png has changed diff -r 88cca12cc8b9 -r d63faa81a5e4 themes/default/img/scrollbutton.png Binary file themes/default/img/scrollbutton.png has changed diff -r 88cca12cc8b9 -r d63faa81a5e4 themes/default/img/scrollbutton_active.png Binary file themes/default/img/scrollbutton_active.png has changed diff -r 88cca12cc8b9 -r d63faa81a5e4 themes/default/img/scrollhandle.png Binary file themes/default/img/scrollhandle.png has changed diff -r 88cca12cc8b9 -r d63faa81a5e4 themes/default/img/spinner_down.png Binary file themes/default/img/spinner_down.png has changed diff -r 88cca12cc8b9 -r d63faa81a5e4 themes/default/img/spinner_up.png Binary file themes/default/img/spinner_up.png has changed diff -r 88cca12cc8b9 -r d63faa81a5e4 themes/default/img/tbw.png Binary file themes/default/img/tbw.png has changed diff -r 88cca12cc8b9 -r d63faa81a5e4 themes/default/img/tbw_active.png Binary file themes/default/img/tbw_active.png has changed diff -r 88cca12cc8b9 -r d63faa81a5e4 themes/default/img/tbw_hover.png Binary file themes/default/img/tbw_hover.png has changed diff -r 88cca12cc8b9 -r d63faa81a5e4 themes/default/img/tick.png Binary file themes/default/img/tick.png has changed diff -r 88cca12cc8b9 -r d63faa81a5e4 themes/default/img/tick_active.png Binary file themes/default/img/tick_active.png has changed diff -r 88cca12cc8b9 -r d63faa81a5e4 themes/default/img/tick_hover.png Binary file themes/default/img/tick_hover.png has changed diff -r 88cca12cc8b9 -r d63faa81a5e4 themes/default/img/vsliderarrow.png Binary file themes/default/img/vsliderarrow.png has changed diff -r 88cca12cc8b9 -r d63faa81a5e4 themes/default/img/winframe_bg.png Binary file themes/default/img/winframe_bg.png has changed diff -r 88cca12cc8b9 -r d63faa81a5e4 themes/default/img/winframe_close.png Binary file themes/default/img/winframe_close.png has changed diff -r 88cca12cc8b9 -r d63faa81a5e4 themes/default/img/winframe_maximize.png Binary file themes/default/img/winframe_maximize.png has changed diff -r 88cca12cc8b9 -r d63faa81a5e4 themes/default/img/winframe_minimize.png Binary file themes/default/img/winframe_minimize.png has changed diff -r 88cca12cc8b9 -r d63faa81a5e4 themes/default/img/winframe_restore.png Binary file themes/default/img/winframe_restore.png has changed diff -r 88cca12cc8b9 -r d63faa81a5e4 verdana.ttf Binary file verdana.ttf has changed