Compare commits
6 Commits
RCBasic4-A
...
sdl2_ogles
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ac30b0f7bb | ||
|
|
370c2bed33 | ||
|
|
73fb1bded8 | ||
|
|
a08ab8760c | ||
|
|
b66e458590 | ||
|
|
bffa478064 |
@@ -1 +1 @@
|
||||
,n00b,fedora,23.10.2024 22:46,file:///home/n00b/.config/libreoffice/4;
|
||||
,n00b,fedora,13.11.2024 20:17,file:///home/n00b/.config/libreoffice/4;
|
||||
Binary file not shown.
114
rcbasic_runtime/em_setup.sh
Executable file
114
rcbasic_runtime/em_setup.sh
Executable file
@@ -0,0 +1,114 @@
|
||||
#!/bin/bash
|
||||
|
||||
export PROG_LOCATION=/home/n00b/projects/rcbasic_alpha3/test_project
|
||||
export OUT_HTML=/home/n00b/projects/rc_em/output/test.html
|
||||
|
||||
export EMSDK_PATH=/home/n00b/Programs/emsdk
|
||||
|
||||
export THEORA_LIB=/home/n00b/Projects/rc_em/libtheora-1.1.1/out/lib
|
||||
export THEORA_INCLUDE=/home/n00b/Projects/rc_em/libtheora-1.1.1/out/include
|
||||
|
||||
export IRR_LIB=/home/n00b/Projects/RCIrrlicht/lib/emscripten
|
||||
export IRR_INCLUDE=/home/n00b/Projects/RCIrrlicht/include
|
||||
|
||||
export BULLET_LINKER_LIBS="
|
||||
-L/home/n00b/Projects/bullet3/em_build/src/Bullet3Collision
|
||||
-L/home/n00b/Projects/bullet3/em_build/src/Bullet3Common
|
||||
-L/home/n00b/Projects/bullet3/em_build/src/Bullet3Dynamics
|
||||
-L/home/n00b/Projects/bullet3/em_build/src/Bullet3Geometry
|
||||
-L/home/n00b/Projects/bullet3/em_build/src/Bullet3OpenCL
|
||||
-L/home/n00b/Projects/bullet3/em_build/src/Bullet3Serialize
|
||||
-L/home/n00b/Projects/bullet3/em_build/src/BulletCollision
|
||||
-L/home/n00b/Projects/bullet3/em_build/src/BulletDynamics
|
||||
-L/home/n00b/Projects/bullet3/em_build/src/BulletInverseDynamics
|
||||
-L/home/n00b/Projects/bullet3/em_build/src/BulletSoftBody
|
||||
-L/home/n00b/Projects/bullet3/em_build/src/LinearMath
|
||||
"
|
||||
export BULLET_INCLUDE=/home/n00b/Projects/bullet3/em_build/include
|
||||
export BULLET_INCLUDE_LOCAL=/home/n00b/Projects/bullet3/em_build/include/bullet
|
||||
|
||||
export IRR_BULLET_SRC_DIR=/home/n00b/Projects/irrBullet/src
|
||||
|
||||
# export IRR_BULLET_SRC=
|
||||
|
||||
export IRR_BULLET_INCLUDE=/home/n00b/Projects/irrBullet/include
|
||||
|
||||
export IRR_THEORA_INCLUDE=/home/n00b/Projects/irrTheora
|
||||
|
||||
export AN8_INCLUDE=/home/n00b/Projects/an8-parser
|
||||
|
||||
export BOX2D_LIB=/home/n00b/Projects/box2d-2.4.2/box2d-2.4.2/em_build/bin
|
||||
export BOX2D_INCLUDE=/home/n00b/Projects/box2d-2.4.2/box2d-2.4.2/include
|
||||
|
||||
|
||||
em++ main.cpp \
|
||||
theoraplay.c \
|
||||
gui_freetype_font.cpp \
|
||||
$IRR_BULLET_SRC_DIR/irrBulletBoxShape.cpp \
|
||||
$IRR_BULLET_SRC_DIR/irrBulletBvhTriangleMeshShape.cpp \
|
||||
$IRR_BULLET_SRC_DIR/irrBulletCapsuleShape.cpp \
|
||||
$IRR_BULLET_SRC_DIR/irrBulletCollisionCallBackInformation.cpp \
|
||||
$IRR_BULLET_SRC_DIR/irrBulletCollisionObjectAffectorAttract.cpp \
|
||||
$IRR_BULLET_SRC_DIR/irrBulletCollisionObjectAffector.cpp \
|
||||
$IRR_BULLET_SRC_DIR/irrBulletCollisionObjectAffectorDelete.cpp \
|
||||
$IRR_BULLET_SRC_DIR/irrBulletCollisionObject.cpp \
|
||||
$IRR_BULLET_SRC_DIR/irrBulletCollisionShape.cpp \
|
||||
$IRR_BULLET_SRC_DIR/irrBulletcommon.cpp \
|
||||
$IRR_BULLET_SRC_DIR/irrBulletConeShape.cpp \
|
||||
$IRR_BULLET_SRC_DIR/irrBulletConvexHullShape.cpp \
|
||||
$IRR_BULLET_SRC_DIR/irrBullet.cpp \
|
||||
$IRR_BULLET_SRC_DIR/irrBulletCylinderShape.cpp \
|
||||
$IRR_BULLET_SRC_DIR/irrBulletGhostObject.cpp \
|
||||
$IRR_BULLET_SRC_DIR/irrBulletGImpactMeshShape.cpp \
|
||||
$IRR_BULLET_SRC_DIR/irrBulletLiquidBody.cpp \
|
||||
$IRR_BULLET_SRC_DIR/irrBulletMotionState.cpp \
|
||||
$IRR_BULLET_SRC_DIR/irrBulletPhysicsDebug.cpp \
|
||||
$IRR_BULLET_SRC_DIR/irrBulletRayCastVehicle.cpp \
|
||||
$IRR_BULLET_SRC_DIR/irrBulletRigidBody.cpp \
|
||||
$IRR_BULLET_SRC_DIR/irrBulletSoftBody.cpp \
|
||||
$IRR_BULLET_SRC_DIR/irrBulletSphereShape.cpp \
|
||||
$IRR_BULLET_SRC_DIR/irrBulletTriangleMeshShape.cpp \
|
||||
$IRR_BULLET_SRC_DIR/irrBulletWorld.cpp \
|
||||
"-I$IRR_BULLET_INCLUDE" \
|
||||
"-L$THEORA_LIB" \
|
||||
"-I$THEORA_INCLUDE" \
|
||||
"-L$IRR_LIB" \
|
||||
"-I$IRR_INCLUDE" \
|
||||
"$IRR_LIB/libIrrlicht.a" \
|
||||
"-I$BULLET_INCLUDE" \
|
||||
"-I$BULLET_INCLUDE_LOCAL" \
|
||||
-L/home/n00b/Projects/bullet3/em_build/src/Bullet3Collision \
|
||||
-L/home/n00b/Projects/bullet3/em_build/src/Bullet3Common \
|
||||
-L/home/n00b/Projects/bullet3/em_build/src/Bullet3Dynamics \
|
||||
-L/home/n00b/Projects/bullet3/em_build/src/Bullet3Geometry \
|
||||
-L/home/n00b/Projects/bullet3/em_build/src/Bullet3OpenCL \
|
||||
-L/home/n00b/Projects/bullet3/em_build/src/Bullet3Serialize \
|
||||
-L/home/n00b/Projects/bullet3/em_build/src/BulletCollision \
|
||||
-L/home/n00b/Projects/bullet3/em_build/src/BulletDynamics \
|
||||
-L/home/n00b/Projects/bullet3/em_build/src/BulletInverseDynamics \
|
||||
-L/home/n00b/Projects/bullet3/em_build/src/BulletSoftBody \
|
||||
-L/home/n00b/Projects/bullet3/em_build/src/LinearMath \
|
||||
-lBullet3Collision -lBullet3Common -lBullet3Dynamics -lBullet3Geometry -lBulletCollision -lBulletDynamics -lBulletInverseDynamics -lBulletSoftBody -lLinearMath \
|
||||
"-I$IRR_THEORA_INCLUDE" \
|
||||
"-I$AN8_INCLUDE" \
|
||||
"-L$BOX2D_LIB" \
|
||||
"-I$BOX2D_INCLUDE" \
|
||||
-lbox2d \
|
||||
--use-port=freetype \
|
||||
-s FULL_ES2=1 \
|
||||
-s USE_SDL=2 -s USE_SDL_IMAGE=2 -s USE_SDL_MIXER=2 -s USE_SDL_NET=2 -s USE_OGG=1 -s USE_VORBIS=1 -ltheora -ltheoradec -o "$OUT_HTML" --preload-file $PROG_LOCATION@ -O3 -s ASYNCIFY -s SDL2_IMAGE_FORMATS='["bmp","png","xpm"]' --use-preload-plugins -s TOTAL_MEMORY=134217728 -s ALLOW_MEMORY_GROWTH=1 -s MAXIMUM_MEMORY=1073741824
|
||||
|
||||
|
||||
# --use-port=bullet \
|
||||
|
||||
# -L/home/n00b/Projects/bullet3/em_build/src/Bullet3Collision \
|
||||
# -L/home/n00b/Projects/bullet3/em_build/src/Bullet3Common \
|
||||
# -L/home/n00b/Projects/bullet3/em_build/src/Bullet3Dynamics \
|
||||
# -L/home/n00b/Projects/bullet3/em_build/src/Bullet3Geometry \
|
||||
# -L/home/n00b/Projects/bullet3/em_build/src/Bullet3OpenCL \
|
||||
# -L/home/n00b/Projects/bullet3/em_build/src/Bullet3Serialize \
|
||||
# -L/home/n00b/Projects/bullet3/em_build/src/BulletCollision \
|
||||
# -L/home/n00b/Projects/bullet3/em_build/src/BulletDynamics \
|
||||
# -L/home/n00b/Projects/bullet3/em_build/src/BulletInverseDynamics \
|
||||
# -L/home/n00b/Projects/bullet3/em_build/src/BulletSoftBody \
|
||||
# -L/home/n00b/Projects/bullet3/em_build/src/LinearMath \
|
||||
@@ -4349,11 +4349,7 @@ void rcbasic_test()
|
||||
SDL_DestroyWindow(win);
|
||||
}
|
||||
|
||||
#ifdef RC_ANDROID
|
||||
void android_main( android_app* application )
|
||||
{
|
||||
}
|
||||
#else
|
||||
|
||||
int main(int argc, char * argv[])
|
||||
{
|
||||
//rcbasic_test();
|
||||
@@ -4450,6 +4446,11 @@ int main(int argc, char * argv[])
|
||||
rc_filename = "main.cbc";
|
||||
#endif
|
||||
|
||||
//ogles2 test
|
||||
rc_intern_dirChange("/home/n00b/projects/rcbasic_alpha3/test_project");
|
||||
rc_filename = "main.cbc";
|
||||
//---------------
|
||||
|
||||
if(rcbasic_load(rc_filename))
|
||||
{
|
||||
#ifdef RCBASIC_DEBUG
|
||||
@@ -4482,4 +4483,3 @@ int main(int argc, char * argv[])
|
||||
//cout << "Hello world!" << endl;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -218,6 +218,7 @@ bool rc_gfx_init()
|
||||
}
|
||||
}
|
||||
SDL_SetHint("SDL_JOYSTICK_ALLOW_BACKGROUND_EVENTS", "1");
|
||||
SDL_SetHint("SDL_HINT_EMSCRIPTEN_ASYNCIFY", "1");
|
||||
|
||||
return true;
|
||||
|
||||
@@ -269,7 +270,11 @@ bool rc_windowOpenEx(std::string title, int x, int y, int w, int h, uint32_t win
|
||||
|
||||
SIrrlichtCreationParameters irr_creation_params;
|
||||
irr_creation_params.DeviceType = EIDT_SDL;
|
||||
#if defined(RC_DRIVER_GLES2)
|
||||
irr_creation_params.DriverType = video::EDT_OGLES2;
|
||||
#else
|
||||
irr_creation_params.DriverType = video::EDT_OPENGL;
|
||||
#endif // defined
|
||||
irr_creation_params.WindowId = rc_window;
|
||||
irr_creation_params.WindowSize = dimension2d<u32>((u32)w, (u32)h);
|
||||
irr_creation_params.Bits = 16;
|
||||
@@ -279,6 +284,7 @@ bool rc_windowOpenEx(std::string title, int x, int y, int w, int h, uint32_t win
|
||||
irr_creation_params.EventReceiver = 0;
|
||||
irr_creation_params.WindowPosition = position2d<s32>(x, y);
|
||||
irr_creation_params.AntiAlias = AntiAlias;
|
||||
irr_creation_params.OGLES2ShaderPath = "media/Shaders/";
|
||||
|
||||
device = createDeviceEx(irr_creation_params);
|
||||
|
||||
@@ -299,12 +305,23 @@ bool rc_windowOpenEx(std::string title, int x, int y, int w, int h, uint32_t win
|
||||
rc_font.clear();
|
||||
|
||||
rc_canvas_obj back_buffer;
|
||||
//std::cout << std::endl << "back start" << std::endl;
|
||||
#ifdef RC_WEB
|
||||
Uint32 size_n = 2;
|
||||
Uint32 dim_max = (w > h ? w : h);
|
||||
while(size_n < dim_max) size_n *= 2;
|
||||
back_buffer.texture = VideoDriver->addRenderTargetTexture(irr::core::dimension2d<irr::u32>((irr::u32)size_n, (irr::u32)size_n), "rt", ECF_A8R8G8B8);
|
||||
#else
|
||||
back_buffer.texture = VideoDriver->addRenderTargetTexture(irr::core::dimension2d<irr::u32>((irr::u32)w, (irr::u32)h), "rt", ECF_A8R8G8B8);
|
||||
#endif // RC_WEB
|
||||
//std::cout << "back_buffer done" << std::endl << std::endl;
|
||||
back_buffer.dimension.Width = w;
|
||||
back_buffer.dimension.Height = h;
|
||||
back_buffer.viewport.position.set(0,0);
|
||||
back_buffer.viewport.dimension.set(w,h);
|
||||
//std::cout << std::endl << "tgt start" << std::endl;
|
||||
VideoDriver->setRenderTarget(back_buffer.texture, true, true);
|
||||
//std::cout << "tgt done" << std::endl << std::endl;
|
||||
rc_canvas.push_back(back_buffer);
|
||||
|
||||
rc_physics3D.world = createIrrBulletWorld(device, true, false);
|
||||
@@ -876,7 +893,14 @@ int rc_canvasOpen(int w, int h, int vx, int vy, int vw, int vh, int mode, int ca
|
||||
canvas.show3D = false;
|
||||
canvas.physics2D.enabled = false;
|
||||
|
||||
#ifdef RC_WEB
|
||||
Uint32 size_n = 2;
|
||||
Uint32 dim_max = (w > h ? w : h);
|
||||
while(size_n < dim_max) size_n *= 2;
|
||||
canvas.texture = VideoDriver->addRenderTargetTexture(irr::core::dimension2d<u32>(size_n,size_n), "rt", ECF_A8R8G8B8);
|
||||
#else
|
||||
canvas.texture = VideoDriver->addRenderTargetTexture(irr::core::dimension2d<u32>(w,h), "rt", ECF_A8R8G8B8);
|
||||
#endif // RC_WEB
|
||||
//canvas.sprite_layer = VideoDriver->addRenderTargetTexture(irr::core::dimension2d<u32>(w,h), "rt", ECF_A8R8G8B8);
|
||||
|
||||
if(!canvas.texture)
|
||||
@@ -1827,6 +1851,7 @@ int rc_inKey()
|
||||
|
||||
int rc_key(int check_Key)
|
||||
{
|
||||
keyState = SDL_GetKeyboardState(NULL);
|
||||
return keyState[SDL_GetScancodeFromKey(check_Key)];
|
||||
}
|
||||
|
||||
@@ -3363,7 +3388,7 @@ bool rc_update()
|
||||
irrevent.UserEvent.UserData1 = reinterpret_cast<uintptr_t>(SDL_event.user.data1);
|
||||
irrevent.UserEvent.UserData2 = reinterpret_cast<uintptr_t>(SDL_event.user.data2);
|
||||
|
||||
device->postEventFromUser(irrevent);
|
||||
//device->postEventFromUser(irrevent);
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -3372,16 +3397,19 @@ bool rc_update()
|
||||
|
||||
} // end while
|
||||
|
||||
|
||||
if(!Close)
|
||||
{
|
||||
irrtheora::updateVideo();
|
||||
|
||||
VideoDriver->setRenderTarget(rc_canvas[0].texture);
|
||||
irr::core::vector2d<s32> bb_position(0,0);
|
||||
irr::core::dimension2d<u32> bb_dimension(win_w, win_h);
|
||||
irr::core::dimension2d<u32> bb_dimension = rc_canvas[0].texture->getSize();
|
||||
irr::core::dimension2d<u32> win_dimension(win_w, win_h);
|
||||
VideoDriver->setViewPort( irr::core::rect<irr::s32>(bb_position, bb_dimension) );
|
||||
|
||||
irr::core::vector2d<irr::f32> screenSize( (irr::f32) rc_canvas[0].dimension.Width, (irr::f32) rc_canvas[0].dimension.Height );
|
||||
//irr::core::vector2d<irr::f32> screenSize( (irr::f32) win_h, (irr::f32) win_w );
|
||||
|
||||
Uint32 current_time_ms = SDL_GetTicks();
|
||||
double frame_current_time = ((double)current_time_ms)/1000.0;
|
||||
@@ -3437,12 +3465,13 @@ bool rc_update()
|
||||
|
||||
rc_canvas[i].camera.update();
|
||||
|
||||
VideoDriver->setViewPort(irr::core::rect<irr::s32>(0,0,rc_canvas[i].viewport.dimension.Width,rc_canvas[i].viewport.dimension.Height));
|
||||
VideoDriver->setViewPort(irr::core::rect<irr::s32>(0,0,rc_canvas[i].texture->getSize().Width,rc_canvas[i].texture->getSize().Height));
|
||||
|
||||
//irr::core::rect viewport(irr::core::position, rc_canvas[i].viewport.dimension);
|
||||
//VideoDriver->setViewPort(viewport);
|
||||
|
||||
SceneManager->drawAll();
|
||||
//VideoDriver->draw2DRectangle(irr::video::SColor(255,0,255,0), irr::core::rect<irr::s32>(10,40,100,500));
|
||||
|
||||
vector3df p0(0, 0, 0);
|
||||
vector3df p1(10, 30, 0);
|
||||
@@ -3468,8 +3497,32 @@ bool rc_update()
|
||||
irr::video::SColor color(rc_canvas[canvas_id].color_mod);
|
||||
//color.set(255,255,255,255);
|
||||
|
||||
//std::cout << "draw canvas[" << canvas_id << "]" << std::endl;
|
||||
//std::cout << "draw canvas[" << canvas_id << "] (" << rc_canvas[canvas_id].offset.X << ", " << rc_canvas[canvas_id].offset.Y << ") (" << rc_canvas[canvas_id].viewport.dimension.Width << ", " << rc_canvas[canvas_id].dimension.Height << ")" << std::endl;
|
||||
|
||||
#if defined(RC_DRIVER_GLES2)
|
||||
if(rc_canvas[canvas_id].type == RC_CANVAS_TYPE_3D)
|
||||
{
|
||||
src = irr::core::rect<s32>( irr::core::vector2d<s32>(0, 0), rc_canvas[canvas_id].texture->getSize() );
|
||||
dest = irr::core::rect<s32>( irr::core::vector2d<s32>(dest.UpperLeftCorner.X, dest.UpperLeftCorner.Y + dest.getHeight()), irr::core::dimension2d<s32>(dest.getWidth(), -1*dest.getHeight()) );
|
||||
}
|
||||
else if(rc_canvas[canvas_id].type == RC_CANVAS_TYPE_2D)
|
||||
{
|
||||
irr::core::dimension2d<irr::u32> cv_dim = rc_canvas[canvas_id].viewport.dimension;
|
||||
irr::core::position2d<irr::s32> cv_pos = rc_canvas[canvas_id].viewport.position;
|
||||
irr::core::vector2d<irr::s32> cv_offset(rc_canvas[canvas_id].offset.X, rc_canvas[canvas_id].texture->getSize().Height - rc_canvas[canvas_id].offset.Y - cv_dim.Height);
|
||||
src = irr::core::rect<s32>( cv_offset, cv_dim );
|
||||
dest = irr::core::rect<s32>( irr::core::vector2d<s32>(cv_pos.X, cv_pos.Y + cv_dim.Height), irr::core::dimension2d<s32>(cv_dim.Width, -1*cv_dim.Height) );
|
||||
}
|
||||
else if(rc_canvas[canvas_id].type == RC_CANVAS_TYPE_SPRITE)
|
||||
{
|
||||
|
||||
src = irr::core::rect<s32>( irr::core::vector2d<s32>(0, 0), rc_canvas[canvas_id].texture->getSize() );
|
||||
dest = irr::core::rect<s32>( irr::core::vector2d<s32>(dest.UpperLeftCorner.X, dest.UpperLeftCorner.Y + dest.getHeight()), irr::core::dimension2d<s32>(dest.getWidth(), -1*dest.getHeight()) );
|
||||
drawSprites(canvas_id);
|
||||
}
|
||||
//dest = irr::core::rect<s32>( irr::core::vector2d<s32>(dest.UpperLeftCorner.X, dest.UpperLeftCorner.Y + dest.getHeight()), irr::core::dimension2d<s32>(dest.getWidth(), -1*dest.getHeight()) );
|
||||
draw2DImage2(VideoDriver, rc_canvas[canvas_id].texture, src, dest, irr::core::position2d<irr::s32>(0, 0), 0, true, color, screenSize);
|
||||
#else
|
||||
if(rc_canvas[canvas_id].type == RC_CANVAS_TYPE_SPRITE)
|
||||
{
|
||||
|
||||
@@ -3478,6 +3531,7 @@ bool rc_update()
|
||||
}
|
||||
|
||||
draw2DImage2(VideoDriver, rc_canvas[canvas_id].texture, src, dest, irr::core::position2d<irr::s32>(0, 0), 0, true, color, screenSize);
|
||||
#endif // defined
|
||||
|
||||
//drawSprites(canvas_id);
|
||||
//draw2DImage2(VideoDriver, rc_canvas[canvas_id].sprite_layer, src, dest, irr::core::vector2d<irr::s32>(0, 0), 0, true, color, screenSize);
|
||||
@@ -3489,10 +3543,26 @@ bool rc_update()
|
||||
}
|
||||
|
||||
//env->drawAll();
|
||||
//VideoDriver->draw2DRectangle(irr::video::SColor(255,255,0,0), irr::core::rect<irr::s32>(0,0,100,500));
|
||||
|
||||
VideoDriver->setRenderTarget(0);
|
||||
//VideoDriver->beginScene(true, true);
|
||||
VideoDriver->draw2DImage(rc_canvas[0].texture, irr::core::vector2d<irr::s32>(0,0));
|
||||
//VideoDriver->draw2DImage(rc_canvas[0].texture, irr::core::vector2d<irr::s32>(0,0));
|
||||
|
||||
//debug
|
||||
irr::core::rect<s32> src( irr::core::vector2d<s32>(0,0), rc_canvas[0].texture->getSize() );
|
||||
irr::core::rect<s32> dest( irr::core::vector2d<s32>(0,0), irr::core::dimension2d<s32>(win_w, win_h) );
|
||||
irr::video::SColor color(0);
|
||||
VideoDriver->draw2DImage(rc_canvas[0].texture, dest, src);
|
||||
//draw2DImage2(VideoDriver, rc_canvas[0].texture, src, dest, irr::core::position2d<irr::s32>(0, 0), 0, false, color, screenSize);
|
||||
//irr::core::rect<irr::s32> src( irr::core::vector2d<irr::s32>(0, 0), rc_canvas[0].texture->getSize() );
|
||||
//irr::core::rect<irr::s32> dest( irr::core::vector2d<irr::s32>(0, 0), irr::core::dimension2d<irr::s32>( );
|
||||
//draw2DImage2(VideoDriver, rc_canvas[canvas_id].texture, src, dest, irr::core::position2d<irr::s32>(0, 0), 0, true, color, screenSize);
|
||||
|
||||
//VideoDriver->draw2DImage(rc_image[0].image, irr::core::rect<irr::s32>(0,0,100,100), irr::core::rect<irr::s32>(0,0,100,100));
|
||||
//VideoDriver->draw2DRectangle(irr::video::SColor(255,2555,0,0), irr::core::rect<irr::s32>(0,0,100,100));
|
||||
//end debug
|
||||
|
||||
//device->getGUIEnvironment()->drawAll();
|
||||
VideoDriver->endScene();
|
||||
|
||||
|
||||
@@ -10,16 +10,21 @@
|
||||
|
||||
#ifdef RC_WEB
|
||||
#define RC_LINUX
|
||||
#define RC_DRIVER_GLES2
|
||||
#endif
|
||||
|
||||
#ifdef RC_ANDROID
|
||||
#define RC_MOBILE
|
||||
#define RC_DRIVER_GLES2
|
||||
#endif
|
||||
|
||||
#ifdef RC_IOS
|
||||
#define RC_MOBILE
|
||||
#endif
|
||||
|
||||
//FOR DEBUG PURPOSES
|
||||
//#define RC_DRIVER_GLES2
|
||||
|
||||
#define RC_PI 3.14159265359
|
||||
|
||||
inline double rc_util_radians(double degrees)
|
||||
|
||||
@@ -350,7 +350,7 @@ int rc_createSprite(int img_id, double w, double h)
|
||||
|
||||
b2BodyDef sprBodyDef;
|
||||
sprBodyDef.type = b2_dynamicBody;
|
||||
sprBodyDef.position.Set(0, 0);
|
||||
sprBodyDef.position.Set(w/2, h/2);
|
||||
sprBodyDef.angle = 0;
|
||||
sprBodyDef.userData.pointer = (uintptr_t)&rc_sprite[spr_id];
|
||||
rc_sprite[spr_id].physics.body = rc_canvas[rc_active_canvas].physics2D.world->CreateBody(&sprBodyDef);
|
||||
@@ -364,8 +364,8 @@ int rc_createSprite(int img_id, double w, double h)
|
||||
sprFixtureDef.density = 1;
|
||||
rc_sprite[spr_id].physics.fixture = rc_sprite[spr_id].physics.body->CreateFixture(&sprFixtureDef);
|
||||
|
||||
rc_sprite[spr_id].physics.offset_x = 0;
|
||||
rc_sprite[spr_id].physics.offset_y = 0;
|
||||
rc_sprite[spr_id].physics.offset_x = w/2;
|
||||
rc_sprite[spr_id].physics.offset_y = h/2;
|
||||
rc_sprite[spr_id].isSolid = false;
|
||||
|
||||
if(rc_sprite[spr_id].image_id < 0)
|
||||
@@ -513,7 +513,9 @@ void rc_setSpritePosition(int spr_id, double x, double y)
|
||||
return;
|
||||
|
||||
float current_angle = rc_sprite[spr_id].physics.body->GetAngle();
|
||||
rc_sprite[spr_id].physics.body->SetTransform(b2Vec2(x, y), current_angle);
|
||||
double off_x = rc_sprite[spr_id].physics.offset_x;
|
||||
double off_y = rc_sprite[spr_id].physics.offset_y;
|
||||
rc_sprite[spr_id].physics.body->SetTransform(b2Vec2(x+off_x, y+off_y), current_angle);
|
||||
}
|
||||
|
||||
void rc_translateSprite(int spr_id, double x, double y)
|
||||
@@ -538,8 +540,11 @@ void rc_getSpritePosition(int spr_id, double* x, double* y)
|
||||
if(!rc_sprite[spr_id].active)
|
||||
return;
|
||||
|
||||
*x = (double)rc_sprite[spr_id].physics.body->GetPosition().x;
|
||||
*y = (double)rc_sprite[spr_id].physics.body->GetPosition().y;
|
||||
double off_x = rc_sprite[spr_id].physics.offset_x;
|
||||
double off_y = rc_sprite[spr_id].physics.offset_y;
|
||||
|
||||
*x = (double)rc_sprite[spr_id].physics.body->GetPosition().x - off_x;
|
||||
*y = (double)rc_sprite[spr_id].physics.body->GetPosition().y - off_y;
|
||||
}
|
||||
|
||||
double rc_spriteX(int spr_id)
|
||||
@@ -550,7 +555,9 @@ double rc_spriteX(int spr_id)
|
||||
if(!rc_sprite[spr_id].active)
|
||||
return 0;
|
||||
|
||||
return (double)rc_sprite[spr_id].physics.body->GetPosition().x;
|
||||
double off_x = rc_sprite[spr_id].physics.offset_x;
|
||||
|
||||
return (double)rc_sprite[spr_id].physics.body->GetPosition().x - off_x;
|
||||
}
|
||||
|
||||
double rc_spriteY(int spr_id)
|
||||
@@ -561,7 +568,9 @@ double rc_spriteY(int spr_id)
|
||||
if(!rc_sprite[spr_id].active)
|
||||
return 0;
|
||||
|
||||
return (double)rc_sprite[spr_id].physics.body->GetPosition().y;
|
||||
double off_y = rc_sprite[spr_id].physics.offset_y;
|
||||
|
||||
return (double)rc_sprite[spr_id].physics.body->GetPosition().y - off_y;
|
||||
}
|
||||
|
||||
void rc_setSpriteRotation(int spr_id, double angle)
|
||||
@@ -843,13 +852,13 @@ void drawSprites(int canvas_id)
|
||||
continue;
|
||||
|
||||
physics_pos = sprite->physics.body->GetPosition();
|
||||
x = (int)physics_pos.x - offset_x;
|
||||
y = (int)physics_pos.y - offset_y;
|
||||
x = (int)(physics_pos.x - sprite->physics.offset_x) - offset_x;
|
||||
y = (int)(physics_pos.y - sprite->physics.offset_y) - offset_y;
|
||||
|
||||
int xf = x + sprite->frame_size.Width;
|
||||
int yf = y + sprite->frame_size.Height;
|
||||
|
||||
//std::cout << "sprite info: " << xf << ", " << x << ", " << rc_canvas[canvas_id].viewport.dimension.Width << std::endl;
|
||||
//std::cout << "sprite info[" << spr_index << "]: (" << x << ", " << y << ") (" << xf << ", " << yf << ")" << std::endl;
|
||||
|
||||
if( (xf < 0) || (x > ((int)rc_canvas[canvas_id].viewport.dimension.Width)) )
|
||||
{
|
||||
|
||||
@@ -73,18 +73,31 @@
|
||||
<Unit filename="gui_freetype_font.cpp" />
|
||||
<Unit filename="gui_freetype_font.h" />
|
||||
<Unit filename="main.cpp" />
|
||||
<Unit filename="rc_actor_animation.h" />
|
||||
<Unit filename="rc_actor_material.h" />
|
||||
<Unit filename="rc_actor_physics.h" />
|
||||
<Unit filename="rc_audio.h" />
|
||||
<Unit filename="rc_base_actor.h" />
|
||||
<Unit filename="rc_camera.h" />
|
||||
<Unit filename="rc_constraint.h" />
|
||||
<Unit filename="rc_defines.h" />
|
||||
<Unit filename="rc_font.h" />
|
||||
<Unit filename="rc_func130_cases.h" />
|
||||
<Unit filename="rc_geometry.h" />
|
||||
<Unit filename="rc_gfx.h" />
|
||||
<Unit filename="rc_gfx3D.h" />
|
||||
<Unit filename="rc_gfx_core.h" />
|
||||
<Unit filename="rc_joints.h" />
|
||||
<Unit filename="rc_matrix.h" />
|
||||
<Unit filename="rc_media.h" />
|
||||
<Unit filename="rc_mesh.h" />
|
||||
<Unit filename="rc_net.h" />
|
||||
<Unit filename="rc_os_defines.h" />
|
||||
<Unit filename="rc_particles.h" />
|
||||
<Unit filename="rc_physics3D_base.h" />
|
||||
<Unit filename="rc_scene.h" />
|
||||
<Unit filename="rc_sprite2D.h" />
|
||||
<Unit filename="rc_sprite_physics.h" />
|
||||
<Unit filename="rc_spritelib.h" />
|
||||
<Unit filename="rc_stdlib.h" />
|
||||
<Unit filename="rc_test.h" />
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -2,109 +2,129 @@
|
||||
<CodeBlocks_layout_file>
|
||||
<FileVersion major="1" minor="0" />
|
||||
<ActiveTarget name="Release" />
|
||||
<File name="camera.h" open="1" top="0" tabpos="22" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="0" topLine="0" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="rc_net.h" open="1" top="0" tabpos="13" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<File name="rc_net.h" open="0" top="0" tabpos="13" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="1339" topLine="12" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="rc_stdlib.h" open="1" top="0" tabpos="11" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="20548" topLine="882" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="rc_defines.h" open="1" top="0" tabpos="16" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="113947" topLine="1753" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="main.cpp" open="1" top="0" tabpos="7" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="396" topLine="8" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="gui_freetype_font.cpp" open="1" top="0" tabpos="24" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="4946" topLine="0" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="rc_video.h" open="1" top="0" tabpos="21" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="0" topLine="0" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="rc_audio.h" open="1" top="0" tabpos="18" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="6531" topLine="311" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="rc_media.h" open="0" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="17752" topLine="630" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="rc_gfx.h" open="1" top="1" tabpos="9" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="91126" topLine="3193" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="../../irrBullet/src/irrBulletWorld.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="2750" topLine="75" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="rc_gfx_core.h" open="1" top="0" tabpos="15" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<File name="rc_gfx3D.h" open="0" top="0" tabpos="9" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="80" topLine="0" />
|
||||
<Cursor1 position="583" topLine="21" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="rc_geometry.h" open="1" top="0" tabpos="20" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<File name="rc_spritelib.h" open="0" top="0" tabpos="12" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="20919" topLine="653" />
|
||||
<Cursor1 position="8770" topLine="54" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="rc_matrix.h" open="1" top="0" tabpos="14" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<File name="rc_media.h" open="0" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="16042" topLine="586" />
|
||||
<Cursor1 position="17752" topLine="630" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="gui_freetype_font.h" open="1" top="0" tabpos="23" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<File name="../../irrBullet/src/irrBulletcommon.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="924" topLine="6" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="rc_gfx_core.h" open="1" top="0" tabpos="21" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="22725" topLine="825" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="rc_defines.h" open="0" top="0" tabpos="16" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="113947" topLine="2998" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="rc_test.h" open="0" top="0" tabpos="12" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="115" topLine="0" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="rc_audio.h" open="0" top="0" tabpos="18" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="6531" topLine="311" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="rc_matrix.h" open="1" top="0" tabpos="16" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="116" topLine="3" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="rc_stdlib.h" open="0" top="0" tabpos="11" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="24553" topLine="1081" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="gui_freetype_font.h" open="0" top="0" tabpos="23" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="183" topLine="0" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="rc_func130_cases.h" open="1" top="0" tabpos="8" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="52186" topLine="1376" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="rc_os_defines.h" open="1" top="0" tabpos="19" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="67" topLine="0" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="../../irrBullet/src/irrBullet.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="0" topLine="7" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="rc_test.h" open="1" top="0" tabpos="12" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<File name="rc_gfx.h" open="1" top="1" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="115" topLine="0" />
|
||||
<Cursor1 position="99487" topLine="3515" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="rc_gfx3D.h" open="1" top="0" tabpos="10" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<File name="rc_func130_cases.h" open="1" top="0" tabpos="20" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="74" topLine="0" />
|
||||
<Cursor1 position="12494" topLine="362" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="rc_sprite2D.h" open="1" top="0" tabpos="17" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<File name="rc_actor_animation.h" open="1" top="0" tabpos="19" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="501" topLine="0" />
|
||||
<Cursor1 position="3353" topLine="183" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="rc_os_defines.h" open="1" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="107" topLine="0" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="rc_geometry.h" open="0" top="0" tabpos="20" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="20919" topLine="652" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="gui_freetype_font.cpp" open="0" top="0" tabpos="24" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="4946" topLine="0" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="main.cpp" open="1" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="74" topLine="3" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="camera.h" open="0" top="0" tabpos="11" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="261" topLine="0" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="rc_sprite2D.h" open="0" top="0" tabpos="12" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="1444" topLine="0" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="rc_video.h" open="0" top="0" tabpos="21" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="0" topLine="0" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="rc_tilemap.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="243" topLine="0" />
|
||||
</Cursor>
|
||||
</File>
|
||||
</CodeBlocks_layout_file>
|
||||
|
||||
Reference in New Issue
Block a user