JustJoekingEX
Still Fresh
- Joined
- Aug 28, 2009
- Messages
- 5
I have the following code fragment which I compiled for the wiz using xp 64 sp2, and for some reason it worked right the first time , however now
it seems like i can only blit images on row 1. using any bitmap the image appears but its blitting at 10,0 instead of 10,20.
i am using SDL.a to link from the gp2x wiz libs and using no linker options. (compiler is mingw), any ideas?
it seems like i can only blit images on row 1. using any bitmap the image appears but its blitting at 10,0 instead of 10,20.
i am using SDL.a to link from the gp2x wiz libs and using no linker options. (compiler is mingw), any ideas?
Code:
#define DWORD unsigned int
#if __GP2XWIZ__
#define VK_ACTIVATED SDL_JOYBUTTONDOWN
#define VK_DEACTIVATED SDL_JOYBUTTONUP
#define INPUT_EVT jbutton.button
#define VK_UP GP2X_BUTTON_UP
#define VK_DOWN GP2X_BUTTON_DOWN
#define VK_LEFT GP2X_BUTTON_LEFT
#define VK_RIGHT GP2X_BUTTON_RIGHT
#define VK_UPLEFT GP2X_BUTTON_UPLEFT
#define VK_UPRIGHT GP2X_BUTTON_UPRIGHT
#define VK_DOWNLEFT GP2X_BUTTON_DOWNLEFT
#define VK_DOWNRIGHT GP2X_BUTTON_DOWNRIGHT
#define VK_CLICK GP2X_BUTTON_CLICK
#define VK_ACTION2 GP2X_BUTTON_A
#define VK_ACTION4 GP2X_BUTTON_B
#define VK_ACTION3 GP2X_BUTTON_X
#define VK_ACTION1 GP2X_BUTTON_Y
#define VK_SHOULDER_LEFT GP2X_BUTTON_L
#define VK_SHOULDER_RIGHT GP2X_BUTTON_R
#define VK_START GP2X_BUTTON_START
#define VK_SELECT GP2X_BUTTON_SELECT
#define VK_VOLUP GP2X_BUTTON_VOLUP
#define VK_VOLDOWN GP2X_BUTTON_VOLDOWN
#else
#define VK_ACTIVATED SDL_KEYDOWN
#define VK_DEACTIVATED SDL_KEYUP
#define INPUT_EVT key.keysym.sym
#define VK_UP SDLK_UP
#define VK_DOWN SDLK_DOWN
#define VK_LEFT SDLK_LEFT
#define VK_RIGHT SDLK_RIGHT
#define VK_UPLEFT -1
#define VK_UPRIGHT -1
#include <stdlib.h>
#include <SDL.h>
#include <SDL_video.h>
#define VK_DOWNLEFT -1
#define VK_DOWNRIGHT -1
#define VK_CLICK -1
#define VK_ACTION2 SDLK_a
#define VK_ACTION4 SDLK_d
#define VK_ACTION3 SDLK_s
#define VK_ACTION1 SDLK_w
#define VK_SHOULDER_LEFT SDLK_INSERT
#define VK_SHOULDER_RIGHT SDLK_PAGEUP
#define VK_START SDLK_DELETE
#define VK_SELECT SDLK_PAGEDOWN
#define VK_VOLUP SDLK_PLUS
#define VK_VOLDOWN SDLK_MINUS
#endif
using namespace std ;
const int SCREEN_WIDTH = 320;
const int SCREEN_HEIGHT = 240;
const int SCREEN_BPP = 16;
//The event structure that will be used
SDL_Event event;
bool quit = false;
int main(int argc, char** argv) {
SDL_Surface *screen;
SDL_Surface *bmp;
SDL_Rect targetarea;
/* Initialize SDL */
SDL_Init(SDL_INIT_VIDEO);
/* Initialize the screen / window */
screen = SDL_SetVideoMode(SCREEN_WIDTH, SCREEN_HEIGHT, 8, SDL_SWSURFACE);
/* Load test.bmp */
bmp = SDL_LoadBMP("test.bmp");
/* Draw the image to 10, 20 */
targetarea.x = 10;
targetarea.y = 30;
targetarea.w = bmp->w;
targetarea.h = bmp->h;
SDL_BlitSurface(bmp, NULL, screen, &targetarea);
/* update the screen (aka double buffering) */
SDL_Flip(screen);
SDL_Delay(1000);
chdir("/usr/gp2x");
execl("/usr/gp2x/gp2xmenu", "/usr/gp2x/gp2xmenu", NULL);
return (0);
}