00001
00002
00003
00004
00005
00006 #ifndef _WOOPSIFUNCS_H_
00007 #define _WOOPSIFUNCS_H_
00008
00009 #include <nds.h>
00010 #include "framebuffer.h"
00011 #include "font.h"
00012 #include "monofont.h"
00013 #include "bitmapwrapper.h"
00014 #include "gadgetstyle.h"
00015 #include "newtopaz.h"
00016 #include "glyphfont.h"
00017 #include "defines.h"
00018
00028 #define woopsiRGB(r, g, b) (((b) << 10) | ((g) << 5) | (r) | (1 << 15))
00029
00033 typedef struct PAD {
00034 union {
00035 struct {
00036 u16 A:1;
00037 u16 B:1;
00038 u16 Select:1;
00039 u16 Start:1;
00040 u16 Right:1;
00041 u16 Left:1;
00042 u16 Up:1;
00043 u16 Down:1;
00044 u16 R:1;
00045 u16 L:1;
00046 u16 X:1;
00047 u16 Y:1;
00048 u16 Touch:1;
00049 u16 Lid:1;
00050 };
00051 u16 AllKeys;
00052 };
00053 } _pad;
00054
00058 typedef struct PadHeldTimeStruct {
00059 u32 A;
00060 u32 B;
00061 u32 Select;
00062 u32 Start;
00063 u32 Right;
00064 u32 Left;
00065 u32 Up;
00066 u32 Down;
00067 u32 R;
00068 u32 L;
00069 u32 X;
00070 u32 Y;
00071 } PadHeldTime;
00072
00076 typedef struct PADS {
00077 _pad Held;
00078 _pad Released;
00079 _pad Newpress;
00080 PadHeldTime HeldTime;
00081 } _pads;
00082
00086 typedef struct STYLUS {
00087 u8 Held:1;
00088 u8 Released:1;
00089 u8 Newpress:1;
00090 u8 unused:5;
00091 s16 X;
00092 s16 Y;
00093 s16 Vx;
00094 s16 Vy;
00095 s16 oldVx;
00096 s16 oldVy;
00097 s16 Downtime;
00098 s16 Uptime;
00099 s16 DblClick;
00100 } _stylus;
00101
00105 extern _pads Pad;
00106
00110 extern _stylus Stylus;
00111
00112 #ifdef USING_SDL
00113
00114 #include <stdio.h>
00115 #include <stdlib.h>
00116 #include <string.h>
00117 #include <math.h>
00118
00119 void putSDLPixel(SDL_Surface *surface, int x, int y, Uint32 pixel);
00120 Uint32 getSDLPixel(SDL_Surface *surface, int x, int y);
00121
00122 #else
00123
00124 #include <nds/memory.h>
00125 #include <nds/bios.h>
00126
00127 #endif
00128
00132 extern WoopsiUI::FrameBuffer* frameBuffer[2];
00133
00137 extern WoopsiUI::GadgetStyle* defaultGadgetStyle;
00138
00143 void initWoopsiGfxMode();
00144
00148 void woopsiInitDefaultGadgetStyle();
00149
00153 void woopsiFreeDefaultGadgetStyle();
00154
00158 void woopsiFreeFrameBuffers();
00159
00163 void woopsiWaitVBL();
00164
00169 bool woopsiLidClosed();
00170
00176 void woopsiUpdateInput();
00177
00184 void woopsiDmaCopy(const u16* source, u16* dest, u32 count);
00185
00192 void woopsiDmaFill(u16 fill, u16* dest, u32 count);
00193
00194 #endif