Fixed GetPixel()

This commit is contained in:
n00b
2024-11-24 07:23:30 -05:00
parent 917a2a10eb
commit adec3d0039
5 changed files with 159 additions and 124 deletions

View File

@@ -1,17 +1,22 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_layout_file>
<FileVersion major="1" minor="0" />
<ActiveTarget name="Debug" />
<File name="identifier.h" open="1" top="0" tabpos="18" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="30056" topLine="0" />
</Cursor>
</File>
<File name="tokenizer.h" open="1" top="0" tabpos="26" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<ActiveTarget name="Release" />
<File name="tokenizer.h" open="1" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="41970" topLine="1016" />
</Cursor>
</File>
<File name="rc_global.h" open="0" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="13014" topLine="163" />
</Cursor>
</File>
<File name="rc_vm_asm.h" open="1" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="41761" topLine="1347" />
</Cursor>
</File>
<File name="parser.h" open="1" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="99035" topLine="1896" />
@@ -51,44 +56,39 @@
<Collapse line="6878" />
</Folding>
</File>
<File name="main.cpp" open="1" top="1" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="29416" topLine="904" />
</Cursor>
</File>
<File name="identifier.h" open="1" top="0" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="33082" topLine="992" />
</Cursor>
</File>
<File name="rc_utility.h" open="0" top="0" tabpos="8" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1747" topLine="56" />
</Cursor>
</File>
<File name="rc_vm_asm.h" open="1" top="0" tabpos="17" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="41761" topLine="1347" />
</Cursor>
</File>
<File name="rc_global.h" open="0" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="13014" topLine="163" />
</Cursor>
</File>
<File name="main.cpp" open="1" top="1" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="10783" topLine="908" />
</Cursor>
</File>
<File name="keywords.h" open="0" top="0" tabpos="9" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="0" topLine="0" />
</Cursor>
</File>
<File name="env_resolve.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="615" topLine="32" />
</Cursor>
</File>
<File name="keywords.h" open="0" top="0" tabpos="9" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="0" topLine="0" />
</Cursor>
</File>
<File name="rc_builtin.h" open="1" top="0" tabpos="6" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="112317" topLine="2509" />
</Cursor>
</File>
<File name="constants.h" open="0" top="0" tabpos="10" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="0" topLine="0" />
</Cursor>
</File>
<File name="rc_builtin.h" open="0" top="0" tabpos="11" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="112317" topLine="2496" />
</Cursor>
</File>
</CodeBlocks_layout_file>

View File

@@ -4445,13 +4445,18 @@ int main(int argc, char * argv[])
std::string debug_opt = "a";
std::cin >> debug_opt;
if(debug_opt.compare("a")==0)
rc_intern_dirChange("/home/n00b/Downloads/Shuffleboard/");
{
rc_intern_dirChange("/home/n00b/projects/bu/rcbasic_v400a5_linux/test_project_v4a5");
rc_filename = "test.cbc";
}
else
{
rc_intern_dirChange("/home/n00b/projects/rcbasic_alpha3/test_project");
}
#endif
//---------------
if( (!rc_intern_fileExist(rc_filename)) || rc_filename.compare("")==0 )
if( rc_filename.compare("")==0 )
rc_filename = "main.cbc";
if(rcbasic_load(rc_filename))

View File

@@ -1396,7 +1396,10 @@ void rc_setColor(Uint32 color)
Uint32 rc_getPixel(int x, int y)
{
if(!rc_canvas[0].texture)
if(rc_active_canvas < 0 || rc_active_canvas >= rc_canvas.size())
return 0;
if(!rc_canvas[rc_active_canvas].texture)
{
return 0;
}
@@ -1408,7 +1411,7 @@ Uint32 rc_getPixel(int x, int y)
y = 0;
irr::video::ITexture* texture = rc_canvas[0].texture;
irr::video::ITexture* texture = rc_canvas[rc_active_canvas].texture;
video::ECOLOR_FORMAT format = texture->getColorFormat(); //std::cout << "format = " << (int) format << std::endl;
@@ -1424,10 +1427,12 @@ Uint32 rc_getPixel(int x, int y)
irr::video::SColor * texel = (SColor *)(texels + ((y * pitch) + (x * sizeof(SColor))));
//irr::video::SColor c = texel[0];
irr::video::SColor c = texel[0];
texture->unlock();
color = c.color;
//std::cout << "color(" << x << ", " << y << ") = " << c.getRed() << ", " << c.getGreen() << ", " << c.getBlue() << std::endl;
}

View File

@@ -1,5 +1,5 @@
# depslib dependency file v1.0
1732327607 source:/home/n00b/Projects/RCBASIC4/rcbasic_runtime/main.cpp
1732450472 source:/home/n00b/Projects/RCBASIC4/rcbasic_runtime/main.cpp
"rc_os_defines.h"
<emscripten.h>
<sys/param.h>
@@ -32,7 +32,7 @@
<irrtheora.h>
"rc_func130_cases.h"
1732373037 /home/n00b/Projects/RCBASIC4/rcbasic_runtime/rc_os_defines.h
1732450897 /home/n00b/Projects/RCBASIC4/rcbasic_runtime/rc_os_defines.h
<TargetConditionals.h>
1732393499 /home/n00b/Projects/RCBASIC4/rcbasic_runtime/rc_defines.h
@@ -1247,7 +1247,7 @@
1727545973 /home/n00b/Projects/RCBASIC4/rcbasic_runtime/RealisticWater.h
<irrlicht.h>
1732393902 /home/n00b/Projects/RCBASIC4/rcbasic_runtime/rc_gfx.h
1732450927 /home/n00b/Projects/RCBASIC4/rcbasic_runtime/rc_gfx.h
"SDL.h"
<SDL2/SDL.h>
<irrlicht.h>

View File

@@ -2,29 +2,9 @@
<CodeBlocks_layout_file>
<FileVersion major="1" minor="0" />
<ActiveTarget name="Release" />
<File name="rc_net.h" open="0" top="0" tabpos="13" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="rc_sprite_physics.h" open="1" top="0" tabpos="15" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1339" topLine="12" />
</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_gfx3D.h" open="0" top="0" tabpos="9" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="583" topLine="21" />
</Cursor>
</File>
<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="8770" topLine="54" />
</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" />
<Cursor1 position="9674" topLine="436" />
</Cursor>
</File>
<File name="../../irrBullet/src/irrBulletcommon.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
@@ -32,19 +12,19 @@
<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">
<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="22725" topLine="825" />
<Cursor1 position="1339" topLine="12" />
</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">
<File name="rc_func130_cases.h" open="1" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="113947" topLine="2998" />
<Cursor1 position="50816" topLine="1359" />
</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">
<File name="rc_spritelib.h" open="1" top="0" tabpos="7" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="115" topLine="0" />
<Cursor1 position="21830" topLine="918" />
</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">
@@ -52,14 +32,24 @@
<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">
<File name="rc_actor_material.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="116" topLine="3" />
<Cursor1 position="2143" topLine="318" />
</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">
<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="24553" topLine="1081" />
<Cursor1 position="792" topLine="0" />
</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="190390" topLine="2844" />
</Cursor>
</File>
<File name="rc_actor_animation.h" open="1" top="0" tabpos="18" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="3250" topLine="93" />
</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">
@@ -67,59 +57,9 @@
<Cursor1 position="183" 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">
<File name="rc_gfx_core.h" open="1" top="0" tabpos="6" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="0" topLine="7" />
</Cursor>
</File>
<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="99487" topLine="3515" />
</Cursor>
</File>
<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="12494" topLine="362" />
</Cursor>
</File>
<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="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" />
<Cursor1 position="31644" topLine="927" />
</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">
@@ -127,4 +67,89 @@
<Cursor1 position="243" 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_matrix.h" open="1" top="0" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="116" topLine="3" />
</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="../../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_os_defines.h" open="1" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="292" 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="main.cpp" open="1" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="133376" topLine="4431" />
</Cursor>
</File>
<File name="rc_base_actor.h" open="1" top="0" tabpos="19" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="9392" topLine="296" />
</Cursor>
</File>
<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="583" topLine="15" />
</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_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="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_gfx.h" open="1" top="1" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="54930" topLine="2196" />
</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_physics3D_base.h" open="1" top="0" tabpos="9" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="785" topLine="19" />
</Cursor>
</File>
<File name="rc_actor_physics.h" open="1" top="0" tabpos="8" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="0" topLine="668" />
</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>
</CodeBlocks_layout_file>