mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-01-30 03:55:40 +00:00
Added missing new files to the repo.
This commit is contained in:
parent
e17499c9b3
commit
7795dd729d
18
Makefile.x86
Normal file
18
Makefile.x86
Normal file
|
@ -0,0 +1,18 @@
|
|||
CC=g++
|
||||
CFLAGS=-c -Wall -I/usr/include/freetype2 -I/usr/include/SDL -I/usr/include -D_DESKTOP_
|
||||
LDFLAGS=-lGL -lfreetype -lSDL -lboost_system -lboost_filesystem -lfreeimage
|
||||
SRCSOURCES=main.cpp Renderer.cpp Renderer_init.cpp Font.cpp Renderer_draw_gl.cpp GuiComponent.cpp InputManager.cpp SystemData.cpp GameData.cpp FolderData.cpp XMLReader.cpp MathExp.cpp components/GuiGameList.cpp components/GuiInputConfig.cpp components/GuiImage.cpp components/GuiMenu.cpp components/GuiTheme.cpp pugiXML/pugixml.cpp
|
||||
SOURCES=$(addprefix src/,$(SRCSOURCES))
|
||||
OBJECTS=$(SOURCES:.cpp=.o)
|
||||
EXECUTABLE=emulationstation
|
||||
|
||||
all: $(SOURCES) $(EXECUTABLE)
|
||||
|
||||
$(EXECUTABLE): $(OBJECTS)
|
||||
$(CC) $(OBJECTS) $(LDFLAGS) -o $@
|
||||
|
||||
.cpp.o:
|
||||
$(CC) $(CFLAGS) $< -o $@
|
||||
|
||||
clean:
|
||||
rm -rf src/*o src/components/*o $(EXECUTABLE)
|
9
src/Renderer_init.cpp
Normal file
9
src/Renderer_init.cpp
Normal file
|
@ -0,0 +1,9 @@
|
|||
#include "platform.h"
|
||||
|
||||
#ifdef _RPI_
|
||||
#include "Renderer_init_rpi.cpp"
|
||||
#endif
|
||||
|
||||
#ifdef _DESKTOP_
|
||||
#include "Renderer_init_sdlgl.cpp"
|
||||
#endif
|
92
src/Renderer_init_sdlgl.cpp
Normal file
92
src/Renderer_init_sdlgl.cpp
Normal file
|
@ -0,0 +1,92 @@
|
|||
#include "Renderer.h"
|
||||
#include <iostream>
|
||||
#include "platform.h"
|
||||
#include GLHEADER
|
||||
#include "Font.h"
|
||||
#include <SDL/SDL.h>
|
||||
|
||||
namespace Renderer
|
||||
{
|
||||
unsigned int display_width = 0, display_height = 0;
|
||||
|
||||
SDL_Surface* sdlScreen = NULL;
|
||||
|
||||
bool createSurface() //unsigned int display_width, unsigned int display_height)
|
||||
{
|
||||
std::cout << "Creating surface...\n";
|
||||
|
||||
if(SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK) != 0)
|
||||
{
|
||||
std::cerr << "Error initializing SDL!\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
|
||||
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
|
||||
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
|
||||
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
|
||||
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
|
||||
sdlScreen = SDL_SetVideoMode(display_width, display_height, 16, SDL_OPENGL | SDL_FULLSCREEN);
|
||||
|
||||
if(sdlScreen == NULL)
|
||||
{
|
||||
std::cout << "Error creating SDL video surface!\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
//usually display width/height are not specified, i.e. zero, which SDL automatically takes as "native resolution"
|
||||
//so, since other things rely on the size of the screen (damn currently unnormalized coordinate system), we set it here
|
||||
//even though the system was already initialized
|
||||
display_width = sdlScreen->w;
|
||||
display_height = sdlScreen->h;
|
||||
|
||||
std::cout << "Success!\n";
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void swapBuffers()
|
||||
{
|
||||
SDL_GL_SwapBuffers();
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
}
|
||||
|
||||
void destroySurface()
|
||||
{
|
||||
SDL_FreeSurface(sdlScreen);
|
||||
sdlScreen = NULL;
|
||||
SDL_Quit();
|
||||
}
|
||||
|
||||
bool init(int w, int h)
|
||||
{
|
||||
if(w)
|
||||
display_width = w;
|
||||
if(h)
|
||||
display_height = h;
|
||||
|
||||
bool createdSurface = createSurface();
|
||||
|
||||
if(!createdSurface)
|
||||
return false;
|
||||
|
||||
Font::initLibrary();
|
||||
|
||||
glViewport(0, 0, display_width, display_height);
|
||||
glOrtho(0, display_width, display_height, 0, -1.0, 1.0);
|
||||
glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
|
||||
onInit();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void unloadFonts(); //defined in Renderer_draw_gl.cpp
|
||||
void deinit()
|
||||
{
|
||||
onDeinit();
|
||||
|
||||
unloadFonts();
|
||||
destroySurface();
|
||||
}
|
||||
};
|
13
src/platform.h
Normal file
13
src/platform.h
Normal file
|
@ -0,0 +1,13 @@
|
|||
//the Makefiles define these via command line
|
||||
//#define _RPI_
|
||||
//#define _DESKTOP_
|
||||
|
||||
|
||||
#ifdef _RPI_
|
||||
#define GLHEADER <GLES/gl.h>
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _DESKTOP_
|
||||
#define GLHEADER <GL/gl.h>
|
||||
#endif
|
Loading…
Reference in a new issue