engine links webgl
authorunc0rr
Wed, 19 Jun 2013 00:52:21 +0400
branchwebgl
changeset 9264 21df1a0ec9ed
parent 9260 64718974158f
child 9267 dbd18257be8f
engine links
hedgewars/uPhysFSLayer.pas
hedgewars/uRender.pas
hedgewars/uScript.pas
misc/libphyslayer/hwpacksmounter.h
project_files/hwc/CMakeLists.txt
project_files/hwc/rtl/fpcrtl.h
--- a/hedgewars/uPhysFSLayer.pas	Wed Jun 19 00:19:33 2013 +0400
+++ b/hedgewars/uPhysFSLayer.pas	Wed Jun 19 00:52:21 2013 +0400
@@ -29,11 +29,11 @@
 
 function pfsExists(fname: shortstring): boolean;
 
-{ $IFNDEF PAS2C}
+{$IFNDEF PAS2C}
 function  physfsReader(L: Plua_State; f: PFSFile; sz: Psize_t) : PChar; cdecl; external PhyslayerLibName;
 procedure physfsReaderSetBuffer(buf: pointer); cdecl; external PhyslayerLibName;
 procedure hedgewarsMountPackage(filename: PChar); cdecl; external PhyslayerLibName;
-{ $ENDIF}
+{$ENDIF}
 
 implementation
 uses uUtils, uVariables;
--- a/hedgewars/uRender.pas	Wed Jun 19 00:19:33 2013 +0400
+++ b/hedgewars/uRender.pas	Wed Jun 19 00:52:21 2013 +0400
@@ -144,63 +144,6 @@
 glDrawArrays(GL_TRIANGLE_FAN, 0, High(VertexBuffer) - Low(VertexBuffer) + 1);
 end;
 
-
-procedure DrawTextureFromRectDir(X, Y, W, H: LongInt; r: PSDL_Rect; SourceTexture: PTexture);
-var
-    rr: TSDL_Rect;
-    VertexBuffer, TextureBuffer: array [0..3] of TVertex2f;
-    //VertexBuffer, TextureBuffer: TVertexRect;
-    _l, _r, _t, _b: GLfloat;
-begin
-if (SourceTexture^.h = 0) or (SourceTexture^.w = 0) then
-    exit;
-
-// do not draw anything outside the visible screen space (first check fixes some sprite drawing, e.g. hedgehogs)
-if (abs(X) > W) and ((abs(X + W / 2) - W / 2) > cScreenWidth / cScaleFactor) then
-    exit;
-if (abs(Y) > H) and ((abs(Y + H / 2 - (0.5 * cScreenHeight)) - H / 2) > cScreenHeight / cScaleFactor) then
-    exit;
-
-rr.x:= X;
-rr.y:= Y;
-rr.w:= W;
-rr.h:= H;
-
-_l:= r^.x / SourceTexture^.w * SourceTexture^.rx;
-_r:= (r^.x + r^.w) / SourceTexture^.w * SourceTexture^.rx;
-_t:= r^.y / SourceTexture^.h * SourceTexture^.ry;
-_b:= (r^.y + r^.h) / SourceTexture^.h * SourceTexture^.ry;
-
-glBindTexture(GL_TEXTURE_2D, SourceTexture^.id);
-
-VertexBuffer[0].X:= X;
-VertexBuffer[0].Y:= Y;
-VertexBuffer[1].X:= rr.w + X;
-VertexBuffer[1].Y:= Y;
-VertexBuffer[2].X:= rr.w + X;
-VertexBuffer[2].Y:= rr.h + Y;
-VertexBuffer[3].X:= X;
-VertexBuffer[3].Y:= rr.h + Y;
-
-TextureBuffer[0].X:= _l;
-TextureBuffer[0].Y:= _t;
-TextureBuffer[1].X:= _r;
-TextureBuffer[1].Y:= _t;
-TextureBuffer[2].X:= _r;
-TextureBuffer[2].Y:= _b;
-TextureBuffer[3].X:= _l;
-TextureBuffer[3].Y:= _b;
-
-SetVertexPointer(@VertexBuffer[0], Length(VertexBuffer));
-SetTexCoordPointer(@TextureBuffer[0], Length(VertexBuffer));
-
-{$IFDEF GL2}
-UpdateModelviewProjection;
-{$ENDIF}
-
-glDrawArrays(GL_TRIANGLE_FAN, 0, Length(VertexBuffer));
-end;
-
 procedure DrawTexture(X, Y: LongInt; Texture: PTexture); inline;
 begin
     DrawTexture(X, Y, Texture, 1.0);
--- a/hedgewars/uScript.pas	Wed Jun 19 00:19:33 2013 +0400
+++ b/hedgewars/uScript.pas	Wed Jun 19 00:52:21 2013 +0400
@@ -85,6 +85,7 @@
     SysUtils,
     uIO,
     uPhysFSLayer
+{$IFDEF PAS2C}, hwpacksmounter{$ENDIF}
     ;
 
 var luaState : Plua_State;
--- a/misc/libphyslayer/hwpacksmounter.h	Wed Jun 19 00:19:33 2013 +0400
+++ b/misc/libphyslayer/hwpacksmounter.h	Wed Jun 19 00:52:21 2013 +0400
@@ -3,6 +3,10 @@
 
 #include "physfs.h"
 
+#ifndef STRINIT
+#include "lua.h"
+#endif
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -10,6 +14,9 @@
 PHYSFS_DECL void hedgewarsMountPackages();
 PHYSFS_DECL void hedgewarsMountPackage(char * fileName);
 
+PHYSFS_DECL const char * physfsReader(lua_State *L, PHYSFS_File *f, size_t *size);
+PHYSFS_DECL void physfsReaderSetBuffer(void *buffer);
+
 #ifdef __cplusplus
 }
 #endif
--- a/project_files/hwc/CMakeLists.txt	Wed Jun 19 00:19:33 2013 +0400
+++ b/project_files/hwc/CMakeLists.txt	Wed Jun 19 00:52:21 2013 +0400
@@ -10,6 +10,8 @@
 #compile our rtl implementation
 include_directories(${GLEW_INCLUDE_DIR})
 include_directories(${CMAKE_CURRENT_SOURCE_DIR}/rtl)
+include_directories(${PHYSFS_INCLUDE_DIR})
+include_directories(${PHYSLAYER_INCLUDE_DIR})
 add_subdirectory(rtl)
 
 configure_file(${CMAKE_SOURCE_DIR}/hedgewars/config.inc.in ${CMAKE_CURRENT_BINARY_DIR}/config.inc)
--- a/project_files/hwc/rtl/fpcrtl.h	Wed Jun 19 00:19:33 2013 +0400
+++ b/project_files/hwc/rtl/fpcrtl.h	Wed Jun 19 00:52:21 2013 +0400
@@ -63,6 +63,7 @@
 #define luapas_luaopen_math                 luaopen_math
 #define luapas_luaopen_string               luaopen_string
 #define luapas_luaopen_table                luaopen_table
+#define luapas_lua_load                     lua_load
 
 #define sdlh_IMG_Load                       IMG_Load
 #define sdlh_IMG_Load_RW                    IMG_Load_RW