diff options
| author | Simon Robertshaw <simon@hardwired.org.uk> | 2012-01-17 20:46:06 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2012-01-17 20:46:06 (GMT) |
| commit | 4a60b97c700c2f1843b7e99313554cb89fb5da4e (patch) | |
| tree | 3b33ef6f74a4e8a4ff5968a81b9c4c429ccaa7c6 /includes | |
| parent | 6273089bf486bf46ad325d72c7290ebb272bd3d8 (diff) | |
| download | powder-4a60b97c700c2f1843b7e99313554cb89fb5da4e.zip powder-4a60b97c700c2f1843b7e99313554cb89fb5da4e.tar.gz | |
Some minor changes
Diffstat (limited to 'includes')
32 files changed, 0 insertions, 2576 deletions
diff --git a/includes/Air.h b/includes/Air.h deleted file mode 100644 index 8e4dc25..0000000 --- a/includes/Air.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef AIR_H -#define AIR_H -#include "Config.h" - -class Simulation; - -class Air -{ -public: - int airMode; - //Arrays from the simulation - unsigned char (*bmap)[XRES/CELL]; - unsigned char (*emap)[XRES/CELL]; - float (*fvx)[XRES/CELL]; - float (*fvy)[XRES/CELL]; - // - float vx[YRES/CELL][XRES/CELL]; - float ovx[YRES/CELL][XRES/CELL]; - float vy[YRES/CELL][XRES/CELL]; - float ovy[YRES/CELL][XRES/CELL]; - float pv[YRES/CELL][XRES/CELL]; - float opv[YRES/CELL][XRES/CELL]; - float hv[YRES/CELL][XRES/CELL]; - float ohv[YRES/CELL][XRES/CELL]; // Ambient Heat - unsigned char bmap_blockair[YRES/CELL][XRES/CELL]; - float kernel[9]; - void make_kernel(void); - void update_airh(void); - void update_air(void); - Air(); -}; - -#endif diff --git a/includes/Config.h b/includes/Config.h deleted file mode 100644 index 4cb2da3..0000000 --- a/includes/Config.h +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Config.h - * - * Created on: Jan 5, 2012 - * Author: Simon - */ - -//#ifndef CONFIG_H_ -//#define CONFIG_H_ - - -#ifdef WIN32 -#define PATH_SEP "\\" -#else -#define PATH_SEP "/" -#endif - -//VersionInfoStart -#define SAVE_VERSION 71 -#define MINOR_VERSION 0 -#define BETA -#define BUILD_NUM 133 -//VersionInfoEnd - -#define IDENT_VERSION "G" //Change this if you're not Simon! It should be a single letter - -#define MTOS_EXPAND(str) #str -#define MTOS(str) MTOS_EXPAND(str) - -#define SERVER "powdertoy.co.uk" -#define SCRIPTSERVER "powdertoy.co.uk" - -#define LOCAL_SAVE_DIR "Saves" - -#define APPDATA_SUBDIR "\\HardWIRED" - -#define THUMB_CACHE_SIZE 256 - -#ifndef M_PI -#define M_PI 3.14159265f -#endif -#ifndef M_GRAV -#define M_GRAV 6.67300e-1 -#endif - -#define IMGCONNS 3 -#define TIMEOUT 100 -#define HTTP_TIMEOUT 10 - -#ifdef RENDERER -#define MENUSIZE 0 -#define BARSIZE 0 -#else -#define MENUSIZE 40 -#define BARSIZE 17 -#endif -#define XRES 612 -#define YRES 384 -#define NPART XRES*YRES - -#define XCNTR 306 -#define YCNTR 192 - -#define MAX_DISTANCE sqrt(pow(XRES, 2)+pow(YRES, 2)) - -#define GRAV_DIFF - -#define MAXSIGNS 16 -#define TAG_MAX 256 - -#define ZSIZE_D 16 -#define ZFACTOR_D 8 -extern unsigned char ZFACTOR; -extern unsigned char ZSIZE; - -#define CELL 4 -#define ISTP (CELL/2) -#define CFDS (4.0f/CELL) - -#define AIR_TSTEPP 0.3f -#define AIR_TSTEPV 0.4f -#define AIR_VADV 0.3f -#define AIR_VLOSS 0.999f -#define AIR_PLOSS 0.9999f - -#define GRID_X 5 -#define GRID_Y 4 -#define GRID_P 3 -#define GRID_S 6 -#define GRID_Z 3 - -#define CATALOGUE_X 4 -#define CATALOGUE_Y 3 -#define CATALOGUE_S 6 -#define CATALOGUE_Z 3 - -#define STAMP_MAX 240 - -#define SAVE_OPS - -#define NGOL 25 -#define NGOLALT 24 //NGOL should be 24, but use this var until I find out why - -#define CIRCLE_BRUSH 0 -#define SQUARE_BRUSH 1 -#define TRI_BRUSH 2 -#define BRUSH_NUM 3 - -#define SURF_RANGE 10 -#define NORMAL_MIN_EST 3 -#define NORMAL_INTERP 20 -#define NORMAL_FRAC 16 - -#define REFRACT 0x80000000 - -/* heavy flint glass, for awesome refraction/dispersion - this way you can make roof prisms easily */ -#define GLASS_IOR 1.9 -#define GLASS_DISP 0.07 - -#ifdef WIN32 -#define strcasecmp stricmp -#endif -#if defined(WIN32) && !defined(__GNUC__) -#define fmin min -#define fminf min -#define fmax max -#define fmaxf max -#endif - -#if defined(WIN32) && !defined(__GNUC__) -#define TPT_INLINE _inline -#else -#define TPT_INLINE inline -#endif - -#define SDEUT -//#define REALHEAT - -#define DEBUG_PARTS 0x0001 -#define DEBUG_PARTCOUNT 0x0002 -#define DEBUG_DRAWTOOL 0x0004 -#define DEBUG_PERFORMANCE_CALC 0x0008 -#define DEBUG_PERFORMANCE_FRAME 0x0010 - -//#endif /* CONFIG_H_ */ diff --git a/includes/Console.h b/includes/Console.h deleted file mode 100644 index 657f935..0000000 --- a/includes/Console.h +++ /dev/null @@ -1,48 +0,0 @@ -#ifndef CONSOLE_H -#define CONSOLE_H - -#include <string> -#include <vector> - -#include "interface/Sandbox.h" -#include "Simulation.h" - -class ConsoleCommand -{ -private: - std::string * command; - int returnStatus; - std::string * returnString; -public: - void SetCommand(std::string * command); - void SetError(std::string * error); - std::string * GetCommand(); - std::string * GetError(); - ConsoleCommand(); - ConsoleCommand(std::string * command, int returnStatus, std::string * returnString = new std::string("")); -}; - -class Console -{ -private: - bool sound_enable; - bool file_script; - std::vector<ConsoleCommand> * previousCommands; - std::string * lastError; - ui::Sandbox * sandbox; - Simulation * sim; -public: - virtual void Tick(float * dt); - int ParseType(char * txt); - int ParsePartref(char * txt); - int ParseCoords(char * coords, int *x, int *y); - virtual void ConsoleShown(); - virtual void ConsoleHidden(); - virtual int ProcessCommand(char * console); - virtual std::string * GetLastError(); - virtual std::vector<ConsoleCommand> * GetPreviousCommands(); - Console(ui::Sandbox * sandbox); - virtual ~Console(); -}; - -#endif // CONSOLE_H diff --git a/includes/Element.h b/includes/Element.h deleted file mode 100644 index 449bf51..0000000 --- a/includes/Element.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef ELEMENT_H -#define ELEMENT_H -// This header should be included by all files in src/elements/ - -#include <math.h> -#include "Simulation.h" -#include "Renderer.h" -#include "ElementFunctions.h" -//#include "powder.h" -#include "Gravity.h" -#include "Misc.h" -#include "ElementGraphics.h" - -#endif diff --git a/includes/ElementFunctions.h b/includes/ElementFunctions.h deleted file mode 100644 index ef80b6f..0000000 --- a/includes/ElementFunctions.h +++ /dev/null @@ -1,168 +0,0 @@ -/* - * ElementFunctions.h - * - * Created on: Jan 5, 2012 - * Author: Simon - */ - -#ifndef ELEMENTFUNCTIONS_H_ -#define ELEMENTFUNCTIONS_H_ -#include "Elements.h" - -int update_ACID(UPDATE_FUNC_ARGS); -int update_ANAR(UPDATE_FUNC_ARGS); -int update_AMTR(UPDATE_FUNC_ARGS); -int update_ARAY(UPDATE_FUNC_ARGS); -int update_BCLN(UPDATE_FUNC_ARGS); -int update_BCOL(UPDATE_FUNC_ARGS); -int update_BMTL(UPDATE_FUNC_ARGS); -int update_BRMT(UPDATE_FUNC_ARGS); -int update_BOMB(UPDATE_FUNC_ARGS); -int update_BOYL(UPDATE_FUNC_ARGS); -int update_BTRY(UPDATE_FUNC_ARGS); -int update_C5(UPDATE_FUNC_ARGS); -int update_CLNE(UPDATE_FUNC_ARGS); -int update_COAL(UPDATE_FUNC_ARGS); -int update_DEUT(UPDATE_FUNC_ARGS); -int update_DSTW(UPDATE_FUNC_ARGS); -int update_FOG(UPDATE_FUNC_ARGS); -int update_FRZW(UPDATE_FUNC_ARGS); -int update_FRZZ(UPDATE_FUNC_ARGS); -int update_FSEP(UPDATE_FUNC_ARGS); -int update_FUSE(UPDATE_FUNC_ARGS); -int update_FIRW(UPDATE_FUNC_ARGS); -int update_FWRK(UPDATE_FUNC_ARGS); -int update_GLAS(UPDATE_FUNC_ARGS); -int update_GLOW(UPDATE_FUNC_ARGS); -int update_GOO(UPDATE_FUNC_ARGS); -int update_HSWC(UPDATE_FUNC_ARGS); -int update_IRON(UPDATE_FUNC_ARGS); -int update_ICEI(UPDATE_FUNC_ARGS); -int update_ISZ(UPDATE_FUNC_ARGS); -int update_LCRY(UPDATE_FUNC_ARGS); -int update_MORT(UPDATE_FUNC_ARGS); -int update_NEUT(UPDATE_FUNC_ARGS); -int update_NPTCT(UPDATE_FUNC_ARGS); -int update_PCLN(UPDATE_FUNC_ARGS); -int update_PHOT(UPDATE_FUNC_ARGS); -int update_PIPE(UPDATE_FUNC_ARGS); -int update_PLNT(UPDATE_FUNC_ARGS); -int update_PLUT(UPDATE_FUNC_ARGS); -int update_PRTI(UPDATE_FUNC_ARGS); -int update_PRTO(UPDATE_FUNC_ARGS); -int update_PYRO(UPDATE_FUNC_ARGS); -int update_PUMP(UPDATE_FUNC_ARGS); -int update_QRTZ(UPDATE_FUNC_ARGS); -int update_RIME(UPDATE_FUNC_ARGS); -int update_SHLD1(UPDATE_FUNC_ARGS); -int update_SHLD2(UPDATE_FUNC_ARGS); -int update_SHLD3(UPDATE_FUNC_ARGS); -int update_SHLD4(UPDATE_FUNC_ARGS); -int update_SING(UPDATE_FUNC_ARGS); -int update_SLTW(UPDATE_FUNC_ARGS); -int update_SPAWN(UPDATE_FUNC_ARGS); -int update_SPAWN2(UPDATE_FUNC_ARGS); -int update_SPNG(UPDATE_FUNC_ARGS); -int update_SPRK(UPDATE_FUNC_ARGS); -int update_STKM(UPDATE_FUNC_ARGS); -int update_STKM2(UPDATE_FUNC_ARGS); -int update_SWCH(UPDATE_FUNC_ARGS); -int update_THDR(UPDATE_FUNC_ARGS); -int update_THRM(UPDATE_FUNC_ARGS); -int update_URAN(UPDATE_FUNC_ARGS); -int update_VINE(UPDATE_FUNC_ARGS); -int update_WARP(UPDATE_FUNC_ARGS); -int update_WATR(UPDATE_FUNC_ARGS); -int update_WIFI(UPDATE_FUNC_ARGS); -int update_WTRV(UPDATE_FUNC_ARGS); -int update_YEST(UPDATE_FUNC_ARGS); -int update_SOAP(UPDATE_FUNC_ARGS); -int update_O2(UPDATE_FUNC_ARGS); -int update_H2(UPDATE_FUNC_ARGS); -int update_NBHL(UPDATE_FUNC_ARGS); -int update_NWHL(UPDATE_FUNC_ARGS); -int update_MERC(UPDATE_FUNC_ARGS); -int update_PBCN(UPDATE_FUNC_ARGS); -int update_GPMP(UPDATE_FUNC_ARGS); -int update_CLST(UPDATE_FUNC_ARGS); -int update_DLAY(UPDATE_FUNC_ARGS); -int update_WIRE(UPDATE_FUNC_ARGS); -int update_GBMB(UPDATE_FUNC_ARGS); -int update_CO2(UPDATE_FUNC_ARGS); -int update_CBNW(UPDATE_FUNC_ARGS); -int update_STOR(UPDATE_FUNC_ARGS); -int update_BIZR(UPDATE_FUNC_ARGS); -int update_PVOD(UPDATE_FUNC_ARGS); -int update_CONV(UPDATE_FUNC_ARGS); -int update_CAUS(UPDATE_FUNC_ARGS); -int update_DEST(UPDATE_FUNC_ARGS); -int update_EMP(UPDATE_FUNC_ARGS); -int update_LIGH(UPDATE_FUNC_ARGS); -int update_FIGH(UPDATE_FUNC_ARGS); -int update_ELEC(UPDATE_FUNC_ARGS); -int update_ACEL(UPDATE_FUNC_ARGS); -int update_DCEL(UPDATE_FUNC_ARGS); -int update_BANG(UPDATE_FUNC_ARGS); -int update_IGNT(UPDATE_FUNC_ARGS); -int update_MISC(UPDATE_FUNC_ARGS); -int update_legacy_PYRO(UPDATE_FUNC_ARGS); -int update_legacy_all(UPDATE_FUNC_ARGS); -int run_stickman(playerst* playerp, UPDATE_FUNC_ARGS); -void STKM_init_legs(Simulation * sim, playerst* playerp, int i); -void STKM_interact(Simulation * sim, playerst* playerp, int i, int x, int y); - - -int graphics_FIRE(GRAPHICS_FUNC_ARGS); -int graphics_SMKE(GRAPHICS_FUNC_ARGS); -int graphics_PLSM(GRAPHICS_FUNC_ARGS); -int graphics_DEUT(GRAPHICS_FUNC_ARGS); -int graphics_PHOT(GRAPHICS_FUNC_ARGS); -int graphics_NEUT(GRAPHICS_FUNC_ARGS); -int graphics_LAVA(GRAPHICS_FUNC_ARGS); -int graphics_SPRK(GRAPHICS_FUNC_ARGS); -int graphics_QRTZ(GRAPHICS_FUNC_ARGS); -int graphics_CLST(GRAPHICS_FUNC_ARGS); -int graphics_CBNW(GRAPHICS_FUNC_ARGS); -int graphics_SPNG(GRAPHICS_FUNC_ARGS); -int graphics_LIFE(GRAPHICS_FUNC_ARGS); -int graphics_DUST(GRAPHICS_FUNC_ARGS); -int graphics_GRAV(GRAPHICS_FUNC_ARGS); -int graphics_WIFI(GRAPHICS_FUNC_ARGS); -int graphics_PRTI(GRAPHICS_FUNC_ARGS); -int graphics_PRTO(GRAPHICS_FUNC_ARGS); -int graphics_BIZR(GRAPHICS_FUNC_ARGS); -int graphics_PIPE(GRAPHICS_FUNC_ARGS); -int graphics_INVS(GRAPHICS_FUNC_ARGS); -int graphics_ACID(GRAPHICS_FUNC_ARGS); -int graphics_FILT(GRAPHICS_FUNC_ARGS); -int graphics_BRAY(GRAPHICS_FUNC_ARGS); -int graphics_SWCH(GRAPHICS_FUNC_ARGS); -int graphics_THDR(GRAPHICS_FUNC_ARGS); -int graphics_GLOW(GRAPHICS_FUNC_ARGS); -int graphics_LCRY(GRAPHICS_FUNC_ARGS); -int graphics_PCLN(GRAPHICS_FUNC_ARGS); -int graphics_PBCN(GRAPHICS_FUNC_ARGS); -int graphics_DLAY(GRAPHICS_FUNC_ARGS); -int graphics_HSWC(GRAPHICS_FUNC_ARGS); -int graphics_PVOD(GRAPHICS_FUNC_ARGS); -int graphics_STOR(GRAPHICS_FUNC_ARGS); -int graphics_PUMP(GRAPHICS_FUNC_ARGS); -int graphics_GPMP(GRAPHICS_FUNC_ARGS); -int graphics_HFLM(GRAPHICS_FUNC_ARGS); -int graphics_FIRW(GRAPHICS_FUNC_ARGS); -int graphics_BOMB(GRAPHICS_FUNC_ARGS); -int graphics_GBMB(GRAPHICS_FUNC_ARGS); -int graphics_COAL(GRAPHICS_FUNC_ARGS); -int graphics_STKM(GRAPHICS_FUNC_ARGS); -int graphics_STKM2(GRAPHICS_FUNC_ARGS); -int graphics_DEST(GRAPHICS_FUNC_ARGS); -int graphics_EMP(GRAPHICS_FUNC_ARGS); -int graphics_LIGH(GRAPHICS_FUNC_ARGS); -int graphics_FIGH(GRAPHICS_FUNC_ARGS); -int graphics_ELEC(GRAPHICS_FUNC_ARGS); -int graphics_WIRE(GRAPHICS_FUNC_ARGS); -int graphics_ACEL(GRAPHICS_FUNC_ARGS); -int graphics_DCEL(GRAPHICS_FUNC_ARGS); -int graphics_DEFAULT(GRAPHICS_FUNC_ARGS); - -#endif /* ELEMENTFUNCTIONS_H_ */ diff --git a/includes/ElementGraphics.h b/includes/ElementGraphics.h deleted file mode 100644 index a880e71..0000000 --- a/includes/ElementGraphics.h +++ /dev/null @@ -1,52 +0,0 @@ -#ifndef PGRAPHICS_H -#define PGRAPHICS_H - -#define PMODE 0x00000FFF -#define PMODE_NONE 0x00000000 -#define PMODE_FLAT 0x00000001 -#define PMODE_BLOB 0x00000002 -#define PMODE_BLUR 0x00000004 -#define PMODE_GLOW 0x00000008 -#define PMODE_SPARK 0x00000010 -#define PMODE_FLARE 0x00000020 -#define PMODE_LFLARE 0x00000040 -#define PMODE_ADD 0x00000080 -#define PMODE_BLEND 0x00000100 -#define PSPEC_STICKMAN 0x00000200 - -#define OPTIONS 0x0000F000 -#define NO_DECO 0x00001000 -#define DECO_FIRE 0x00002000 - -#define FIREMODE 0x00FF0000 -#define FIRE_ADD 0x00010000 -#define FIRE_BLEND 0x00020000 - -#define EFFECT 0xFF000000 -#define EFFECT_GRAVIN 0x01000000 -#define EFFECT_GRAVOUT 0x02000000 - -#define RENDER_EFFE OPTIONS | PSPEC_STICKMAN | EFFECT | PMODE_SPARK | PMODE_FLARE | PMODE_LFLARE -#define RENDER_FIRE OPTIONS | PSPEC_STICKMAN | PMODE_FLAT | PMODE_ADD | PMODE_BLEND | FIREMODE -#define RENDER_GLOW OPTIONS | PSPEC_STICKMAN | PMODE_FLAT | PMODE_GLOW | PMODE_ADD | PMODE_BLEND -#define RENDER_BLUR OPTIONS | PSPEC_STICKMAN | PMODE_FLAT | PMODE_BLUR | PMODE_ADD | PMODE_BLEND -#define RENDER_BLOB OPTIONS | PSPEC_STICKMAN | PMODE_FLAT | PMODE_BLOB | PMODE_ADD | PMODE_BLEND -#define RENDER_BASC OPTIONS | PSPEC_STICKMAN | PMODE_FLAT | PMODE_ADD | PMODE_BLEND -#define RENDER_NONE OPTIONS | PSPEC_STICKMAN | PMODE_FLAT - -#define COLOUR_HEAT 0x00000001 -#define COLOUR_LIFE 0x00000002 -#define COLOUR_GRAD 0x00000004 - -#define COLOUR_DEFAULT 0x00000000 - -#define DISPLAY_AIRC 0x00000001 -#define DISPLAY_AIRP 0x00000002 -#define DISPLAY_AIRV 0x00000004 -#define DISPLAY_AIRH 0x00000008 -#define DISPLAY_AIR 0x0000000F -#define DISPLAY_WARP 0x00000010 -#define DISPLAY_PERS 0x00000020 -#define DISPLAY_EFFE 0x00000040 - -#endif diff --git a/includes/Elements.h b/includes/Elements.h deleted file mode 100644 index 204460c..0000000 --- a/includes/Elements.h +++ /dev/null @@ -1,280 +0,0 @@ -/* - * Elements.h - * - * Created on: Jan 5, 2012 - * Author: Simon - */ - -//#ifndef ELEMENTS_H_ -//#define ELEMENTS_H_ - -//#include "Config.h" -//#include "Simulation.h" - -#define IPL -257.0f -#define IPH 257.0f -#define ITL MIN_TEMP-1 -#define ITH MAX_TEMP+1 -// no transition (PT_NONE means kill part) -#define NT -1 -// special transition - lava ctypes etc need extra code, which is only found and run if ST is given -#define ST PT_NUM - -#define R_TEMP 22 -#define MAX_TEMP 9999 -#define MIN_TEMP 0 -#define O_MAX_TEMP 3500 -#define O_MIN_TEMP -273 - -#define TYPE_PART 0x00001 //1 Powders -#define TYPE_LIQUID 0x00002 //2 Liquids -#define TYPE_SOLID 0x00004 //4 Solids -#define TYPE_GAS 0x00008 //8 Gasses (Includes plasma) -#define TYPE_ENERGY 0x00010 //16 Energy (Thunder, Light, Neutrons etc.) -#define PROP_CONDUCTS 0x00020 //32 Conducts electricity -#define PROP_BLACK 0x00040 //64 Absorbs Photons (not currently implemented or used, a photwl attribute might be better) -#define PROP_NEUTPENETRATE 0x00080 //128 Penetrated by neutrons -#define PROP_NEUTABSORB 0x00100 //256 Absorbs neutrons, reflect is default (not currently implemented or used) -#define PROP_NEUTPASS 0x00200 //512 Neutrons pass through, such as with glass -#define PROP_DEADLY 0x00400 //1024 Is deadly for stickman (not currently implemented or used) -#define PROP_HOT_GLOW 0x00800 //2048 Hot Metal Glow -#define PROP_LIFE 0x01000 //4096 Is a GoL type -#define PROP_RADIOACTIVE 0x02000 //8192 Radioactive -#define PROP_LIFE_DEC 0x04000 //2^14 Life decreases by one every frame if > zero -#define PROP_LIFE_KILL 0x08000 //2^15 Kill when life value is <= zero -#define PROP_LIFE_KILL_DEC 0x10000 //2^16 Kill when life value is decremented to <= zero -#define PROP_SPARKSETTLE 0x20000 //2^17 Allow Sparks/Embers to settle - -#define FLAG_STAGNANT 1 - -#define ST_NONE 0 -#define ST_SOLID 1 -#define ST_LIQUID 2 -#define ST_GAS 3 - -#define UPDATE_FUNC_ARGS Simulation* sim, int i, int x, int y, int surround_space, int nt, Particle *parts, int pmap[YRES][XRES] -// to call another update function with same arguments: -#define UPDATE_FUNC_SUBCALL_ARGS sim, i, x, y, surround_space, nt, parts, pmap - -#define GRAPHICS_FUNC_ARGS Renderer * ren, Particle *cpart, int nx, int ny, int *pixel_mode, int* cola, int *colr, int *colg, int *colb, int *firea, int *firer, int *fireg, int *fireb -#define GRAPHICS_FUNC_SUBCALL_ARGS ren, cpart, nx, ny, pixel_mode, cola, colr, colg, colb, firea, firer, fireg, fireb - -#define UI_WALLSTART 222 -#define UI_ACTUALSTART 122 -#define UI_WALLCOUNT 25 - -#define WL_WALLELEC 122 -#define WL_EWALL 123 -#define WL_DETECT 124 -#define WL_STREAM 125 -#define WL_SIGN 126 -#define WL_FAN 127 -#define WL_FANHELPER 255 -#define WL_ALLOWLIQUID 128 -#define WL_DESTROYALL 129 -#define WL_ERASE 130 -#define WL_WALL 131 -#define WL_ALLOWAIR 132 -#define WL_ALLOWSOLID 133 -#define WL_ALLOWALLELEC 134 -#define WL_EHOLE 135 - -#define SPC_AIR 236 -#define SPC_HEAT 237 -#define SPC_COOL 238 -#define SPC_VACUUM 239 -#define SPC_WIND 241 -#define SPC_PGRV 243 -#define SPC_NGRV 244 -#define SPC_PROP 246 - -#define WL_ALLOWGAS 140 -#define WL_GRAV 142 -#define WL_ALLOWENERGY 145 - -#define NGT_GOL 0 -#define NGT_HLIF 1 -#define NGT_ASIM 2 -#define NGT_2x2 3 -#define NGT_DANI 4 -#define NGT_AMOE 5 -#define NGT_MOVE 6 -#define NGT_PGOL 7 -#define NGT_DMOE 8 -#define NGT_34 9 -#define NGT_LLIF 10 -#define NGT_STAN 11 -#define NGT_SEED 12 -#define NGT_MAZE 13 -#define NGT_COAG 14 -#define NGT_WALL 15 -#define NGT_GNAR 16 -#define NGT_REPL 17 -#define NGT_MYST 18 -#define NGT_LOTE 19 -#define NGT_FRG2 20 -#define NGT_STAR 21 -#define NGT_FROG 22 -#define NGT_BRAN 23 - -#define PT_NONE 0 -#define PT_DUST 1 -#define PT_WATR 2 -#define PT_OIL 3 -#define PT_FIRE 4 -#define PT_STNE 5 -#define PT_LAVA 6 -#define PT_GUNP 7 -#define PT_NITR 8 -#define PT_CLNE 9 -#define PT_GAS 10 -#define PT_PLEX 11 -#define PT_GOO 12 -#define PT_ICEI 13 -#define PT_METL 14 -#define PT_SPRK 15 -#define PT_SNOW 16 -#define PT_WOOD 17 -#define PT_NEUT 18 -#define PT_PLUT 19 -#define PT_PLNT 20 -#define PT_ACID 21 -#define PT_VOID 22 -#define PT_WTRV 23 -#define PT_CNCT 24 -#define PT_DSTW 25 -#define PT_SALT 26 -#define PT_SLTW 27 -#define PT_DMND 28 -#define PT_BMTL 29 -#define PT_BRMT 30 -#define PT_PHOT 31 -#define PT_URAN 32 -#define PT_WAX 33 -#define PT_MWAX 34 -#define PT_PSCN 35 -#define PT_NSCN 36 -#define PT_LNTG 37 -#define PT_INSL 38 -#define PT_BHOL 39 -#define PT_WHOL 40 -#define PT_RBDM 41 -#define PT_LRBD 42 -#define PT_NTCT 43 -#define PT_SAND 44 -#define PT_GLAS 45 -#define PT_PTCT 46 -#define PT_BGLA 47 -#define PT_THDR 48 -#define PT_PLSM 49 -#define PT_ETRD 50 -#define PT_NICE 51 -#define PT_NBLE 52 -#define PT_BTRY 53 -#define PT_LCRY 54 -#define PT_STKM 55 -#define PT_SWCH 56 -#define PT_SMKE 57 -#define PT_DESL 58 -#define PT_COAL 59 -#define PT_LO2 60 -#define PT_O2 61 -#define PT_INWR 62 -#define PT_YEST 63 -#define PT_DYST 64 -#define PT_THRM 65 -#define PT_GLOW 66 -#define PT_BRCK 67 -#define PT_HFLM 68 -#define PT_FIRW 69 -#define PT_FUSE 70 -#define PT_FSEP 71 -#define PT_AMTR 72 -#define PT_BCOL 73 -#define PT_PCLN 74 -#define PT_HSWC 75 -#define PT_IRON 76 -#define PT_MORT 77 -#define PT_LIFE 78 -#define PT_DLAY 79 -#define PT_CO2 80 -#define PT_DRIC 81 -#define PT_CBNW 82 -#define PT_STOR 83 -#define PT_PVOD 84 -#define PT_CONV 85 -#define PT_CAUS 86 - -#define PT_LIGH 87 -#define PT_TESC 88 -#define PT_DEST 89 - -#define PT_SPNG 90 -#define PT_RIME 91 -#define PT_FOG 92 -#define PT_BCLN 93 -#define PT_LOVE 94 -#define PT_DEUT 95 -#define PT_WARP 96 -#define PT_PUMP 97 -#define PT_FWRK 98 -#define PT_PIPE 99 -#define PT_FRZZ 100 -#define PT_FRZW 101 -#define PT_GRAV 102 -#define PT_BIZR 103 -#define PT_BIZRG 104 -#define PT_BIZRS 105 -#define PT_INST 106 -#define PT_ISOZ 107 -#define PT_ISZS 108 -#define PT_PRTI 109 -#define PT_PRTO 110 -#define PT_PSTE 111 -#define PT_PSTS 112 -#define PT_ANAR 113 -#define PT_VINE 114 -#define PT_INVIS 115 -#define PT_EQUALVEL 116 //all particles equal their velocities -#define PT_SPAWN2 117 -#define PT_SPAWN 118 -#define PT_SHLD1 119 -#define PT_SHLD2 120 -#define PT_SHLD3 121 -#define PT_SHLD4 122 -#define PT_LOLZ 123 -#define PT_WIFI 124 -#define PT_FILT 125 -#define PT_ARAY 126 -#define PT_BRAY 127 -#define PT_STKM2 128 -#define PT_BOMB 129 -#define PT_C5 130 -#define PT_SING 131 -#define PT_QRTZ 132 -#define PT_PQRT 133 -#define PT_EMP 134 -#define PT_BREC 135 -#define PT_ELEC 136 -#define PT_ACEL 137 -#define PT_DCEL 138 -#define PT_BANG 139 -#define PT_IGNT 140 -#define PT_BOYL 141 - -#define OLD_PT_WIND 147 -#define PT_H2 148 -#define PT_SOAP 149 -#define PT_NBHL 150 -#define PT_NWHL 151 -#define PT_MERC 152 -#define PT_PBCN 153 -#define PT_GPMP 154 -#define PT_CLST 155 -#define PT_WIRE 156 -#define PT_GBMB 157 -#define PT_FIGH 158 -#define PT_NUM 159 - - -//#endif /* ELEMENTS_H_ */ diff --git a/includes/GameSession.h b/includes/GameSession.h deleted file mode 100644 index 8417e0c..0000000 --- a/includes/GameSession.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef GAMESESSION_H -#define GAMESESSION_H - -class GameSession -{ -public: - GameSession(); -}; - -#endif // GAMESESSION_H diff --git a/includes/Global.h b/includes/Global.h deleted file mode 100644 index 8e94255..0000000 --- a/includes/Global.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef GAMESESSION_H -#define GAMESESSION_H - -#include "Singleton.h" -#include "Graphics.h" - -class Global : public Singleton<Global> -{ -public: - Graphics * g; - Global(); -}; - -#endif // GAMESESSION_H diff --git a/includes/Graphics.h b/includes/Graphics.h deleted file mode 100644 index 6cd5b36..0000000 --- a/includes/Graphics.h +++ /dev/null @@ -1,172 +0,0 @@ -#ifndef GRAPHICS_H -#define GRAPHICS_H - -#include <SDL/SDL.h> -#include <string> -#include "Config.h" -//#include "powder.h" - -#ifdef PIX16 -#define PIXELSIZE 2 -#define PIXPACK(x) ((((x)>>8)&0xF800)|(((x)>>5)&0x07E0)|(((x)>>3)&0x001F)) -#define PIXRGB(r,g,b) ((((r)<<8)&0xF800)|(((g)<<3)&0x07E0)|(((b)>>3)&0x001F)) -#define PIXR(x) (((x)>>8)&0xF8) -#define PIXG(x) (((x)>>3)&0xFC) -#define PIXB(x) (((x)<<3)&0xF8) -#else -#define PIXELSIZE 4 -#ifdef PIX32BGR -#define PIXPACK(x) ((((x)>>16)&0x0000FF)|((x)&0x00FF00)|(((x)<<16)&0xFF0000)) -#define PIXRGB(r,g,b) (((b)<<16)|((g)<<8)|((r)))// (((b)<<16)|((g)<<8)|(r)) -#define PIXR(x) ((x)&0xFF) -#define PIXG(x) (((x)>>8)&0xFF) -#define PIXB(x) ((x)>>16) -#else -#ifdef PIX32BGRA -#define PIXPACK(x) ((((x)>>8)&0x0000FF00)|(((x)<<8)&0x00FF0000)|(((x)<<24)&0xFF000000)) -#define PIXRGB(r,g,b) (((b)<<24)|((g)<<16)|((r)<<8)) -#define PIXR(x) (((x)>>8)&0xFF) -#define PIXG(x) (((x)>>16)&0xFF) -#define PIXB(x) (((x)>>24)) -#elif defined(PIX32OGL) -#define PIXPACK(x) (0xFF000000|((x)&0xFFFFFF)) -#define PIXRGB(r,g,b) (0xFF000000|((r)<<16)|((g)<<8)|((b)))// (((b)<<16)|((g)<<8)|(r)) -#define PIXRGBA(r,g,b,a) (((a)<<24)|((r)<<16)|((g)<<8)|((b)))// (((b)<<16)|((g)<<8)|(r)) -#define PIXA(x) (((x)>>24)&0xFF) -#define PIXR(x) (((x)>>16)&0xFF) -#define PIXG(x) (((x)>>8)&0xFF) -#define PIXB(x) ((x)&0xFF) -#else -#define PIXPACK(x) (x) -#define PIXRGB(r,g,b) (((r)<<16)|((g)<<8)|(b)) -#define PIXR(x) ((x)>>16) -#define PIXG(x) (((x)>>8)&0xFF) -#define PIXB(x) ((x)&0xFF) -#endif -#endif -#endif - -#ifdef PIX16 -typedef unsigned short pixel; -#else -typedef unsigned int pixel; -#endif - -/*extern int emp_decor; - -extern unsigned int *render_modes; -extern unsigned int render_mode; -extern unsigned int colour_mode; -extern unsigned int *display_modes; -extern unsigned int display_mode; - -extern SDL_Surface *sdl_scrn; -extern int sdl_scale; - -extern int sandcolour_r; -extern int sandcolour_g; -extern int sandcolour_b; -extern int sandcolour_frame; - -extern unsigned char fire_r[YRES/CELL][XRES/CELL]; -extern unsigned char fire_g[YRES/CELL][XRES/CELL]; -extern unsigned char fire_b[YRES/CELL][XRES/CELL]; - -extern unsigned int fire_alpha[CELL*3][CELL*3]; -extern pixel *pers_bg; - -extern char * flm_data; -extern int flm_data_points; -extern pixel flm_data_colours[]; -extern float flm_data_pos[]; - -extern char * plasma_data; -extern int plasma_data_points; -extern pixel plasma_data_colours[]; -extern float plasma_data_pos[];*/ - -class Graphics -{ -public: - SDL_Surface * sdl_scrn; - pixel *vid; - pixel *render_packed_rgb(void *image, int width, int height, int cmp_size); - static char * generate_gradient(pixel * colours, float * points, int pointcount, int size); - void draw_other(); - void draw_rgba_image(unsigned char *data, int x, int y, float a); - static void *ptif_pack(pixel *src, int w, int h, int *result_size); - static pixel *ptif_unpack(void *datain, int size, int *w, int *h); - static pixel *resample_img_nn(pixel *src, int sw, int sh, int rw, int rh); - static pixel *resample_img(pixel *src, int sw, int sh, int rw, int rh); - static pixel *rescale_img(pixel *src, int sw, int sh, int *qw, int *qh, int f); - //void render_gravlensing(pixel *src, pixel * dst); - //void sdl_blit_1(int x, int y, int w, int h, pixel *src, int pitch); - //void sdl_blit_2(int x, int y, int w, int h, pixel *src, int pitch); - //void sdl_blit(int x, int y, int w, int h, pixel *src, int pitch); - void drawblob(int x, int y, unsigned char cr, unsigned char cg, unsigned char cb); - void draw_tool(int b, int sl, int sr, unsigned pc, unsigned iswall); - //int draw_tool_xy(pixel *vid_buf, int x, int y, int b, unsigned pc); - //void draw_menu(pixel *vid_buf, int i, int hover); - void drawpixel(int x, int y, int r, int g, int b, int a); - int addchar(int x, int y, int c, int r, int g, int b, int a); - int drawchar(int x, int y, int c, int r, int g, int b, int a); - int drawtext(int x, int y, std::string &s, int r, int g, int b, int a); - int drawtext(int x, int y, const char *s, int r, int g, int b, int a); - int drawtext_outline(int x, int y, const char *s, int r, int g, int b, int a, int olr, int olg, int olb, int ola); - int drawtextwrap(int x, int y, int w, const char *s, int r, int g, int b, int a); - void drawrect(int x, int y, int w, int h, int r, int g, int b, int a); - void fillrect(int x, int y, int w, int h, int r, int g, int b, int a); - void clearrect(int x, int y, int w, int h); - void drawdots(int x, int y, int h, int r, int g, int b, int a); - static int textwidth(char *s); - int drawtextmax(int x, int y, int w, char *s, int r, int g, int b, int a); - static int textnwidth(char *s, int n); - static void textnpos(char *s, int n, int w, int *cx, int *cy); - static int textwidthx(char *s, int w); - static int textposxy(char *s, int width, int w, int h); - static int textwrapheight(char *s, int width); - void blendpixel(int x, int y, int r, int g, int b, int a); - void draw_icon(int x, int y, char ch, int flag); - //void draw_air(); - //void draw_grav_zones(pixel *vid); - //void draw_grav(pixel *vid); - void draw_line(int x1, int y1, int x2, int y2, int r, int g, int b, int a); - void addpixel(int x, int y, int r, int g, int b, int a); - void xor_pixel(int x, int y); - void xor_line(int x1, int y1, int x2, int y2); - void xor_rect(int x, int y, int w, int h); - void blend_line(int x1, int y1, int x2, int y2, int r, int g, int b, int a); - //void render_parts(pixel *vid); -// #ifdef OGLR -// void draw_parts_fbo(); -// #endif -// void draw_parts(); -// void draw_walls(pixel *vid); -// void create_decorations(int x, int y, int rx, int ry, int r, int g, int b, int click, int tool); -// void create_decoration(int x, int y, int r, int g, int b, int click, int tool); -// void line_decorations(int x1, int y1, int x2, int y2, int rx, int ry, int r, int g, int b, int click, int tool); -// void box_decorations(int x1, int y1, int x2, int y2, int r, int g, int b, int click, int tool); -// void draw_color_menu(pixel *vid_buf, int i, int hover); - void draw_wavelengths(int x, int y, int h, int wl); - void render_signs(); -// void render_fire(pixel *dst); -// void prepare_alpha(int size, float intensity); - void draw_image(pixel *img, int x, int y, int w, int h, int a); - static void dim_copy(pixel *dst, pixel *src); - static void dim_copy_pers(pixel *dst, pixel *src); - //void render_zoom(pixel *img); - //int render_thumb(void *thumb, int size, int bzip2, pixel *vid_buf, int px, int py, int scl); - //void render_cursor(pixel *vid, int x, int y, int t, int rx, int ry); - //int sdl_open(void); - //int draw_debug_info(pixel* vid, int lm, int lx, int ly, int cx, int cy, int line_x, int line_y); - void Clear(); - void Blit(); - void AttachSDLSurface(SDL_Surface * surface); - #ifdef OGLR - void clearScreen(float alpha); - void ogl_blit(int x, int y, int w, int h, pixel *src, int pitch, int scale); - #endif - Graphics(); -}; - -#endif diff --git a/includes/Gravity.h b/includes/Gravity.h deleted file mode 100644 index 9f36240..0000000 --- a/includes/Gravity.h +++ /dev/null @@ -1,108 +0,0 @@ -#ifndef GRAVITY_H -#define GRAVITY_H - -#include <pthread.h> -#include "Config.h" -#include "Simulation.h" - -class Simulation; - -struct mask_el { - char *shape; - char shapeout; - void *next; -}; -typedef struct mask_el mask_el; - - -/* - * float *gravmap = NULL;//Maps to be used by the main thread - float *gravp = NULL; - float *gravy = NULL; - float *gravx = NULL; - unsigned *gravmask = NULL; - - float *th_ogravmap = NULL;// Maps to be processed by the gravity thread - float *th_gravmap = NULL; - float *th_gravx = NULL; - float *th_gravy = NULL; - float *th_gravp = NULL; - - int th_gravchanged = 0; - - pthread_t gravthread; - pthread_mutex_t gravmutex; - pthread_cond_t gravcv; - int grav_ready = 0; - int gravthread_done = 0; - */ -class Gravity -{ -private: - unsigned *gravmask; - - float *th_ogravmap; - float *th_gravmap; - float *th_gravx; - float *th_gravy; - float *th_gravp; - - int th_gravchanged; - - pthread_t gravthread; - pthread_mutex_t gravmutex; - pthread_cond_t gravcv; - int grav_ready; - int gravthread_done; - - //Simulation * sim; -public: - float *gravmap; - float *gravp; - float *gravy; - float *gravx; - unsigned char (*bmap)[XRES/CELL]; - int ngrav_enable; - void grav_mask_r(int x, int y, char checkmap[YRES/CELL][XRES/CELL], char shape[YRES/CELL][XRES/CELL], char *shapeout); - void mask_free(mask_el *c_mask_el); - - void gravity_init(); - void gravity_cleanup(); - void gravity_update_async(); - - static void *update_grav_async_helper(void * context); - void update_grav_async(); - - void start_grav_async(); - void stop_grav_async(); - void update_grav(); - void gravity_mask(); - - void bilinear_interpolation(float *src, float *dst, int sw, int sh, int rw, int rh); - - #ifdef GRAVFFT - void grav_fft_init(); - void grav_fft_cleanup(); - #endif - - Gravity(); -}; - -/*extern int ngrav_enable; //Newtonian gravity -extern int gravwl_timeout; -extern int gravityMode;*/ - -/*float *gravmap;//Maps to be used by the main thread -float *gravp; -float *gravy; -float *gravx; -unsigned *gravmask; - -float *th_ogravmap;// Maps to be processed by the gravity thread -float *th_gravmap; -float *th_gravx; -float *th_gravy; -float *th_gravp;*/ - - -#endif diff --git a/includes/Misc.h b/includes/Misc.h deleted file mode 100644 index c5a61ef..0000000 --- a/includes/Misc.h +++ /dev/null @@ -1,108 +0,0 @@ -#ifndef UTILS_H -#define UTILS_H -#include <stdio.h> -#include <stdlib.h> - -#if defined(WIN32) && !defined(__GNUC__) -#define x86_cpuid(func,af,bf,cf,df) \ - do {\ - __asm mov eax, func\ - __asm cpuid\ - __asm mov af, eax\ - __asm mov bf, ebx\ - __asm mov cf, ecx\ - __asm mov df, edx\ - } while(0) -#else -#define x86_cpuid(func,af,bf,cf,df) \ -__asm__ __volatile ("cpuid":\ - "=a" (af), "=b" (bf), "=c" (cf), "=d" (df) : "a" (func)); -#endif - -static char hex[] = "0123456789ABCDEF"; - -char *exe_name(void); - -//Signum function -int isign(float i); - -unsigned clamp_flt(float f, float min, float max); - -float restrict_flt(float f, float min, float max); - -char *mystrdup(char *s); - -struct strlist -{ - char *str; - struct strlist *next; -}; - -void strlist_add(struct strlist **list, char *str); - -int strlist_find(struct strlist **list, char *str); - -void strlist_free(struct strlist **list); - -void save_presets(int do_update); - -void clean_text(char *text, int vwidth); - -void load_presets(void); - -void save_string(FILE *f, char *str); - -int sregexp(const char *str, char *pattern); - -int load_string(FILE *f, char *str, int max); - -void strcaturl(char *dst, char *src); - -void strappend(char *dst, char *src); - -void *file_load(char *fn, int *size); - -void clipboard_push_text(char * text); - -char * clipboard_pull_text(); - -extern char *clipboard_text; - -int register_extension(); - -int cpu_check(void); - -void HSV_to_RGB(int h,int s,int v,int *r,int *g,int *b); - -void RGB_to_HSV(int r,int g,int b,int *h,int *s,int *v); - -void membwand(void * dest, void * src, size_t destsize, size_t srcsize); -// a b -// c d - -struct matrix2d { - float a,b,c,d; -}; -typedef struct matrix2d matrix2d; - -// column vector -struct vector2d { - float x,y; -}; -typedef struct vector2d vector2d; - -matrix2d m2d_multiply_m2d(matrix2d m1, matrix2d m2); -vector2d m2d_multiply_v2d(matrix2d m, vector2d v); -matrix2d m2d_multiply_float(matrix2d m, float s); -vector2d v2d_multiply_float(vector2d v, float s); - -vector2d v2d_add(vector2d v1, vector2d v2); -vector2d v2d_sub(vector2d v1, vector2d v2); - -matrix2d m2d_new(float me0, float me1, float me2, float me3); -vector2d v2d_new(float x, float y); - -extern vector2d v2d_zero; -extern matrix2d m2d_identity; - -#endif diff --git a/includes/Renderer.h b/includes/Renderer.h deleted file mode 100644 index 39c8c1a..0000000 --- a/includes/Renderer.h +++ /dev/null @@ -1,60 +0,0 @@ -#ifndef RENDERER_H -#define RENDERER_H - -#include "Config.h" -#include "Simulation.h" -#include "Graphics.h" - -class Simulation; - -class Graphics; - -struct gcache_item -{ - int isready; - int pixel_mode; - int cola, colr, colg, colb; - int firea, firer, fireg, fireb; -}; -typedef struct gcache_item gcache_item; - -class Renderer -{ -public: - //TODO: Vectors! - unsigned int *render_modes; - unsigned int render_mode; - unsigned int colour_mode; - unsigned int *display_modes; - unsigned int display_mode; - // - unsigned char fire_r[YRES/CELL][XRES/CELL]; - unsigned char fire_g[YRES/CELL][XRES/CELL]; - unsigned char fire_b[YRES/CELL][XRES/CELL]; - unsigned int fire_alpha[CELL*3][CELL*3]; - char * flm_data; - char * plasma_data; - int emp_decor; - // - int decorations_enable; - Simulation * sim; - Graphics * g; - gcache_item *graphicscache; - // - void draw_walls(); - void render_signs(); - void render_gravlensing(); - void render_fire(); - void prepare_alpha(int size, float intensity); - void render_parts(); - void draw_grav_zones(); - void draw_air(); - void draw_grav(); - void draw_other(); - void init_display_modes(); - void get_sign_pos(int i, int *x0, int *y0, int *w, int *h); - void prepare_graphicscache(); - Renderer(Graphics * g, Simulation * sim); -}; - -#endif diff --git a/includes/Simulation.h b/includes/Simulation.h deleted file mode 100644 index b3c51af..0000000 --- a/includes/Simulation.h +++ /dev/null @@ -1,241 +0,0 @@ -/* - * Simulation.h - * - * Created on: Jan 2, 2012 - * Author: Simon - */ - -#ifndef SIMULATION_H_ -#define SIMULATION_H_ -#include <cstring> -#include "Config.h" -#include "Renderer.h" -#include "Graphics.h" -#include "Elements.h" -#include "misc.h" - -#define CHANNELS ((int)(MAX_TEMP-73)/100+2) - -class Simulation; -class Renderer; -class Gravity; -class Air; - -struct Particle -{ - int type; - int life, ctype; - float x, y, vx, vy; - float temp; - float pavg[2]; - int flags; - int tmp; - int tmp2; - unsigned int dcolour; -}; -typedef struct Particle Particle; - -struct sign -{ - int x,y,ju; - char text[256]; -}; -typedef struct sign sign; - -struct part_type -{ - char *name; - pixel pcolors; - float advection; - float airdrag; - float airloss; - float loss; - float collision; - float gravity; - float diffusion; - float hotair; - int falldown; - int flammable; - int explosive; - int meltable; - int hardness; - int menu; - int enabled; - int weight; - int menusection; - float heat; - unsigned char hconduct; - char *descs; - char state; - unsigned int properties; - int (*update_func) (UPDATE_FUNC_ARGS); - int (*graphics_func) (GRAPHICS_FUNC_ARGS); -}; -typedef struct part_type part_type; - -struct part_transition -{ - float plv; // transition occurs if pv is lower than this - int plt; - float phv; // transition occurs if pv is higher than this - int pht; - float tlv; // transition occurs if t is lower than this - int tlt; - float thv; // transition occurs if t is higher than this - int tht; -}; -typedef struct part_transition part_transition; - -struct playerst -{ - char comm; //command cell - char pcomm; //previous command - int elem; //element power - float legs[16]; //legs' positions - float accs[8]; //accelerations - char spwn; //if stick man was spawned - unsigned int frames; //frames since last particle spawn - used when spawning LIGH -}; -typedef struct playerst playerst; - -struct wall_type -{ - pixel colour; - pixel eglow; // if emap set, add this to fire glow - int drawstyle; - const char *descs; -}; -typedef struct wall_type wall_type; - -struct gol_menu -{ - const char *name; - pixel colour; - int goltype; - const char *description; -}; -typedef struct gol_menu gol_menu; - -//#ifdef _cplusplus -class Simulation -{ -private: -public: - - Gravity * grav; - Air * air; - part_type ptypes[PT_NUM]; - part_transition ptransitions[PT_NUM]; - wall_type wtypes[UI_WALLCOUNT]; - gol_menu gmenu[NGOL]; - int goltype[NGOL]; - int grule[NGOL+1][10]; - playerst player; - playerst player2; - playerst fighters[256]; //255 is the maximum number of fighters - unsigned char fighcount; //Contains the number of fighters - int lighting_recreate; - int gravwl_timeout; - Particle portalp[CHANNELS][8][80]; - Particle emptyparticle; - int portal_rx[8]; - int portal_ry[8]; - int wireless[CHANNELS][2]; - char can_move[PT_NUM][PT_NUM]; - int parts_lastActiveIndex;// = NPART-1; - int pfree; - int NUM_PARTS; - int elementCount[PT_NUM]; - int ISWIRE; - sign * signs; - //Gol sim - int CGOL; - int ISGOL; - int GSPEED; - unsigned char gol[XRES][YRES]; - unsigned char gol2[XRES][YRES][NGOL+1]; - //Air sim - float (*vx)[XRES/CELL]; - float (*vy)[XRES/CELL]; - float (*pv)[XRES/CELL]; - float (*hv)[XRES/CELL]; - //Gravity sim - float *gravx;//gravx[(YRES/CELL) * (XRES/CELL)]; - float *gravy;//gravy[(YRES/CELL) * (XRES/CELL)]; - float *gravp;//gravp[(YRES/CELL) * (XRES/CELL)]; - float *gravmap;//gravmap[(YRES/CELL) * (XRES/CELL)]; - //Walls - unsigned char bmap[YRES/CELL][XRES/CELL]; - unsigned char emap[YRES/CELL][XRES/CELL]; - float fvx[YRES/CELL][XRES/CELL]; - float fvy[YRES/CELL][XRES/CELL]; - //Particles - Particle parts[NPART]; - int pmap[YRES][XRES]; - int photons[YRES][XRES]; - // - int gravityMode; - int airMode; - int ngrav_enable; - int legacy_enable; - int aheat_enable; - int VINE_MODE; - int water_equal_test; - int sys_pause; - int framerender; - int pretty_powder; - // - int sandcolour_r; - int sandcolour_g; - int sandcolour_b; //TODO: Make a single variable - //Stuff - int is_blocking(int t, int x, int y); - int is_boundary(int pt, int x, int y); - int find_next_boundary(int pt, int *x, int *y, int dm, int *em); - int pn_junction_sprk(int x, int y, int pt); - void photoelectric_effect(int nx, int ny); - unsigned direction_to_map(float dx, float dy, int t); - int do_move(int i, int x, int y, float nxf, float nyf); - int try_move(int i, int x, int y, int nx, int ny); - int eval_move(int pt, int nx, int ny, unsigned *rr); - void init_can_move(); - void create_cherenkov_photon(int pp); - void create_gain_photon(int pp); - void kill_part(int i); - int flood_prop(int x, int y, size_t propoffset, void * propvalue, int proptype); - int flood_prop_2(int x, int y, size_t propoffset, void * propvalue, int proptype, int parttype, char * bitmap); - int flood_water(int x, int y, int i, int originaly, int check); - void detach(int i); - void part_change_type(int i, int x, int y, int t); - int create_part_add_props(int p, int x, int y, int tv, int rx, int ry); - //int InCurrentBrush(int i, int j, int rx, int ry); - //int get_brush_flags(); - int create_part(int p, int x, int y, int t); - void delete_part(int x, int y, int flags); - int is_wire(int x, int y); - int is_wire_off(int x, int y); - void set_emap(int x, int y); - int parts_avg(int ci, int ni, int t); - void create_arc(int sx, int sy, int dx, int dy, int midpoints, int variance, int type, int flags); - int nearest_part(int ci, int t, int max_d); - void update_particles_i(int start, int inc); - void update_particles(); - void rotate_area(int area_x, int area_y, int area_w, int area_h, int invert); - void clear_area(int area_x, int area_y, int area_w, int area_h); - void create_box(int x1, int y1, int x2, int y2, int c, int flags); - int flood_parts(int x, int y, int c, int cm, int bm, int flags); - int create_parts(int x, int y, int rx, int ry, int c, int flags); - void create_line(int x1, int y1, int x2, int y2, int rx, int ry, int c, int flags); - void *transform_save(void *odata, int *size, matrix2d transform, vector2d translate); - void orbitalparts_get(int block1, int block2, int resblock1[], int resblock2[]); - void orbitalparts_set(int *block1, int *block2, int resblock1[], int resblock2[]); - int get_wavelength_bin(int *wm); - int get_normal(int pt, int x, int y, float dx, float dy, float *nx, float *ny); - int get_normal_interp(int pt, float x0, float y0, float dx, float dy, float *nx, float *ny); - void clear_sim(); - void UpdateParticles(); - Simulation(); -}; -//#endif - -#endif /* SIMULATION_H_ */ diff --git a/includes/Singleton.h b/includes/Singleton.h deleted file mode 100644 index 6b2214e..0000000 --- a/includes/Singleton.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef SINGLETON_H -#define SINGLETON_H - -template<typename T> - -class Singleton -{ -public: - static T& Ref() - { - static T instance; - return instance; - } -}; - -#endif // SINGLETON_H diff --git a/includes/interface.old/Button.h b/includes/interface.old/Button.h deleted file mode 100644 index 1b2900e..0000000 --- a/includes/interface.old/Button.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Button.h - * - * Created on: Jan 8, 2012 - * Author: Simon - */ - -#ifndef BUTTON_H_ -#define BUTTON_H_ - -#include <string> - -#include "Component.h" - -namespace ui -{ - class Button : public Component - { - public: - Button(int x, int y, int width, int height, const std::string& buttonText); - - bool Toggleable; - - std::string ButtonText; - - virtual void OnMouseClick(int x, int y, unsigned int button); - virtual void OnMouseUnclick(int x, int y, unsigned int button); - virtual void OnMouseUp(int x, int y, unsigned int button); - - virtual void OnMouseEnter(int x, int y, int dx, int dy); - virtual void OnMouseLeave(int x, int y, int dx, int dy); - - virtual void Draw(void* userdata); - - inline bool GetState() { return state; } - virtual void DoAction(); //action of button what ever it may be - - protected: - bool isButtonDown, state, isMouseInside; - }; -} -#endif /* BUTTON_H_ */ diff --git a/includes/interface.old/Component.h b/includes/interface.old/Component.h deleted file mode 100644 index a4d02db..0000000 --- a/includes/interface.old/Component.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Component.h - * - * Created on: Jan 8, 2012 - * Author: Simon - */ - -#ifndef COMPONENT_H_ -#define COMPONENT_H_ - -namespace ui -{ - class State; - - class Component - { - public: - Component(int x, int y, int width, int height); - virtual ~Component(); - - inline void LocalizePoint(int& x, int& y) { x -= X; y -= Y; } //convert a global point (point on the state) to a point based on component's position - inline void GlobalizePoint(int& x, int& y) { x += X; y += Y; } //convert a local point based on component's position to a global point on the state - - bool Focused; - bool Visible; - bool Enabled; - int Width; - int Height; - int X; - int Y; - - virtual void Tick(float dt); - virtual void Draw(void* userdata); - - virtual void OnMouseEnter(int localx, int localy, int dx, int dy); - virtual void OnMouseLeave(int localx, int localy, int dx, int dy); - virtual void OnMouseMoved(int localx, int localy, int dx, int dy); - virtual void OnMouseMovedInside(int localx, int localy, int dx, int dy); - virtual void OnMouseHover(int localx, int localy); - virtual void OnMouseDown(int localx, int localy, unsigned int button); - virtual void OnMouseUp(int localx, int localy, unsigned int button); - virtual void OnMouseClick(int localx, int localy, unsigned int button); - virtual void OnMouseUnclick(int localx, int localy, unsigned int button); - virtual void OnMouseWheel(int localx, int localy, int d); - virtual void OnMouseWheelInside(int localx, int localy, int d); - virtual void OnMouseWheelFocused(int localx, int localy, int d); - virtual void OnKeyPress(int key, bool shift, bool ctrl, bool alt); - virtual void OnKeyRelease(int key, bool shift, bool ctrl, bool alt); - - State* Parent; - }; -} -#endif /* COMPONENT_H_ */ diff --git a/includes/interface.old/ControlFactory.h b/includes/interface.old/ControlFactory.h deleted file mode 100644 index 8bfd780..0000000 --- a/includes/interface.old/ControlFactory.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef CONTROLFACTORY_H -#define CONTROLFACTORY_H - -#include "Panel.h" -#include "Window.h" -#include "GameSession.h" - -class ControlFactory -{ -public: - static ui::Panel * MainMenu(GameSession * session, int x, int y, int width, int height); - -}; - -#endif // CONTROLFACTORY_H diff --git a/includes/interface.old/Panel.h b/includes/interface.old/Panel.h deleted file mode 100644 index 9549ff4..0000000 --- a/includes/interface.old/Panel.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Panel.h - * - * Created on: Jan 8, 2012 - * Author: Simon - */ - -#ifndef PANEL_H_ -#define PANEL_H_ - -#include "interface/Component.h" - -namespace ui { - -class Panel: public ui::Component { -public: - Panel(int x, int y, int width, int height); - virtual ~Panel(); -}; - -} /* namespace ui */ -#endif /* PANEL_H_ */ diff --git a/includes/interface.old/Sandbox.h b/includes/interface.old/Sandbox.h deleted file mode 100644 index 32a0471..0000000 --- a/includes/interface.old/Sandbox.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Sandbox.h - * - * Created on: Jan 8, 2012 - * Author: Simon - */ - -#ifndef SANDBOX_H_ -#define SANDBOX_H_ - -#include "Component.h" -#include "Simulation.h" -#include "Renderer.h" - -namespace ui { - -class Sandbox: public ui::Component { -private: - int lastCoordX, lastCoordY; - int activeElement; - bool isMouseDown; - Renderer * ren; - Simulation * sim; -public: - Sandbox(); - virtual Simulation * GetSimulation(); - virtual void OnMouseMovedInside(int localx, int localy, int dx, int dy); - virtual void OnMouseDown(int localx, int localy, unsigned int button); - virtual void OnMouseUp(int localx, int localy, unsigned int button); - virtual void Draw(void* userdata); - virtual void Tick(float delta); - virtual ~Sandbox(); -}; - -} /* namespace ui */ -#endif /* SANDBOX_H_ */ diff --git a/includes/interface.old/State.h b/includes/interface.old/State.h deleted file mode 100644 index 00df199..0000000 --- a/includes/interface.old/State.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * State.h - * - * Created on: Jan 8, 2012 - * Author: Simon - */ - -#ifndef STATE_H_ -#define STATE_H_ - -#include <vector> - -#include "interface/Component.h" - -namespace ui { - -class State -{ -public: - State(int w, int h); - virtual ~State(); - - bool AllowExclusiveDrawing; //false will not call draw on objects outside of bounds - - virtual void Tick(float dt); - virtual void Draw(void* userdata); - - virtual void OnMouseMove(int x, int y); - virtual void OnMouseDown(int x, int y, unsigned int button); - virtual void OnMouseUp(int x, int y, unsigned int button); - virtual void OnMouseWheel(int x, int y, int d); - virtual void OnKeyPress(int key, bool shift, bool ctrl, bool alt); - virtual void OnKeyRelease(int key, bool shift, bool ctrl, bool alt); - - virtual void Add(Component *child); - virtual void Remove(Component *child); - - inline bool IsFocused(Component* c) { return (c == focusedComponent_); } - inline int GetMouseX() { return mouseX; } - inline int GetMouseY() { return mouseY; } - inline int GetWidth() { return width; } - inline int GetHeight() { return height; } - -protected: - std::vector<Component*> Components; - - int width; - int height; - - int mouseX; - int mouseY; - int mouseXP; - int mouseYP; - -private: - Component* focusedComponent_; - -}; - -} /* namespace ui */ -#endif /* STATE_H_ */ diff --git a/includes/interface.old/Window.h b/includes/interface.old/Window.h deleted file mode 100644 index 86a4bcd..0000000 --- a/includes/interface.old/Window.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Window.h - * - * Created on: Jan 8, 2012 - * Author: Simon - */ - -#ifndef WINDOW_H_ -#define WINDOW_H_ - -#include "interface/State.h" - -namespace ui { - -class Window: public ui::State { -public: - Window(); - virtual ~Window(); -}; - -} /* namespace ui */ -#endif /* WINDOW_H_ */ diff --git a/includes/interface/Button.h b/includes/interface/Button.h deleted file mode 100644 index 9046ea1..0000000 --- a/includes/interface/Button.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Button.h - * - * Created on: Jan 8, 2012 - * Author: Simon - */ - -#ifndef BUTTON_H_ -#define BUTTON_H_ - -#include <string> - -#include "Component.h" - -namespace ui -{ - class Button : public Component - { - public: - Button(State* parent_state, std::string buttonText); - - Button(Point position, Point size, std::string buttonText); - - Button(std::string buttonText); - virtual ~Button(); - - bool Toggleable; - - std::string ButtonText; - - virtual void OnMouseClick(int x, int y, unsigned int button); - virtual void OnMouseUnclick(int x, int y, unsigned int button); - //virtual void OnMouseUp(int x, int y, unsigned int button); - - virtual void OnMouseEnter(int x, int y); - virtual void OnMouseLeave(int x, int y); - - virtual void Draw(const Point& screenPos); - - inline bool GetState() { return state; } - virtual void DoAction(); //action of button what ever it may be - void SetTogglable(bool isTogglable); - bool GetTogglable(); - inline bool GetToggleState(); - inline void SetToggleState(bool state); - - protected: - bool isButtonDown, state, isMouseInside, isTogglable, toggle; - }; -} -#endif /* BUTTON_H_ */ diff --git a/includes/interface/Component.h b/includes/interface/Component.h deleted file mode 100644 index 5759c08..0000000 --- a/includes/interface/Component.h +++ /dev/null @@ -1,204 +0,0 @@ -#pragma once - -#include "Point.h" -#include "State.h" -#include "Platform.h" - -namespace ui -{ - class State; - class Panel; - - /* class Component - * - * An interactive UI component that can be added to a state or an XComponent*. - * *See sys::XComponent - */ - class Component - { - public: - Component(State* parent_state); - Component(Point position, Point size); - Component(); - virtual ~Component(); - - void* UserData; - inline State* const GetParentState() const { return parentstate_; } - bool IsFocused() const; - - Point Position; - Point Size; - bool Locked; - bool Visible; - - /* See the parent of this component. - * If new_parent is NULL, this component will have no parent. (THIS DOES NOT delete THE COMPONENT. See XComponent::RemoveChild) - */ - void SetParentState(State* state); - void SetParent(Panel* new_parent); - - //Get the parent component. - inline Panel* const GetParent() const { return _parent; } - - //UI functions: - /* - void Tick(float dt); - void Draw(const Point& screenPos); - - void OnMouseHover(int localx, int localy); - void OnMouseMoved(int localx, int localy, int dx, int dy); - void OnMouseMovedInside(int localx, int localy, int dx, int dy); - void OnMouseEnter(int localx, int localy); - void OnMouseLeave(int localx, int localy); - void OnMouseDown(int x, int y, unsigned int button); - void OnMouseUp(int x, int y, unsigned int button); - void OnMouseClick(int localx, int localy, unsigned int button); - void OnMouseUnclick(int localx, int localy, unsigned int button); - void OnMouseWheel(int localx, int localy, int d); - void OnMouseWheelInside(int localx, int localy, int d); - void OnKeyPress(int key, bool shift, bool ctrl, bool alt); - void OnKeyRelease(int key, bool shift, bool ctrl, bool alt); - */ - - /// - // Called: Every tick. - // Params: - // dt: The change in time. - /// - virtual void Tick(float dt); - - /// - // Called: When ready to draw. - // Params: - // None - /// - virtual void Draw(const Point& screenPos); - - - - - /// - // Called: When the mouse is currently hovering over the item. (Called every tick) - // Params: - // localx: Local mouse X position. - // localy: Local mouse Y position. - /// - virtual void OnMouseHover(int localx, int localy); - - /// - // Called: When the mouse moves. - // Params: - // localx: Local mouse X position. - // localy: Local mouse Y position. - // dx: Mouse X delta. - // dy: Mouse Y delta. - /// - virtual void OnMouseMoved(int localx, int localy, int dx, int dy); - - /// - // Called: When the mouse moves. - // Params: - // localx: Local mouse X position. - // localy: Local mouse Y position. - // dx: Mouse X delta. - // dy: Mouse Y delta. - /// - virtual void OnMouseMovedInside(int localx, int localy, int dx, int dy); - - /// - // Called: When the mouse moves on top of the item. - // Params: - // localx: Local mouse X position. - // localy: Local mouse Y position. - // dx: Mouse X delta. - // dy: Mouse Y delta. - /// - virtual void OnMouseEnter(int localx, int localy); - - /// - // Called: When the mouse leaves the item. - // Params: - // localx: Local mouse X position. - // localy: Local mouse Y position. - /// - virtual void OnMouseLeave(int localx, int localy); - - /// - // Called: When a mouse button is pressed. - // Params: - // x: X position of the mouse. - // y: Y position of the mouse. - // button: The button that is being held down. - /// - virtual void OnMouseDown(int x, int y, unsigned button); - - /// - // Called: When a mouse button is released. - // Params: - // x: X position of the mouse. - // y: Y position of the mouse. - // button: The button that is being released. - /// - virtual void OnMouseUp(int x, int y, unsigned button); - - /// - // Called: When a mouse button is pressed on top of the item. - // Params: - // x: X position of the mouse. - // y: Y position of the mouse. - // button: The button that is being held down. - /// - virtual void OnMouseClick(int localx, int localy, unsigned button); - - /// - // Called: When a mouse button is released on top of the item. - // Params: - // x: X position of the mouse. - // y: Y position of the mouse. - // button: The button that is being released. - /// - virtual void OnMouseUnclick(int localx, int localy, unsigned button); - - /// - // Called: When the mouse wheel moves/changes. - // Params: - // localx: Local mouse X position. - // localy: Local mouse Y position. - // d: The mouse wheel movement value. - /// - virtual void OnMouseWheel(int localx, int localy, int d); - - /// - // Called: When the mouse wheel moves/changes on top of the item. - // Params: - // localx: Local mouse X position. - // localy: Local mouse Y position. - // d: The mouse wheel movement value. - /// - virtual void OnMouseWheelInside(int localx, int localy, int d); - - /// - // Called: When a key is pressed. - // Params: - // key: The value of the key that is being pressed. - // shift: Shift key is down. - // ctrl: Control key is down. - // alt: Alternate key is down. - /// - virtual void OnKeyPress(int key, bool shift, bool ctrl, bool alt); - - /// - // Called: When a key is released. - // Params: - // key: The value of the key that is being released. - // shift: Shift key is released. - // ctrl: Control key is released. - // alt: Alternate key is released. - /// - virtual void OnKeyRelease(int key, bool shift, bool ctrl, bool alt); - - private: - State* parentstate_; - Panel* _parent; - }; -} diff --git a/includes/interface/ControlFactory.h b/includes/interface/ControlFactory.h deleted file mode 100644 index 0f8ad61..0000000 --- a/includes/interface/ControlFactory.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef CONTROLFACTORY_H -#define CONTROLFACTORY_H - -#include "Panel.h" -#include "Engine.h" - -class ControlFactory -{ -public: - static ui::Panel * MainMenu(int x, int y, int width, int height); - -}; - -#endif // CONTROLFACTORY_H diff --git a/includes/interface/Engine.h b/includes/interface/Engine.h deleted file mode 100644 index 6136fb4..0000000 --- a/includes/interface/Engine.h +++ /dev/null @@ -1,64 +0,0 @@ -#pragma once - -#include <SDL/SDL.h> -#include "Singleton.h" -#include "Platform.h" -#include "State.h" -#include "Graphics.h" - -namespace ui -{ - class State; - - /* class Engine - * - * Controls the User Interface. - * Send user inputs to the Engine and the appropriate controls and components will interact. - */ - class Engine: public Singleton<Engine> - { - public: - Engine(); - ~Engine(); - - void onMouseMove(int x, int y); - void onMouseClick(int x, int y, unsigned button); - void onMouseUnclick(int x, int y, unsigned button); - void onMouseWheel(int x, int y, int delta); - void onKeyPress(int key, bool shift, bool ctrl, bool alt); - void onKeyRelease(int key, bool shift, bool ctrl, bool alt); - void onResize(int newWidth, int newHeight); - void onClose(); - - void Begin(int width, int height); - inline bool Running() { return running_; } - void Exit(); - - void Tick(float dt); - void Draw(); - - inline int GetMouseX() { return mousex_; } - inline int GetMouseY() { return mousey_; } - inline int GetWidth() { return width_; } - inline int GetHeight() { return height_; } - - inline void SetSize(int width, int height); - - void SetState(State* state); - inline State* GetState() { return state_; } - float FpsLimit; - private: - State* statequeued_; - State* state_; - - bool running_; - - int mousex_; - int mousey_; - int mousexp_; - int mouseyp_; - int width_; - int height_; - }; - -} diff --git a/includes/interface/Label.h b/includes/interface/Label.h deleted file mode 100644 index 2168956..0000000 --- a/includes/interface/Label.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef LABEL_H -#define LABEL_H - -#include <string> - -#include "Component.h" - -namespace ui -{ - class Label : public Component - { - public: - Label(State* parent_state, std::string labelText); - - Label(Point position, Point size, std::string labelText); - - Label(std::string labelText); - virtual ~Label(); - - std::string LabelText; - - virtual void Draw(const Point& screenPos); - }; -} - -#endif // LABEL_H diff --git a/includes/interface/Panel.h b/includes/interface/Panel.h deleted file mode 100644 index 7c9adab..0000000 --- a/includes/interface/Panel.h +++ /dev/null @@ -1,136 +0,0 @@ -#pragma once -#include <vector> -//#include "Platform.h" - -#include "interface/Point.h" -#include "interface/State.h" -#include "interface/Component.h" - -namespace ui -{ - /* class XComponent - * - * An eXtension of the Component class. - * Adds the ability to have child components. - * - * See sys::Component - */ -class Component; - class Panel : public Component - { - public: - friend class Component; - - Panel(State* parent_state); - Panel(Point position, Point size); - Panel(); - virtual ~Panel(); - - /* Add a child component. - * Similar to XComponent::SetParent - * - * If the component is already parented, then this will become the new parent. - */ - void AddChild(Component* c); - - // Remove child from component. This DOES NOT free the component from memory. - void RemoveChild(Component* c); - - // Remove child from component. This WILL free the component from memory unless told otherwise. - void RemoveChild(unsigned idx, bool freeMem = true); - - //Grab the number of children this component owns. - int GetChildCount(); - - //Get child of this component by index. - Component* GetChild(unsigned idx); - - void Tick(float dt); - void Draw(const Point& screenPos); - - void OnMouseHover(int localx, int localy); - void OnMouseMoved(int localx, int localy, int dx, int dy); - void OnMouseMovedInside(int localx, int localy, int dx, int dy); - void OnMouseEnter(int localx, int localy); - void OnMouseLeave(int localx, int localy); - void OnMouseDown(int x, int y, unsigned button); - void OnMouseUp(int x, int y, unsigned button); - void OnMouseClick(int localx, int localy, unsigned button); - void OnMouseUnclick(int localx, int localy, unsigned button); - void OnMouseWheel(int localx, int localy, int d); - void OnMouseWheelInside(int localx, int localy, int d); - void OnKeyPress(int key, bool shift, bool ctrl, bool alt); - void OnKeyRelease(int key, bool shift, bool ctrl, bool alt); - - protected: - // child components - std::vector<ui::Component*> children; - - //UI functions: - /* - void XTick(float dt); - void XDraw(const Point& screenPos); - - void XOnMouseHover(int localx, int localy); - void XOnMouseMoved(int localx, int localy, int dx, int dy); - void XOnMouseMovedInside(int localx, int localy, int dx, int dy); - void XOnMouseEnter(int localx, int localy); - void XOnMouseLeave(int localx, int localy); - void XOnMouseDown(int x, int y, unsigned int button); - void XOnMouseUp(int x, int y, unsigned int button); - void XOnMouseClick(int localx, int localy, unsigned int button); - void XOnMouseUnclick(int localx, int localy, unsigned int button); - void XOnMouseWheel(int localx, int localy, int d); - void XOnMouseWheelInside(int localx, int localy, int d); - void XOnKeyPress(int key, bool shift, bool ctrl, bool alt); - void XOnKeyRelease(int key, bool shift, bool ctrl, bool alt); - */ - - // Overridable. Called by XComponent::Tick() - virtual void XTick(float dt); - - // Overridable. Called by XComponent::Draw() - virtual void XDraw(const Point& screenPos); - - - // Overridable. Called by XComponent::XOnMouseHover() - virtual void XOnMouseHover(int localx, int localy); - - // Overridable. Called by XComponent::OnMouseMoved() - virtual void XOnMouseMoved(int localx, int localy, int dx, int dy); - - // Overridable. Called by XComponent::OnMouseMovedInside() - virtual void XOnMouseMovedInside(int localx, int localy, int dx, int dy); - - // Overridable. Called by XComponent::OnMouseEnter() - virtual void XOnMouseEnter(int localx, int localy); - - // Overridable. Called by XComponent::OnMouseLeave() - virtual void XOnMouseLeave(int localx, int localy); - - // Overridable. Called by XComponent::OnMouseDown() - virtual void XOnMouseDown(int x, int y, unsigned button); - - // Overridable. Called by XComponent::OnMouseUp() - virtual void XOnMouseUp(int x, int y, unsigned button); - - // Overridable. Called by XComponent::OnMouseClick() - virtual void XOnMouseClick(int localx, int localy, unsigned button); - - // Overridable. Called by XComponent::OnMouseUnclick() - virtual void XOnMouseUnclick(int localx, int localy, unsigned button); - - // Overridable. Called by XComponent::OnMouseWheel() - virtual void XOnMouseWheel(int localx, int localy, int d); - - // Overridable. Called by XComponent::OnMouseWheelInside() - virtual void XOnMouseWheelInside(int localx, int localy, int d); - - // Overridable. Called by XComponent::OnKeyPress() - virtual void XOnKeyPress(int key, bool shift, bool ctrl, bool alt); - - // Overridable. Called by XComponent::OnKeyRelease() - virtual void XOnKeyRelease(int key, bool shift, bool ctrl, bool alt); - }; - -} diff --git a/includes/interface/Platform.h b/includes/interface/Platform.h deleted file mode 100644 index c57dca6..0000000 --- a/includes/interface/Platform.h +++ /dev/null @@ -1,108 +0,0 @@ -#pragma once - - -/* ***** Platform-ness ***** */ - -#if defined(_WIN32) || defined(__WIN32__) || defined(WIN32_LEAN_AND_MEAN) -# define IEF_PLATFORM_WIN32 -# ifndef WIN32_LEAN_AND_MEAN -# define WIN32_LEAN_AND_MEAN -# endif -#elif defined(linux) || defined(_linux) || defined(__linux) -# define IEF_PLATFORM_LINUX - -#elif defined(__APPLE__) || defined(MACOSX) || defined(macintosh) || defined(Macintosh) -# define IEF_PLATFORM_MACOSX - -//#elif defined(__FreeBSD__) || define(__FreeBSD_kernel__) -//# define IEF_PLATFORM_FREEBSD - -#else -# error Operating System not supported. -#endif - - -/* ***** Endian-ness ***** */ - -#if defined(__m68k__) || defined(mc68000) || defined(_M_M68K) || (defined(__MIPS__) && defined(__MISPEB__)) || defined(__ppc__) || defined(__POWERPC__) || defined(_M_PPC) || defined(__sparc__) || defined(__hppa__) -# define IEF_ENDIAN_BIG - -#else -# define IEF_ENDIAN_LITTLE -#endif - - -/* ***** Debug-ness ***** */ - -#if !defined(NDEBUG) || defined(_DEBUG) -# define IEF_DEBUG -#endif - - -/* ***** Primitive Types ***** */ - -#ifndef NULL -# define NULL 0 -#endif - -#include <climits> -namespace sys -{ - -#if UCHAR_MAX == 0xFF //char - typedef signed char s8; - typedef unsigned char u8; -#else -# error No 8-Bit Integer supported. -#endif -#if USHRT_MAX == 0xFFFF //short - typedef signed short s16; - typedef unsigned short u16; -#elif UINT_MAX == 0xFFFF - typedef signed int s16; - typedef unsigned int u16; -#elif ULONG_MAX == 0xFFFF - typedef signed long s16; - typedef unsigned long u16; - #else - # error No 16-Bit Integer supported. - #endif - #if USHRT_MAX == 0xFFFFFFFF //int - typedef signed short s32; - typedef unsigned short u32; -#elif UINT_MAX == 0xFFFFFFFF - typedef signed int s32; - typedef unsigned int u32; -#elif ULONG_MAX == 0xFFFFFFFF - typedef signed long s32; - typedef unsigned long u32; - #else - # error No 32-Bit Integer supported. - #endif -#if UINT_MAX == 0xFFFFFFFFFFFFFFFF //long - typedef signed int s64; - typedef unsigned int u64; -#elif ULONG_MAX == 0xFFFFFFFFFFFFFFFF - typedef signed long s64; - typedef unsigned long u64; -#elif ULLONG_MAX == 0xFFFFFFFFFFFFFFFF - typedef signed long long s64; - typedef unsigned long long u64; -#else -# pragma message("Warning: 64-bit not supported. s64 and u64 defined as 32-bit.") - typedef s32 s64; - typedef u32 u64; -#endif -//floating -typedef float f32; -typedef double f64; -//misc -typedef u8 byte; -typedef u8 ubyte; -typedef s8 sbyte; -typedef s64 llong; -typedef s64 sllong; -typedef u64 ullong; -typedef char* cstring; - -} //namespace sys diff --git a/includes/interface/Point.h b/includes/interface/Point.h deleted file mode 100644 index 0d0250c..0000000 --- a/includes/interface/Point.h +++ /dev/null @@ -1,136 +0,0 @@ -#pragma once -#include "Platform.h" - -namespace ui -{ - -//Lightweight 2D Int32/Float32 Point struct for UI -struct Point -{ -#if ENABLE_FLOAT_UI -# define POINT_T float -#else -# define POINT_T int -#endif - - POINT_T X; - POINT_T Y; - - Point(POINT_T x, POINT_T y) - : X(x) - , Y(y) - { - } - - inline Point operator - () const - { - return Point(-X, -Y); - } - - inline Point operator + (const Point& v) const - { - return Point(X + v.X, Y + v.Y); - } - - inline Point operator - (const Point& v) const - { - return Point(X - v.X, Y - v.Y); - } - - inline Point operator * (const Point& v) const - { - return Point(X * v.X, Y * v.Y); - } - - inline Point operator * (int v) const - { - return Point(X * static_cast<POINT_T>(v), Y * static_cast<POINT_T>(v)); - } - - inline Point operator * (float v) const - { - return Point(X * static_cast<POINT_T>(v), Y * static_cast<POINT_T>(v)); - } - - inline Point operator / (const Point& v) const - { - return Point(X / v.X, Y / v.Y); - } - - inline Point operator / (int v) const - { - return Point(X / static_cast<POINT_T>(v), Y / static_cast<POINT_T>(v)); - } - - inline Point operator / (float v) const - { - return Point(X / static_cast<POINT_T>(v), Y / static_cast<POINT_T>(v)); - } - - inline void operator += (const Point& v) - { - X += v.X; - Y += v.Y; - } - - inline void operator -= (const Point& v) - { - X -= v.X; - Y -= v.Y; - } - - inline void operator *= (const Point& v) - { - X *= v.X; - Y *= v.Y; - } - - inline void operator *= (int v) - { - X *= static_cast<POINT_T>(v); - Y *= static_cast<POINT_T>(v); - } - - inline void operator *= (float v) - { - X *= static_cast<POINT_T>(v); - Y *= static_cast<POINT_T>(v); - } - - inline void operator /= (const Point& v) - { - X /= v.X; - Y /= v.Y; - } - - inline void operator /= (int v) - { - X /= static_cast<POINT_T>(v); - Y /= static_cast<POINT_T>(v); - } - - inline void operator /= (float v) - { - X /= static_cast<POINT_T>(v); - Y /= static_cast<POINT_T>(v); - } - - inline bool operator == (const Point& v) const - { - return (X == v.X && Y == v.Y); - } - - inline bool operator != (const Point& v) const - { - return (X != v.X || Y != v.Y); - } - - inline void operator = (const Point& v) - { - X = v.X; - Y = v.Y; - } - -}; - -} diff --git a/includes/interface/Sandbox.h b/includes/interface/Sandbox.h deleted file mode 100644 index fb4a668..0000000 --- a/includes/interface/Sandbox.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Sandbox.h - * - * Created on: Jan 8, 2012 - * Author: Simon - */ - -#ifndef SANDBOX_H_ -#define SANDBOX_H_ - -#include <queue> -#include "Point.h" -#include "Component.h" -#include "Simulation.h" -#include "Renderer.h" - -namespace ui { - -class Sandbox: public ui::Component { -private: - int lastCoordX, lastCoordY; - int activeElement; - std::queue<Point*> pointQueue; - bool isMouseDown; - Renderer * ren; - Simulation * sim; -public: - Sandbox(); - virtual Simulation * GetSimulation(); - virtual void OnMouseMoved(int localx, int localy, int dx, int dy); - virtual void OnMouseClick(int localx, int localy, unsigned int button); - virtual void OnMouseUp(int localx, int localy, unsigned int button); - virtual void Draw(const Point& screenPos); - virtual void Tick(float delta); - virtual ~Sandbox(); -}; - -} /* namespace ui */ -#endif /* SANDBOX_H_ */ diff --git a/includes/interface/State.h b/includes/interface/State.h deleted file mode 100644 index 75e969d..0000000 --- a/includes/interface/State.h +++ /dev/null @@ -1,77 +0,0 @@ -#pragma once - -#include <vector> - -#include "Engine.h" -#include "Component.h" -#include "Platform.h" - -namespace ui -{ - class Engine; - class Component; - - /* class State - * - * A UI state. Contains all components. - */ - class State - { - public: - State(); - virtual ~State(); - - bool AllowExclusiveDrawing; //false will not call draw on objects outside of bounds - - // Add Component to state - void AddComponent(Component* c); - - // Get the number of components this state has. - unsigned GetComponentCount(); - - // Get component by index. (See GetComponentCount()) - Component* GetComponent(unsigned idx); - - // Remove a component from state. NOTE: This DOES NOT free component from memory. - void RemoveComponent(Component* c); - - // Remove a component from state. NOTE: This WILL free component from memory. - void RemoveComponent(unsigned idx); - - void DoInitialized(); - void DoExit(); - void DoTick(float dt); - void DoDraw(); - - void DoMouseMove(int x, int y, int dx, int dy); - void DoMouseDown(int x, int y, unsigned button); - void DoMouseUp(int x, int y, unsigned button); - void DoMouseWheel(int x, int y, int d); - void DoKeyPress(int key, bool shift, bool ctrl, bool alt); - void DoKeyRelease(int key, bool shift, bool ctrl, bool alt); - - bool IsFocused(const Component* c) const; - void FocusComponent(Component* c); - - void* UserData; - - protected: - virtual void OnInitialized() {} - virtual void OnExit() {} - virtual void OnTick(float dt) {} - virtual void OnDraw() {} - - virtual void OnMouseMove(int x, int y, int dx, int dy) {} - virtual void OnMouseDown(int x, int y, unsigned button) {} - virtual void OnMouseUp(int x, int y, unsigned button) {} - virtual void OnMouseWheel(int x, int y, int d) {} - virtual void OnKeyPress(int key, bool shift, bool ctrl, bool alt) {} - virtual void OnKeyRelease(int key, bool shift, bool ctrl, bool alt) {} - - private: - std::vector<Component*> Components; - Component* focusedComponent_; - - }; - -} |
