- Main Page
- Classes
- Files

- File List

# C:/Documents and Settings/Administrator/Desktop/woopsi-src-0.40/Woopsi/libwoopsi/include/woopsifuncs.h

    00001 /* Contributed by Steven
    00002  * 20071213
    00003  * - Minor modifications and SDL code by Ant
    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
    00015 // DMA handling bitmasks
    00016 #define DMA_ON 0x80000000
    00017 #define DMA_NOW 0x00000000
    00018 #define DMA_16 0x00000000
    00019 #define DMA_32 0x04000000
    00020 #define DMA_16NOW (DMA_ON | DMA_NOW | DMA_16)
    00021 #define DMA_32NOW (DMA_ON | DMA_NOW | DMA_32)
    00022
    00032 #define woopsiRGB(r, g, b) (((b) << 10) | ((g) << 5) | (r) | (1 << 15))
    00033
    00037 typedef struct PAD
    00038 {
    00039         union
    00040         {
    00041                 struct
    00042                 {
    00043                         u16 A:1;
    00044                         u16 B:1;
    00045                         u16 Select:1;
    00046                         u16 Start:1;
    00047                         u16 Right:1;
    00048                         u16 Left:1;
    00049                         u16 Up:1;
    00050                         u16 Down:1;
    00051                         u16 R:1;
    00052                         u16 L:1;
    00053                         u16 X:1;
    00054                         u16 Y:1;
    00055                         u16 Touch:1;
    00056                         u16 Lid:1;
    00057                 };
    00058                 u16 AllKeys;
    00059         };
    00060 } _pad;
    00061
    00065 typedef struct PADS {
    00066    _pad Held;
    00067    _pad Released;
    00068    _pad Newpress;
    00069 } _pads;
    00070
    00074 typedef struct STYLUS {
    00075         u8 Held:1;
    00076         u8 Released:1;
    00077         u8 Newpress:1;
    00078         u8 unused:5;
    00079         s16 X;
    00080         s16 Y;
    00081         s16 Vx;
    00082         s16 Vy;
    00083         s16 oldVx;
    00084         s16 oldVy;
    00085         s16 Downtime;
    00086         s16 Uptime;
    00087         s16 DblClick;
    00088 } _stylus;
    00089
    00093 extern _pads Pad;
    00094
    00098 extern _stylus Stylus;
    00099
    00100 #ifdef USING_SDL
    00101
    00102 #include <stdio.h>
    00103 #include <stdlib.h>
    00104 #include <string.h>
    00105 #include <math.h>
    00106
    00107 void putPixel(SDL_Surface *surface, int x, int y, Uint32 pixel);
    00108
    00109 #else
    00110
    00111 #include <nds/memory.h>
    00112 #include <nds/bios.h>
    00113
    00114 #endif
    00115
    00119 extern WoopsiUI::FrameBuffer* frameBuffer[2];
    00120
    00124 extern WoopsiUI::BitmapWrapper* systemFontBitmap;
    00125 extern WoopsiUI::Font* systemFont;
    00126 extern WoopsiUI::MonoFont* tinyFont;
    00127
    00132 void initWoopsiGfxMode();
    00133
    00137 void woopsiInitFonts();
    00138
    00142 void woopsiFreeFonts();
    00143
    00147 void woopsiFreeFrameBuffers();
    00148
    00152 void woopsiWaitVBL();
    00153
    00158 bool woopsiLidClosed();
    00159
    00165 void woopsiUpdateInput();
    00166
    00173 void woopsiDmaCopy(const u16* source, u16* dest, u32 count);
    00174
    00181 void woopsiDmaFill(u16 fill, u16* dest, u32 count);
    00182
    00183 #endif