Applied scale to sprite rotation point

This commit is contained in:
n00b
2025-05-01 15:05:46 -04:00
parent 51c64fa857
commit daac85c26a
3 changed files with 30 additions and 30 deletions

View File

@@ -2,17 +2,25 @@
<CodeBlocks_layout_file> <CodeBlocks_layout_file>
<FileVersion major="1" minor="0" /> <FileVersion major="1" minor="0" />
<ActiveTarget name="Debug" /> <ActiveTarget name="Debug" />
<File name="rc_builtin.h" open="0" top="0" tabpos="6" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0"> <File name="parser.h" open="0" top="0" tabpos="24" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor> <Cursor>
<Cursor1 position="112317" topLine="2509" /> <Cursor1 position="136748" topLine="3309" />
</Cursor>
<Folding>
<Collapse line="6341" />
</Folding>
</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> </Cursor>
</File> </File>
<File name="rc_vm_asm.h" open="0" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0"> <File name="tokenizer.h" open="1" top="1" tabpos="19" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor> <Cursor>
<Cursor1 position="41761" topLine="1347" /> <Cursor1 position="41919" topLine="1007" />
</Cursor> </Cursor>
</File> </File>
<File name="main.cpp" open="1" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0"> <File name="main.cpp" open="1" top="0" tabpos="18" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor> <Cursor>
<Cursor1 position="30118" topLine="906" /> <Cursor1 position="30118" topLine="906" />
</Cursor> </Cursor>
@@ -22,19 +30,29 @@
<Cursor1 position="105" topLine="17" /> <Cursor1 position="105" topLine="17" />
</Cursor> </Cursor>
</File> </File>
<File name="rc_vm_asm.h" open="0" 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="rc_global.h" open="0" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0"> <File name="rc_global.h" open="0" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor> <Cursor>
<Cursor1 position="13014" topLine="163" /> <Cursor1 position="13014" topLine="163" />
</Cursor> </Cursor>
</File> </File>
<File name="rc_builtin.h" open="0" 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="env_resolve.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0"> <File name="env_resolve.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor> <Cursor>
<Cursor1 position="615" topLine="32" /> <Cursor1 position="615" topLine="32" />
</Cursor> </Cursor>
</File> </File>
<File name="constants.h" open="0" top="0" tabpos="10" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0"> <File name="identifier.h" open="0" top="0" tabpos="26" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor> <Cursor>
<Cursor1 position="0" topLine="0" /> <Cursor1 position="9544" topLine="341" />
</Cursor> </Cursor>
</File> </File>
<File name="rc_utility.h" open="0" top="0" tabpos="27" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0"> <File name="rc_utility.h" open="0" top="0" tabpos="27" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
@@ -42,22 +60,4 @@
<Cursor1 position="1747" topLine="35" /> <Cursor1 position="1747" topLine="35" />
</Cursor> </Cursor>
</File> </File>
<File name="parser.h" open="0" top="0" tabpos="24" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="136748" topLine="3309" />
</Cursor>
<Folding>
<Collapse line="6341" />
</Folding>
</File>
<File name="identifier.h" open="0" top="0" tabpos="26" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="9544" topLine="341" />
</Cursor>
</File>
<File name="tokenizer.h" open="1" top="1" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="46887" topLine="1268" />
</Cursor>
</File>
</CodeBlocks_layout_file> </CodeBlocks_layout_file>

View File

@@ -1315,11 +1315,11 @@ void drawSprites(int canvas_id)
//position.set(x, y); //position.set(x, y);
rotationPoint.set(x + (src_size.Width/2), y + (src_size.Height/2)); //TODO: need to account for offset once that is implemented
rotation = -1 * (sprite->physics.body->GetAngle() * RAD_TO_DEG); //convert Box2D radians to degrees
scale.set(sprite->scale.X, sprite->scale.Y); scale.set(sprite->scale.X, sprite->scale.Y);
rotationPoint.set(x + (src_size.Width/2)*scale.X, y + (src_size.Height/2)*scale.Y); //TODO: need to account for offset once that is implemented
rotation = -1 * (sprite->physics.body->GetAngle() * RAD_TO_DEG); //convert Box2D radians to degrees
color.set(sprite->alpha, color.set(sprite->alpha,
sprite->color_mod.getRed(), sprite->color_mod.getRed(),
sprite->color_mod.getGreen(), sprite->color_mod.getGreen(),

View File

@@ -1248,7 +1248,7 @@
1734372058 /home/n00b/Projects/RCBASIC4/rcbasic_runtime/RealisticWater.h 1734372058 /home/n00b/Projects/RCBASIC4/rcbasic_runtime/RealisticWater.h
<irrlicht.h> <irrlicht.h>
1744470508 /home/n00b/Projects/RCBASIC4/rcbasic_runtime/rc_gfx.h 1745698805 /home/n00b/Projects/RCBASIC4/rcbasic_runtime/rc_gfx.h
"SDL.h" "SDL.h"
<SDL2/SDL.h> <SDL2/SDL.h>
<irrlicht.h> <irrlicht.h>
@@ -2492,7 +2492,7 @@
<cmath> <cmath>
<cstdint> <cstdint>
1744672115 /home/n00b/Projects/RCBASIC4/rcbasic_runtime/rc_spritelib.h 1746124624 /home/n00b/Projects/RCBASIC4/rcbasic_runtime/rc_spritelib.h
"SDL.h" "SDL.h"
<SDL2/SDL.h> <SDL2/SDL.h>
"rc_sprite2D.h" "rc_sprite2D.h"