1 /* 2 * OpenBOR - http://www.LavaLit.com 3 * ----------------------------------------------------------------------- 4 * Licensed under the BSD license, see LICENSE in OpenBOR root for details. 5 * 6 * Copyright (c) 2004 - 2011 OpenBOR Team 7 */ 8 9 #ifndef __GRAPHICS_H__ 10 #define __GRAPHICS_H__ 11 12 #include <psptypes.h> 13 #include "types.h" 14 #include "image.h" 15 16 typedef struct{ 17 char name[16]; 18 int left; 19 int top; 20 int width; 21 int height; 22 }DisplayFormat; 23 24 #define A(color) ((u8)(color >> 24 & 0x000000FF)) 25 #define B(color) ((u8)(color >> 16 & 0x000000FF)) 26 #define G(color) ((u8)(color >> 8 & 0x000000FF)) 27 #define R(color) ((u8)(color & 0x000000FF)) 28 #define RGB(r,g,b) ((r) | ((g) << 8) | ((b) << 16)) 29 #define BLACK RGB(0x00, 0x00, 0x00) 30 #define WHITE RGB(0xFF, 0xFF, 0xFF) 31 #define RED RGB(0xFF, 0x00, 0x00) 32 #define GREEN RGB(0x00, 0xFF, 0x00) 33 #define BLUE RGB(0x00, 0x00, 0xFF) 34 #define YELLOW RGB(0xFF, 0xFF, 0x00) 35 #define PURPLE RGB(0xFF, 0x00, 0xFF) 36 #define ORANGE RGB(0xFF, 0x80, 0x00) 37 #define GRAY RGB(0x70, 0x80, 0x90) 38 #define LIGHT_GRAY RGB(0xDF, 0xDF, 0xDF) 39 #define DARK_GRAY RGB(0x52, 0x52, 0x51) 40 #define DARK_YELLOW RGB(0xF1, 0xB5, 0x43) 41 #define DARK_RED RGB(0x80, 0x00, 0x00) 42 #define DARK_GREEN RGB(0x00, 0x80, 0x00) 43 #define DARK_BLUE RGB(0x00, 0x00, 0x80) 44 45 #define PSP_LCD_WIDTH 480 46 #define PSP_LCD_HEIGHT 272 47 #define PSP_DISPLAY_MODES 4 48 #define PSP_DISPLAY_FILTERS 2 49 #define PSP_DISPLAY_FORMATS 4 50 51 unsigned int __attribute__((aligned(16))) palette[256]; 52 extern char* displayName[PSP_DISPLAY_MODES]; 53 extern int displayMode; 54 extern char* filterName[PSP_DISPLAY_FILTERS]; 55 extern DisplayFormat displayFormat[PSP_DISPLAY_FORMATS]; 56 57 void initGraphics(int mode, int pixel); 58 void disableGraphics(); 59 void guStart(); 60 void clearScreen(Color color); 61 void flipScreen(); 62 void setGraphicsScreen(DisplayFormat display, int pixel, int filter); 63 void setGraphicsTVOverScan(int left, int top, int right, int bottom); 64 void setGraphicsTVAspectRatio(int ar); 65 void blitAlphaImageToScreen(int sx, int sy, int width, int height, Image* source, int dx, int dy); 66 void blitImageToScreen(int sx, int sy, int width, int height, Image* source, int dx, int dy); 67 void blitScreenToScreen(int width, int height, s_screen* source); 68 void printText(Image* source, int x,int y,int col,int backcol,int fill,char *format, ...); 69 int pspSlimModel(); 70 71 #endif 72