mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-05-28 03:02:56 +00:00
Starting IGGY impl
This commit is contained in:
parent
e7dfce35d4
commit
a1f1681ce7
|
|
@ -1106,6 +1106,8 @@ set(Linux
|
|||
"../Platform/Linux/Linux_App.cpp"
|
||||
"../Platform/Linux/LinuxGL.cpp"
|
||||
"../Platform/Linux/linux_game_stubs.cpp"
|
||||
"../Platform/Linux/Iggy/gdraw/gdraw_glfw.c"
|
||||
"../Platform/Linux/Iggy/gdraw/gdraw_glfw.h"
|
||||
)
|
||||
source_group("Linux" FILES ${Linux})
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,13 @@
|
|||
#include "../../../Minecraft.World/Build/stdafx.h"
|
||||
#include "Linux_UIController.h"
|
||||
|
||||
// Temp
|
||||
#include "../../Minecraft.h"
|
||||
#include "../../Textures/Textures.h"
|
||||
|
||||
// GDraw GL backend for Linux
|
||||
#include "Iggy/gdraw/gdraw_glfw.h"
|
||||
|
||||
#define _ENABLEIGGY
|
||||
|
||||
ConsoleUIController ui;
|
||||
|
|
@ -9,46 +16,111 @@ void ConsoleUIController::init(S32 w, S32 h)
|
|||
{
|
||||
#ifdef _ENABLEIGGY
|
||||
// Shared init
|
||||
preInit(w,h);
|
||||
preInit(w, h);
|
||||
|
||||
//init
|
||||
gdraw_funcs = gdraw_GL_CreateContext(w, h, 0);
|
||||
|
||||
if (!gdraw_funcs)
|
||||
{
|
||||
app.DebugPrintf("Failed to initialise GDraw GL!\n");
|
||||
fprintf(stderr, "[Linux_UIController] Failed to initialise GDraw GL!\n");
|
||||
// nott fatal for now
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
gdraw_GL_SetResourceLimits(GDRAW_GL_RESOURCE_vertexbuffer, 5000, 16 * 1024 * 1024);
|
||||
gdraw_GL_SetResourceLimits(GDRAW_GL_RESOURCE_texture, 5000, 128 * 1024 * 1024);
|
||||
gdraw_GL_SetResourceLimits(GDRAW_GL_RESOURCE_rendertarget, 10, 32 * 1024 * 1024);
|
||||
|
||||
IggySetGDraw(gdraw_funcs);
|
||||
}
|
||||
|
||||
postInit();
|
||||
#endif
|
||||
}
|
||||
|
||||
void ConsoleUIController::render()
|
||||
{
|
||||
#ifdef _ENABLEIGGY
|
||||
if (!gdraw_funcs)
|
||||
return;
|
||||
|
||||
gdraw_GL_SetTileOrigin(0, 0, 0);
|
||||
|
||||
// render
|
||||
renderScenes();
|
||||
|
||||
gdraw_GL_NoMoreGDrawThisFrame();
|
||||
#endif
|
||||
}
|
||||
|
||||
void ConsoleUIController::beginIggyCustomDraw4J(IggyCustomDrawCallbackRegion *region, CustomDrawData *customDrawRegion)
|
||||
{
|
||||
|
||||
gdraw_GL_BeginCustomDraw_4J(region, customDrawRegion->mat);
|
||||
}
|
||||
|
||||
CustomDrawData *ConsoleUIController::setupCustomDraw(UIScene *scene, IggyCustomDrawCallbackRegion *region)
|
||||
{
|
||||
return nullptr;
|
||||
CustomDrawData *customDrawRegion = new CustomDrawData();
|
||||
customDrawRegion->x0 = region->x0;
|
||||
customDrawRegion->x1 = region->x1;
|
||||
customDrawRegion->y0 = region->y0;
|
||||
customDrawRegion->y1 = region->y1;
|
||||
|
||||
|
||||
gdraw_GL_BeginCustomDraw_4J(region, customDrawRegion->mat);
|
||||
|
||||
setupCustomDrawGameStateAndMatrices(scene, customDrawRegion);
|
||||
|
||||
return customDrawRegion;
|
||||
}
|
||||
|
||||
CustomDrawData *ConsoleUIController::calculateCustomDraw(IggyCustomDrawCallbackRegion *region)
|
||||
{
|
||||
return nullptr;
|
||||
CustomDrawData *customDrawRegion = new CustomDrawData();
|
||||
customDrawRegion->x0 = region->x0;
|
||||
customDrawRegion->x1 = region->x1;
|
||||
customDrawRegion->y0 = region->y0;
|
||||
customDrawRegion->y1 = region->y1;
|
||||
|
||||
gdraw_GL_CalculateCustomDraw_4J(region, customDrawRegion->mat);
|
||||
|
||||
return customDrawRegion;
|
||||
}
|
||||
|
||||
void ConsoleUIController::endCustomDraw(IggyCustomDrawCallbackRegion *region)
|
||||
{
|
||||
endCustomDrawGameStateAndMatrices();
|
||||
|
||||
gdraw_GL_EndCustomDraw(region);
|
||||
}
|
||||
|
||||
void ConsoleUIController::setTileOrigin(S32 xPos, S32 yPos)
|
||||
{
|
||||
gdraw_GL_SetTileOrigin(xPos, yPos, 0);
|
||||
}
|
||||
|
||||
GDrawTexture *ConsoleUIController::getSubstitutionTexture(int textureId)
|
||||
{
|
||||
// todo impl
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void ConsoleUIController::destroySubstitutionTexture(void *destroyCallBackData, GDrawTexture *handle)
|
||||
{
|
||||
if (handle)
|
||||
gdraw_GL_WrappedTextureDestroy(handle);
|
||||
}
|
||||
|
||||
void ConsoleUIController::shutdown()
|
||||
{
|
||||
#ifdef _ENABLEIGGY
|
||||
if (gdraw_funcs)
|
||||
{
|
||||
gdraw_GL_DestroyContext();
|
||||
gdraw_funcs = nullptr;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
@ -159,4 +159,31 @@ RADEXPFUNC inline void RADEXPLINK IggyLibraryDestroy(IggyLibrary lib) {
|
|||
STUBBED;
|
||||
}
|
||||
|
||||
// Iggy is fake
|
||||
static GDrawFunctions *s_iggy_gdraw_funcs = 0;
|
||||
RADEXPFUNC inline void RADEXPLINK IggySetGDraw(GDrawFunctions *gdraw_funcs) {
|
||||
s_iggy_gdraw_funcs = gdraw_funcs;
|
||||
}
|
||||
|
||||
// Audio stubs
|
||||
RADEXPFUNC inline void RADEXPLINK IggyAudioUseDefault(void) {
|
||||
STUBBED;
|
||||
}
|
||||
|
||||
// Explorer/Perfmon, shit implmentation
|
||||
RADEXPFUNC inline void * RADEXPLINK IggyExpCreate(const char *host, int port, void *storage, int storage_size) {
|
||||
STUBBED;
|
||||
return 0;
|
||||
}
|
||||
RADEXPFUNC inline void RADEXPLINK IggyUseExplorer(Iggy *player, void *explorer) {
|
||||
STUBBED;
|
||||
}
|
||||
RADEXPFUNC inline void * RADEXPLINK IggyPerfmonCreate(void *(*alloc_func)(unsigned long), void (*free_func)(void *), void *user) {
|
||||
STUBBED;
|
||||
return 0;
|
||||
}
|
||||
RADEXPFUNC inline void RADEXPLINK IggyInstallPerfmon(void *perfmon) {
|
||||
STUBBED;
|
||||
}
|
||||
|
||||
#endif // IGGYSTUBS_H
|
||||
Loading…
Reference in a new issue