The Spider Mastermind
Member
Theres multiple things wrong here I'm sure, and its causing me to get a distinct disliking for C++/SDL. Is there no easier way to write out some goddamn text????? I imagine once this works, I'd have a frame for a text-writing function, but alas, the text is not shown, nor do the button captures work, which makes me think its hitting a wall somewhere.
It compiles fine, and I do have arial.ttf in the same folder as the .gpe(root of sd).
Anyone willing to help poor old higher-level-language-based me?
Edit: Why is the topic description "< br />"?
It compiles fine, and I do have arial.ttf in the same folder as the .gpe(root of sd).
Code:
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include "SDL.h"
#include "SDL_TTF.h"
#define SCREEN_WIDTH 320
#define SCREEN_HEIGHT 240
#define SCREEN_DEPTH 8
using namespace std;
int main(int argc, char *argv[])
{
SDL_Surface *screen;
SDL_Joystick *joystick;
TTF_Font *font = TTF_OpenFont( "arial.ttf", 12 );
SDL_Color color = { 255,255,255,255 };
int done=0;
SDL_Event event;
/* Initialize SDL */
SDL_Init(SDL_INIT_VIDEO);
joystick = SDL_JoystickOpen(0);
/* Initialize the screen / window */
screen = SDL_SetVideoMode(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_DEPTH, SDL_SWSURFACE);
SDL_ShowCursor(SDL_DISABLE);
screen=TTF_RenderText_Solid(font,"Hello World!", color);
SDL_Flip(screen);
SDL_PollEvent(&event);
while (!done)
{
SDL_WaitEvent(&event);
switch (event.type)
{
case SDL_JOYBUTTONDOWN:
done = 1;
break;
}
}
SDL_Quit();
chdir("/usr/gp2x");
execl("/usr/gp2x/gp2xmenu", "/usr/gp2x/gp2xmenu", NULL);
return 0;
}
Anyone willing to help poor old higher-level-language-based me?
Edit: Why is the topic description "< br />"?