Add placeholder item graphics for chapter 4 items. Setup map classes for chapter 4 maps. Add in force set position function for monsters. Release Build 12001.

master
sigonasr2 23 hours ago
parent a7308f4ac5
commit 4e099b71f9
  1. 1
      Adventures in Lestoria/AdventuresInLestoria.cpp
  2. 7
      Adventures in Lestoria/GhostOfPirateCaptain.cpp
  3. 3
      Adventures in Lestoria/ItemDrop.cpp
  4. 8
      Adventures in Lestoria/Monster.cpp
  5. 2
      Adventures in Lestoria/Monster.h
  6. 1
      Adventures in Lestoria/MonsterAttribute.h
  7. 2
      Adventures in Lestoria/Version.h
  8. 5
      Adventures in Lestoria/assets/Campaigns/4_1.tmx
  9. 5
      Adventures in Lestoria/assets/Campaigns/4_2.tmx
  10. 5
      Adventures in Lestoria/assets/Campaigns/4_3.tmx
  11. 5
      Adventures in Lestoria/assets/Campaigns/4_4.tmx
  12. 5
      Adventures in Lestoria/assets/Campaigns/4_5.tmx
  13. 5
      Adventures in Lestoria/assets/Campaigns/4_6.tmx
  14. 5
      Adventures in Lestoria/assets/Campaigns/4_7.tmx
  15. 5
      Adventures in Lestoria/assets/Campaigns/4_8.tmx
  16. 5
      Adventures in Lestoria/assets/Campaigns/4_B1.tmx
  17. BIN
      Adventures in Lestoria/assets/gamepack.pak
  18. BIN
      Adventures in Lestoria/assets/items/Broken Bone Axe.png
  19. BIN
      Adventures in Lestoria/assets/items/Broken Bone Bow.png
  20. BIN
      Adventures in Lestoria/assets/items/Damaged Animal Bones.png
  21. BIN
      Adventures in Lestoria/assets/items/Giant Purple Slime Remains.png
  22. BIN
      Adventures in Lestoria/assets/items/Glowing Bones.png
  23. BIN
      Adventures in Lestoria/assets/items/Pieces of Horse Armor.png
  24. BIN
      Adventures in Lestoria/assets/items/Preserved Animal Bones.png
  25. BIN
      Adventures in Lestoria/assets/items/Purple Gemstone.png
  26. BIN
      Adventures in Lestoria/assets/items/Purple Slime Remains.png
  27. BIN
      Adventures in Lestoria/assets/items/Skeleton Bone.png
  28. BIN
      Adventures in Lestoria/assets/items/Snake Skin.png
  29. BIN
      Adventures in Lestoria/assets/items/Spider Legs.png
  30. BIN
      Adventures in Lestoria/assets/items/Swamp Frog Skin.png
  31. 2
      Adventures in Lestoria/assets/maps/Chapter_4_Details.tsx
  32. 2
      Adventures in Lestoria/assets/maps/Chapter_4_Ground.tsx
  33. 2
      Adventures in Lestoria/assets/maps/Chapter_4_Objects_24x24.tsx
  34. 2
      Adventures in Lestoria/assets/maps/Chapter_4_water_detilazation_24x24.tsx
  35. 49
      Adventures in Lestoria/olcPixelGameEngine.h
  36. BIN
      x64/Release/Adventures in Lestoria.exe

@ -83,6 +83,7 @@ All rights reserved.
#include "SteamStatsReceivedHandler.h" #include "SteamStatsReceivedHandler.h"
#include "StageMaskPolygon.h" #include "StageMaskPolygon.h"
#include <stacktrace> #include <stacktrace>
#include <ranges>
INCLUDE_EMITTER_LIST INCLUDE_EMITTER_LIST
INCLUDE_ITEM_CATEGORIES INCLUDE_ITEM_CATEGORIES

@ -41,6 +41,7 @@ All rights reserved.
#include "AdventuresInLestoria.h" #include "AdventuresInLestoria.h"
#include "SoundEffect.h" #include "SoundEffect.h"
#include "BulletTypes.h" #include "BulletTypes.h"
#include <ranges>
using A=Attribute; using A=Attribute;
@ -71,6 +72,10 @@ void Monster::STRATEGY::GHOST_OF_PIRATE_CAPTAIN(Monster&m,float fElapsedTime,std
m.I(A::CANNON_PHASE)=(m.I(A::CANNON_PHASE)+1)%PHASE_COUNT; m.I(A::CANNON_PHASE)=(m.I(A::CANNON_PHASE)+1)%PHASE_COUNT;
if(prevCannonPhase>m.I(A::CANNON_PHASE)){//Phase has wrapped around, reset cannon shot count. if(prevCannonPhase>m.I(A::CANNON_PHASE)){//Phase has wrapped around, reset cannon shot count.
m.I(A::CANNON_SHOT_COUNT)=0; m.I(A::CANNON_SHOT_COUNT)=0;
if(!m.B(A::FIRST_WAVE_COMPLETE)){
m.B(A::FIRST_WAVE_COMPLETE)=true;
m.ForceSetPos(m.spawnPos);
}
} }
}}; }};
@ -98,7 +103,9 @@ void Monster::STRATEGY::GHOST_OF_PIRATE_CAPTAIN(Monster&m,float fElapsedTime,std
m.VEC(A::CANNON_PHASES).emplace_back(cannonCycle); m.VEC(A::CANNON_PHASES).emplace_back(cannonCycle);
if(cannonCycle==CANNON_SHOT)TOTAL_CANNON_SHOTS++; if(cannonCycle==CANNON_SHOT)TOTAL_CANNON_SHOTS++;
} }
m.B(A::FIRST_WAVE_COMPLETE)=false;
m.I(A::CANNON_SHOT_TYPE)=PREDICTION; m.I(A::CANNON_SHOT_TYPE)=PREDICTION;
m.ForceSetPos({-400.f,-400.f});
SETPHASE(NORMAL); SETPHASE(NORMAL);
}break; }break;
case NORMAL:{ case NORMAL:{

@ -99,8 +99,7 @@ void ItemDrop::UpdateDrops(float fElapsedTime){
if(drop.z<=0){ if(drop.z<=0){
drop.zSpeed=0; drop.zSpeed=0;
drop.z=0; drop.z=0;
} }else{
else{
drop.zSpeed+=gravity*fElapsedTime; drop.zSpeed+=gravity*fElapsedTime;
drop.pos+=drop.speed*fElapsedTime; drop.pos+=drop.speed*fElapsedTime;
} }

@ -692,11 +692,11 @@ void Monster::Moved(){
} }
if(!std::isfinite(pos.x)){ if(!std::isfinite(pos.x)){
ERR(std::format("WARNING! Player X position is {}...Trying to recover. THIS SHOULD NOT BE HAPPENING!",pos.x)); ERR(std::format("WARNING! Monster X position is {}...Trying to recover. THIS SHOULD NOT BE HAPPENING!",pos.x));
pos.x=spawnPos.x; pos.x=spawnPos.x;
} }
if(!std::isfinite(pos.y)){ if(!std::isfinite(pos.y)){
ERR(std::format("WARNING! Player Y position is {}...Trying to recover. THIS SHOULD NOT BE HAPPENING!",pos.y)); ERR(std::format("WARNING! Monster Y position is {}...Trying to recover. THIS SHOULD NOT BE HAPPENING!",pos.y));
pos.y=spawnPos.y; pos.y=spawnPos.y;
} }
} }
@ -1673,3 +1673,7 @@ void Monster::SetCollisionRadius(const float collisionRadius){
void Monster::SetLifetime(const float lifetime){ void Monster::SetLifetime(const float lifetime){
this->lifetime=lifetime; this->lifetime=lifetime;
} }
void Monster::ForceSetPos(vf2d pos){
this->pos=pos;
Moved();
}

@ -336,6 +336,8 @@ private:
const float UnconsciousTime()const; const float UnconsciousTime()const;
bool manualIgnoreTerrain{false}; //A manual flag that can be toggled on to dynamically make this monster ignore terrain collision. bool manualIgnoreTerrain{false}; //A manual flag that can be toggled on to dynamically make this monster ignore terrain collision.
float collisionRadius{}; //The collision radius can be modified, it's just set initially to the monster database entry. float collisionRadius{}; //The collision radius can be modified, it's just set initially to the monster database entry.
//Ignores collision checking and sets the monster at the given position.
void ForceSetPos(vf2d pos);
struct STRATEGY{ struct STRATEGY{
static std::string ERR; static std::string ERR;

@ -172,4 +172,5 @@ enum class Attribute{
CANNON_SHOT_COUNT, CANNON_SHOT_COUNT,
LINE_SHOT_ANG, LINE_SHOT_ANG,
LAST_PLAYER_POS, LAST_PLAYER_POS,
FIRST_WAVE_COMPLETE,
}; };

@ -39,7 +39,7 @@ All rights reserved.
#define VERSION_MAJOR 1 #define VERSION_MAJOR 1
#define VERSION_MINOR 3 #define VERSION_MINOR 3
#define VERSION_PATCH 0 #define VERSION_PATCH 0
#define VERSION_BUILD 11997 #define VERSION_BUILD 12001
#define stringify(a) stringify_(a) #define stringify(a) stringify_(a)
#define stringify_(a) #a #define stringify_(a) #a

@ -1,5 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<map version="1.10" tiledversion="1.10.1" orientation="orthogonal" renderorder="right-down" width="315" height="238" tilewidth="24" tileheight="24" infinite="0" nextlayerid="6" nextobjectid="1"> <map version="1.10" tiledversion="1.10.2" class="Map" orientation="orthogonal" renderorder="right-down" width="315" height="238" tilewidth="24" tileheight="24" infinite="0" nextlayerid="6" nextobjectid="1">
<properties>
<property name="Level Type" type="int" propertytype="LevelType" value="0"/>
</properties>
<tileset firstgid="1" source="../maps/Decorations_c1_No_Shadow24x24.tsx"/> <tileset firstgid="1" source="../maps/Decorations_c1_No_Shadow24x24.tsx"/>
<tileset firstgid="1621" source="../maps/Chapter_4_Details.tsx"/> <tileset firstgid="1621" source="../maps/Chapter_4_Details.tsx"/>
<tileset firstgid="2181" source="../maps/Tilesheet_No_Shadow24x24.tsx"/> <tileset firstgid="2181" source="../maps/Tilesheet_No_Shadow24x24.tsx"/>

@ -1,5 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<map version="1.10" tiledversion="1.10.1" orientation="orthogonal" renderorder="right-down" width="206" height="288" tilewidth="24" tileheight="24" infinite="0" nextlayerid="5" nextobjectid="1"> <map version="1.10" tiledversion="1.10.2" class="Map" orientation="orthogonal" renderorder="right-down" width="206" height="288" tilewidth="24" tileheight="24" infinite="0" nextlayerid="5" nextobjectid="1">
<properties>
<property name="Level Type" type="int" propertytype="LevelType" value="0"/>
</properties>
<tileset firstgid="1" source="../maps/Tilesheet_No_Shadow24x24.tsx"/> <tileset firstgid="1" source="../maps/Tilesheet_No_Shadow24x24.tsx"/>
<tileset firstgid="2913" source="../maps/Decorations_c1_No_Shadow24x24.tsx"/> <tileset firstgid="2913" source="../maps/Decorations_c1_No_Shadow24x24.tsx"/>
<tileset firstgid="4533" source="../maps/Chapter_4_Details.tsx"/> <tileset firstgid="4533" source="../maps/Chapter_4_Details.tsx"/>

@ -1,5 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<map version="1.10" tiledversion="1.10.1" orientation="orthogonal" renderorder="right-down" width="206" height="338" tilewidth="24" tileheight="24" infinite="0" nextlayerid="5" nextobjectid="1"> <map version="1.10" tiledversion="1.10.2" class="Map" orientation="orthogonal" renderorder="right-down" width="206" height="338" tilewidth="24" tileheight="24" infinite="0" nextlayerid="5" nextobjectid="1">
<properties>
<property name="Level Type" type="int" propertytype="LevelType" value="0"/>
</properties>
<tileset firstgid="1" source="../maps/Tilesheet_No_Shadow24x24.tsx"/> <tileset firstgid="1" source="../maps/Tilesheet_No_Shadow24x24.tsx"/>
<tileset firstgid="2913" source="../maps/Chapter_4_Details.tsx"/> <tileset firstgid="2913" source="../maps/Chapter_4_Details.tsx"/>
<tileset firstgid="3473" source="../maps/Decorations_c1_No_Shadow24x24.tsx"/> <tileset firstgid="3473" source="../maps/Decorations_c1_No_Shadow24x24.tsx"/>

@ -1,5 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<map version="1.10" tiledversion="1.10.1" orientation="orthogonal" renderorder="right-down" width="315" height="338" tilewidth="24" tileheight="24" infinite="0" nextlayerid="5" nextobjectid="1"> <map version="1.10" tiledversion="1.10.2" class="Map" orientation="orthogonal" renderorder="right-down" width="315" height="338" tilewidth="24" tileheight="24" infinite="0" nextlayerid="5" nextobjectid="1">
<properties>
<property name="Level Type" type="int" propertytype="LevelType" value="0"/>
</properties>
<tileset firstgid="1" source="../maps/Decorations_c1_No_Shadow24x24.tsx"/> <tileset firstgid="1" source="../maps/Decorations_c1_No_Shadow24x24.tsx"/>
<tileset firstgid="1621" source="../maps/Tilesheet_No_Shadow24x24.tsx"/> <tileset firstgid="1621" source="../maps/Tilesheet_No_Shadow24x24.tsx"/>
<tileset firstgid="4533" source="../maps/Chapter_4_Details.tsx"/> <tileset firstgid="4533" source="../maps/Chapter_4_Details.tsx"/>

@ -1,5 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<map version="1.10" tiledversion="1.10.1" orientation="orthogonal" renderorder="right-down" width="314" height="438" tilewidth="24" tileheight="24" infinite="0" nextlayerid="5" nextobjectid="1"> <map version="1.10" tiledversion="1.10.2" class="Map" orientation="orthogonal" renderorder="right-down" width="314" height="438" tilewidth="24" tileheight="24" infinite="0" nextlayerid="5" nextobjectid="1">
<properties>
<property name="Level Type" type="int" propertytype="LevelType" value="0"/>
</properties>
<tileset firstgid="1" source="../maps/Chapter_4_Ground.tsx"/> <tileset firstgid="1" source="../maps/Chapter_4_Ground.tsx"/>
<tileset firstgid="2263" source="../maps/Tilesheet_No_Shadow24x24.tsx"/> <tileset firstgid="2263" source="../maps/Tilesheet_No_Shadow24x24.tsx"/>
<tileset firstgid="5175" source="../maps/Chapter_4_Objects_24x24.tsx"/> <tileset firstgid="5175" source="../maps/Chapter_4_Objects_24x24.tsx"/>

@ -1,5 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<map version="1.10" tiledversion="1.10.1" orientation="orthogonal" renderorder="right-down" width="260" height="288" tilewidth="24" tileheight="24" infinite="0" nextlayerid="5" nextobjectid="1"> <map version="1.10" tiledversion="1.10.2" class="Map" orientation="orthogonal" renderorder="right-down" width="260" height="288" tilewidth="24" tileheight="24" infinite="0" nextlayerid="5" nextobjectid="1">
<properties>
<property name="Level Type" type="int" propertytype="LevelType" value="0"/>
</properties>
<tileset firstgid="1" source="../maps/Chapter_4_Details.tsx"/> <tileset firstgid="1" source="../maps/Chapter_4_Details.tsx"/>
<tileset firstgid="561" source="../maps/Chapter_4_Ground.tsx"/> <tileset firstgid="561" source="../maps/Chapter_4_Ground.tsx"/>
<tileset firstgid="2823" source="../maps/Tilesheet_No_Shadow24x24.tsx"/> <tileset firstgid="2823" source="../maps/Tilesheet_No_Shadow24x24.tsx"/>

@ -1,5 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<map version="1.10" tiledversion="1.10.1" orientation="orthogonal" renderorder="right-down" width="368" height="288" tilewidth="24" tileheight="24" infinite="0" nextlayerid="5" nextobjectid="1"> <map version="1.10" tiledversion="1.10.2" class="Map" orientation="orthogonal" renderorder="right-down" width="368" height="288" tilewidth="24" tileheight="24" infinite="0" nextlayerid="5" nextobjectid="1">
<properties>
<property name="Level Type" type="int" propertytype="LevelType" value="0"/>
</properties>
<tileset firstgid="1" source="../maps/Chapter_4_Ground.tsx"/> <tileset firstgid="1" source="../maps/Chapter_4_Ground.tsx"/>
<tileset firstgid="2263" source="../maps/Chapter_4_Objects_24x24.tsx"/> <tileset firstgid="2263" source="../maps/Chapter_4_Objects_24x24.tsx"/>
<tileset firstgid="5863" source="../maps/Tilesheet_No_Shadow24x24.tsx"/> <tileset firstgid="5863" source="../maps/Tilesheet_No_Shadow24x24.tsx"/>

@ -1,5 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<map version="1.10" tiledversion="1.10.1" orientation="orthogonal" renderorder="right-down" width="314" height="238" tilewidth="24" tileheight="24" infinite="0" nextlayerid="5" nextobjectid="1"> <map version="1.10" tiledversion="1.10.2" class="Map" orientation="orthogonal" renderorder="right-down" width="314" height="238" tilewidth="24" tileheight="24" infinite="0" nextlayerid="5" nextobjectid="1">
<properties>
<property name="Level Type" type="int" propertytype="LevelType" value="0"/>
</properties>
<tileset firstgid="1" source="../maps/Chapter_4_Objects_24x24.tsx"/> <tileset firstgid="1" source="../maps/Chapter_4_Objects_24x24.tsx"/>
<tileset firstgid="3601" source="../maps/Tilesheet_No_Shadow24x24.tsx"/> <tileset firstgid="3601" source="../maps/Tilesheet_No_Shadow24x24.tsx"/>
<tileset firstgid="6513" source="../maps/Chapter_4_Ground.tsx"/> <tileset firstgid="6513" source="../maps/Chapter_4_Ground.tsx"/>

@ -1,5 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<map version="1.10" tiledversion="1.10.1" orientation="orthogonal" renderorder="right-down" width="260" height="288" tilewidth="24" tileheight="24" infinite="0" nextlayerid="5" nextobjectid="1"> <map version="1.10" tiledversion="1.10.2" class="Map" orientation="orthogonal" renderorder="right-down" width="260" height="288" tilewidth="24" tileheight="24" infinite="0" nextlayerid="5" nextobjectid="1">
<properties>
<property name="Level Type" type="int" propertytype="LevelType" value="0"/>
</properties>
<tileset firstgid="1" source="../maps/Decorations_c1_No_Shadow24x24.tsx"/> <tileset firstgid="1" source="../maps/Decorations_c1_No_Shadow24x24.tsx"/>
<tileset firstgid="1621" source="../maps/Tilesheet_No_Shadow24x24.tsx"/> <tileset firstgid="1621" source="../maps/Tilesheet_No_Shadow24x24.tsx"/>
<tileset firstgid="4533" source="../maps/Chapter_4_Details.tsx"/> <tileset firstgid="4533" source="../maps/Chapter_4_Details.tsx"/>

Binary file not shown.

After

Width:  |  Height:  |  Size: 657 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 651 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 669 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 681 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 649 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 642 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 626 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 683 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 668 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 621 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 673 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 637 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 671 B

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<tileset version="1.10" tiledversion="1.10.1" name="Chapter_4_Details" tilewidth="24" tileheight="24" tilecount="560" columns="40"> <tileset version="1.10" tiledversion="1.10.2" name="Chapter_4_Details" tilewidth="24" tileheight="24" tilecount="560" columns="40">
<image source="commercial_assets/details_24x24.png" width="960" height="336"/> <image source="commercial_assets/details_24x24.png" width="960" height="336"/>
<tile id="81"> <tile id="81">
<objectgroup draworder="index" id="2"> <objectgroup draworder="index" id="2">

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<tileset version="1.10" tiledversion="1.10.1" name="Chapter_4_Ground" tilewidth="24" tileheight="24" tilecount="2262" columns="26"> <tileset version="1.10" tiledversion="1.10.2" name="Chapter_4_Ground" tilewidth="24" tileheight="24" tilecount="2262" columns="26">
<image source="commercial_assets/Ground_rocks_24x24.png" width="624" height="2088"/> <image source="commercial_assets/Ground_rocks_24x24.png" width="624" height="2088"/>
<tile id="2"> <tile id="2">
<objectgroup draworder="index" id="2"> <objectgroup draworder="index" id="2">

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<tileset version="1.10" tiledversion="1.10.1" name="Chapter_4_Objects_24x24" tilewidth="24" tileheight="24" tilecount="3600" columns="75"> <tileset version="1.10" tiledversion="1.10.2" name="Chapter_4_Objects_24x24" tilewidth="24" tileheight="24" tilecount="3600" columns="75">
<image source="commercial_assets/Objects_24x24.png" width="1800" height="1152"/> <image source="commercial_assets/Objects_24x24.png" width="1800" height="1152"/>
</tileset> </tileset>

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<tileset version="1.10" tiledversion="1.10.1" name="Chapter_4_water_detilazation_24x24" tilewidth="24" tileheight="24" tilecount="2886" columns="37"> <tileset version="1.10" tiledversion="1.10.2" name="Chapter_4_water_detilazation_24x24" tilewidth="24" tileheight="24" tilecount="2886" columns="37">
<image source="commercial_assets/water_detilazation_24x24.png" width="888" height="1872"/> <image source="commercial_assets/water_detilazation_24x24.png" width="888" height="1872"/>
</tileset> </tileset>

@ -6948,6 +6948,8 @@ namespace olc
// Windows Event Handler - this is statically connected to the windows event system // Windows Event Handler - this is statically connected to the windows event system
static LRESULT CALLBACK olc_WindowEvent(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) static LRESULT CALLBACK olc_WindowEvent(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{ {
double aspectRatio = (24*15.) / (24*10.);
WPARAM sideBeingDragged = 0;
switch (uMsg) switch (uMsg)
{ {
case WM_MOUSEMOVE: case WM_MOUSEMOVE:
@ -6972,6 +6974,7 @@ namespace olc
return 0; return 0;
} }
case WM_SIZE: ptrPGE->olc_UpdateWindowSize(lParam & 0xFFFF, (lParam >> 16) & 0xFFFF); return 0; case WM_SIZE: ptrPGE->olc_UpdateWindowSize(lParam & 0xFFFF, (lParam >> 16) & 0xFFFF); return 0;
case WM_SIZING: sideBeingDragged = wParam; return 0;
case WM_MOUSEWHEEL: ptrPGE->olc_UpdateMouseWheel(GET_WHEEL_DELTA_WPARAM(wParam)); return 0; case WM_MOUSEWHEEL: ptrPGE->olc_UpdateMouseWheel(GET_WHEEL_DELTA_WPARAM(wParam)); return 0;
case WM_MOUSELEAVE: ptrPGE->olc_UpdateMouseFocus(false); return 0; case WM_MOUSELEAVE: ptrPGE->olc_UpdateMouseFocus(false); return 0;
case WM_SETFOCUS: ptrPGE->olc_UpdateKeyFocus(true); return 0; case WM_SETFOCUS: ptrPGE->olc_UpdateKeyFocus(true); return 0;
@ -7023,6 +7026,52 @@ namespace olc
} }
break; break;
case WM_WINDOWPOSCHANGING:
{
WINDOWPOS * winPos = (WINDOWPOS*)lParam;
// Adjust window dimensions to maintain aspect ratio
switch( sideBeingDragged )
{
case WMSZ_BOTTOM:
case WMSZ_TOPRIGHT:
winPos->cx = (int)( (double)winPos->cy * aspectRatio );
break;
case WMSZ_RIGHT:
case WMSZ_BOTTOMLEFT:
case WMSZ_BOTTOMRIGHT:
winPos->cy = (int)( (double)winPos->cx / aspectRatio );
break;
case WMSZ_TOP:
{
// Adjust the x position of the window to make it appear
// that the bottom right side is anchored
WINDOWPOS old = *winPos;
winPos->cx = (int)( (double)winPos->cy * aspectRatio );
winPos->x += old.cx - winPos->cx;;
}
break;
case WMSZ_LEFT:
case WMSZ_TOPLEFT:
{
// Adjust the y position of the window to make it appear
// the bottom right side is anchored. TOPLEFT resizing
// will move the window around if you don't do this
WINDOWPOS old = *winPos;
winPos->cy = (int)( (double)winPos->cx / aspectRatio );
winPos->y += old.cy - winPos->cy;
}
break;
}
}
break;
case WM_CLOSE: ptrPGE->olc_Terminate(); return 0; case WM_CLOSE: ptrPGE->olc_Terminate(); return 0;
case WM_DESTROY: PostQuitMessage(0); DestroyWindow(hWnd); return 0; case WM_DESTROY: PostQuitMessage(0); DestroyWindow(hWnd); return 0;

Loading…
Cancel
Save