Added DrawPie function, fix up invisible foreground tiles (was not rendering).

pull/28/head
sigonasr2 1 year ago
parent 1cabb34b94
commit f48a6a89b2
  1. 13
      Crawler/Crawler.cpp
  2. 2
      Crawler/Crawler.h
  3. 2
      Crawler/Version.h
  4. 2
      Crawler/assets/Campaigns/1_1_v2.tmx
  5. 63
      Crawler/assets/maps/Decorations_c1_No_Shadow24x24.tsx
  6. 28
      Crawler/olcPixelGameEngine.h

@ -75,6 +75,12 @@ Crawler::Crawler()
bool Crawler::OnUserCreate(){ bool Crawler::OnUserCreate(){
InitializeLevels(); InitializeLevels();
circleCooldownPoints.push_back({0,0});
for(int i=0;i<=360;i+=4){
float angle=util::degToRad(i)-PI/2;
circleCooldownPoints.push_back(vf2d{cos(angle),sin(angle)});
}
player=std::make_unique<Warrior>(); player=std::make_unique<Warrior>();
//Initialize Camera. //Initialize Camera.
@ -1052,6 +1058,9 @@ void Crawler::RenderHud(){
DrawShadowStringDecal({0,128},player->GetPos().str()); DrawShadowStringDecal({0,128},player->GetPos().str());
DrawShadowStringDecal({0,136},"Spd: "+std::to_string(player->GetMoveSpdMult())); DrawShadowStringDecal({0,136},"Spd: "+std::to_string(player->GetMoveSpdMult()));
} }
DrawPie({120,120},20,90,BLUE);
} }
void Crawler::AddEffect(std::unique_ptr<Effect>foreground,std::unique_ptr<Effect> background){ void Crawler::AddEffect(std::unique_ptr<Effect>foreground,std::unique_ptr<Effect> background){
@ -1531,3 +1540,7 @@ void Crawler::InitializeLevels(){
void Crawler::SpawnMonster(vf2d pos,MonsterData*data,bool upperLevel){ void Crawler::SpawnMonster(vf2d pos,MonsterData*data,bool upperLevel){
monstersToBeSpawned.push_back(Monster(pos,*data,upperLevel)); monstersToBeSpawned.push_back(Monster(pos,*data,upperLevel));
} }
void Crawler::DrawPie(vf2d center,float radius,float degreesCut,Pixel col){
DrawPolygonDecal(nullptr,circleCooldownPoints,circleCooldownPoints,int(degreesCut/4),center,radius,col);
}

@ -28,6 +28,7 @@ public:
private: private:
std::vector<std::unique_ptr<Effect>>foregroundEffects,backgroundEffects,foregroundEffectsToBeInserted,backgroundEffectsToBeInserted; std::vector<std::unique_ptr<Effect>>foregroundEffects,backgroundEffects,foregroundEffectsToBeInserted,backgroundEffectsToBeInserted;
std::vector<TileRenderData*>tilePreparationList,tileForegroundList; std::vector<TileRenderData*>tilePreparationList,tileForegroundList;
std::vector<vf2d>circleCooldownPoints;
std::map<MapName,Map>MAP_DATA; std::map<MapName,Map>MAP_DATA;
std::map<std::string,TilesetData>MAP_TILESETS; std::map<std::string,TilesetData>MAP_TILESETS;
vf2d worldShake={}; vf2d worldShake={};
@ -111,6 +112,7 @@ public:
void RenderTile(TileRenderData&tileSheet,Pixel col); void RenderTile(TileRenderData&tileSheet,Pixel col);
bool IsReflectiveTile(TilesheetData tileSheet,int tileID); bool IsReflectiveTile(TilesheetData tileSheet,int tileID);
void SpawnMonster(vf2d pos,MonsterData*data,bool upperLevel=false); //Queues a monster for spawning on the next frame. void SpawnMonster(vf2d pos,MonsterData*data,bool upperLevel=false); //Queues a monster for spawning on the next frame.
void DrawPie(vf2d center,float radius,float degreesCut,Pixel col);
struct TileGroupData{ struct TileGroupData{
vi2d tilePos; vi2d tilePos;

@ -2,7 +2,7 @@
#define VERSION_MAJOR 0 #define VERSION_MAJOR 0
#define VERSION_MINOR 2 #define VERSION_MINOR 2
#define VERSION_PATCH 0 #define VERSION_PATCH 0
#define VERSION_BUILD 1463 #define VERSION_BUILD 1484
#define stringify(a) stringify_(a) #define stringify(a) stringify_(a)
#define stringify_(a) #a #define stringify_(a) #a

@ -803,7 +803,7 @@
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3049,3050,3051,3052,3053,3054,0,0,0,0,3049,3050,3051,3052,3053,3054,0,0,0,3049,3050,3051,3052,3053,3054,0,0,0,3005,3006,3007,3008,0,0,0,0,0,3056,3057,3058,3059,3060,0,0,0,0,3011,3012,3013,3014,0,0,0,0,0,0,0,3061,3062,3063,3064,3065,0,0,3049,3050,3051,3052,3053,3054,0,0,0,0,0,3005,3006,3007,3008,0,0,0,0,0,0,3056,3057,3058,3059,3060,0,0,0,3049,3050,3051,3052,3053,3054,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3005,3006,3007,3008,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3094,3095,3096,3097,3098,3099,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3049,3050,3051,3052,3053,3054,0,0,0,0,3049,3050,3051,3052,3053,3054,0,0,0,3049,3050,3051,3052,3053,3054,0,0,0,3005,3006,3007,3008,0,0,0,0,0,3056,3057,3058,3059,3060,0,0,0,0,3011,3012,3013,3014,0,0,0,0,0,0,0,3061,3062,3063,3064,3065,0,0,3049,3050,3051,3052,3053,3054,0,0,0,0,0,3005,3006,3007,3008,0,0,0,0,0,0,3056,3057,3058,3059,3060,0,0,0,3049,3050,3051,3052,3053,3054,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3005,3006,3007,3008,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3094,3095,3096,3097,3098,3099,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3094,3095,3096,3097,3098,3099,0,0,0,0,3094,3095,3096,3097,3098,3099,0,0,0,3094,3095,3096,3097,3098,3099,0,0,3049,3050,3051,3052,3053,3054,0,0,0,0,3101,3102,3103,3104,3105,0,0,0,0,3056,3057,3058,3059,3060,0,0,0,0,0,0,3106,3107,3108,3109,3110,0,0,3094,3095,3096,3097,3098,3099,3125,0,0,0,3049,3050,3051,3052,3053,3054,0,0,0,0,0,3101,3102,3103,3104,3105,0,0,0,3094,3095,3096,3097,3098,3099,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3049,3050,3051,3052,3053,3054,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3139,3140,3141,3142,3143,3144,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3094,3095,3096,3097,3098,3099,0,0,0,0,3094,3095,3096,3097,3098,3099,0,0,0,3094,3095,3096,3097,3098,3099,0,0,3049,3050,3051,3052,3053,3054,0,0,0,0,3101,3102,3103,3104,3105,0,0,0,0,3056,3057,3058,3059,3060,0,0,0,0,0,0,3106,3107,3108,3109,3110,0,0,3094,3095,3096,3097,3098,3099,3125,0,0,0,3049,3050,3051,3052,3053,3054,0,0,0,0,0,3101,3102,3103,3104,3105,0,0,0,3094,3095,3096,3097,3098,3099,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3049,3050,3051,3052,3053,3054,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3139,3140,3141,3142,3143,3144,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3139,3140,3141,3142,3143,3144,0,0,0,0,3139,3140,3141,3142,3143,3144,0,0,0,3139,3140,3141,3142,3143,3144,0,0,3094,3095,3096,3097,3098,3099,0,0,0,0,3146,3147,3148,3149,3150,0,0,0,0,3101,3102,3103,3104,3105,0,0,0,0,0,0,3151,3152,3153,3154,3155,0,0,3139,3140,3141,3142,3143,3144,3170,3171,0,0,3094,3095,3096,3097,3098,3099,0,0,0,0,0,3146,3147,3148,3149,3150,0,0,0,3139,3140,3141,3142,3143,3144,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3094,3095,3096,3097,3098,3099,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3184,3185,3186,3187,3188,3189,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3139,3140,3141,3142,3143,3144,0,0,0,0,3139,3140,3141,3142,3143,3144,0,0,0,3139,3140,3141,3142,3143,3144,0,0,3094,3095,3096,3097,3098,3099,0,0,0,0,3146,3147,3148,3149,3150,0,0,0,0,3101,3102,3103,3104,3105,0,0,0,0,0,0,3151,3152,3153,3154,3155,0,0,3139,3140,3141,3142,3143,3144,3170,3171,0,0,3094,3095,3096,3097,3098,3099,0,0,0,0,0,3146,3147,3148,3149,3150,0,0,0,3139,3140,3141,3142,3143,3144,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3094,3095,3096,3097,3098,3099,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3184,3185,3186,3187,3188,3189,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3184,3185,3186,3187,3188,3189,0,0,0,0,3184,3185,3186,3187,3188,3189,0,0,0,3184,3185,3186,3187,3188,3189,0,0,3139,3140,3141,3142,3143,3144,0,0,0,0,3191,3192,3193,3194,3195,0,0,0,0,3146,3147,3148,3149,3150,0,0,0,0,0,0,3196,3197,3198,3199,3200,0,0,3184,3185,3186,3187,3188,3189,3215,3216,0,0,3139,3140,3141,3142,3143,3144,0,0,0,0,0,3191,3192,3193,3194,3195,0,0,0,3184,3185,3186,3187,3188,3189,0,0,0,0,0,0,0,0,0,0,4589,4541,4541,4541,4541,4541,4597,0,0,3139,3140,3141,3142,3143,3144,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3229,3230,3231,3232,3233,3234,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3184,3185,3186,3187,3188,3189,0,0,0,0,3184,3185,3186,3187,3188,3189,0,0,0,3184,3185,3186,3187,3188,3189,0,0,3139,3140,3141,3142,3143,3144,0,0,0,0,3191,3192,3193,3194,0,0,0,0,0,3146,3147,3148,3149,3150,0,0,0,0,0,0,3196,3197,3198,3199,3200,0,0,3184,3185,3186,3187,3188,3189,3215,3216,0,0,3139,3140,3141,3142,3143,3144,0,0,0,0,0,3191,3192,3193,3194,3195,0,0,0,3184,3185,3186,3187,3188,3189,0,0,0,0,0,0,0,0,0,0,4589,4541,4541,4541,4541,4541,4597,0,0,3139,3140,3141,3142,3143,3144,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3229,3230,3231,3232,3233,3234,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3184,3185,3186,3187,3188,3189,0,0,0,0,0,3237,3238,0,0,0,0,0,0,3191,3192,3193,3194,3195,0,0,0,0,0,0,3241,3242,3243,3244,3245,0,0,0,0,0,0,0,0,3260,3261,0,0,3184,3185,3186,3187,3188,3189,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4573,4533,4533,4533,4533,4533,4581,0,0,3184,3185,3186,3187,3188,3189,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,

@ -2,6 +2,9 @@
<tileset version="1.10" tiledversion="1.10.1" name="Decorations_c1_No_Shadow24x24" tilewidth="24" tileheight="24" tilecount="1620" columns="45"> <tileset version="1.10" tiledversion="1.10.1" name="Decorations_c1_No_Shadow24x24" tilewidth="24" tileheight="24" tilecount="1620" columns="45">
<image source="Decorations_c1_No_Shadow24x24.png" width="1080" height="864"/> <image source="Decorations_c1_No_Shadow24x24.png" width="1080" height="864"/>
<tile id="68" type="ForegroundTile"/> <tile id="68" type="ForegroundTile"/>
<tile id="73" type="ForegroundTile"/>
<tile id="74" type="ForegroundTile"/>
<tile id="75" type="ForegroundTile"/>
<tile id="78" type="ForegroundTile"/> <tile id="78" type="ForegroundTile"/>
<tile id="79" type="ForegroundTile"/> <tile id="79" type="ForegroundTile"/>
<tile id="82" type="ForegroundTile"/> <tile id="82" type="ForegroundTile"/>
@ -38,9 +41,11 @@
<tile id="145" type="ForegroundTile"/> <tile id="145" type="ForegroundTile"/>
<tile id="146" type="ForegroundTile"/> <tile id="146" type="ForegroundTile"/>
<tile id="147" type="ForegroundTile"/> <tile id="147" type="ForegroundTile"/>
<tile id="148" type="ForegroundTile"/>
<tile id="149" type="ForegroundTile"/> <tile id="149" type="ForegroundTile"/>
<tile id="150" type="ForegroundTile"/> <tile id="150" type="ForegroundTile"/>
<tile id="151" type="ForegroundTile"/> <tile id="151" type="ForegroundTile"/>
<tile id="152" type="ForegroundTile"/>
<tile id="157" type="ForegroundTile"/> <tile id="157" type="ForegroundTile"/>
<tile id="158" type="ForegroundTile"/> <tile id="158" type="ForegroundTile"/>
<tile id="163" type="ForegroundTile"/> <tile id="163" type="ForegroundTile"/>
@ -55,6 +60,8 @@
<tile id="174" type="ForegroundTile"/> <tile id="174" type="ForegroundTile"/>
<tile id="175" type="ForegroundTile"/> <tile id="175" type="ForegroundTile"/>
<tile id="176" type="ForegroundTile"/> <tile id="176" type="ForegroundTile"/>
<tile id="177" type="ForegroundTile"/>
<tile id="178" type="ForegroundTile"/>
<tile id="181" type="ForegroundTile"/> <tile id="181" type="ForegroundTile"/>
<tile id="182" type="ForegroundTile"/> <tile id="182" type="ForegroundTile"/>
<tile id="183" type="ForegroundTile"/> <tile id="183" type="ForegroundTile"/>
@ -144,6 +151,7 @@
<tile id="279" type="ForegroundTile"/> <tile id="279" type="ForegroundTile"/>
<tile id="280" type="ForegroundTile"/> <tile id="280" type="ForegroundTile"/>
<tile id="281" type="ForegroundTile"/> <tile id="281" type="ForegroundTile"/>
<tile id="282" type="ForegroundTile"/>
<tile id="283" type="ForegroundTile"/> <tile id="283" type="ForegroundTile"/>
<tile id="284" type="ForegroundTile"/> <tile id="284" type="ForegroundTile"/>
<tile id="285" type="ForegroundTile"/> <tile id="285" type="ForegroundTile"/>
@ -168,18 +176,28 @@
<tile id="305" type="ForegroundTile"/> <tile id="305" type="ForegroundTile"/>
<tile id="306" type="ForegroundTile"/> <tile id="306" type="ForegroundTile"/>
<tile id="307" type="ForegroundTile"/> <tile id="307" type="ForegroundTile"/>
<tile id="308" type="ForegroundTile"/>
<tile id="309" type="ForegroundTile"/> <tile id="309" type="ForegroundTile"/>
<tile id="310" type="ForegroundTile"/> <tile id="310" type="ForegroundTile"/>
<tile id="311" type="ForegroundTile"/> <tile id="311" type="ForegroundTile"/>
<tile id="312" type="ForegroundTile"/> <tile id="312" type="ForegroundTile"/>
<tile id="313" type="ForegroundTile"/> <tile id="313" type="ForegroundTile"/>
<tile id="316" type="ForegroundTile"/>
<tile id="317" type="ForegroundTile"/>
<tile id="318" type="ForegroundTile"/> <tile id="318" type="ForegroundTile"/>
<tile id="319" type="ForegroundTile"/> <tile id="319" type="ForegroundTile"/>
<tile id="320" type="ForegroundTile"/>
<tile id="321" type="ForegroundTile"/>
<tile id="323" type="ForegroundTile"/>
<tile id="324" type="ForegroundTile"/> <tile id="324" type="ForegroundTile"/>
<tile id="325" type="ForegroundTile"/> <tile id="325" type="ForegroundTile"/>
<tile id="326" type="ForegroundTile"/>
<tile id="327" type="ForegroundTile"/>
<tile id="328" type="ForegroundTile"/>
<tile id="329" type="ForegroundTile"/> <tile id="329" type="ForegroundTile"/>
<tile id="330" type="ForegroundTile"/> <tile id="330" type="ForegroundTile"/>
<tile id="331" type="ForegroundTile"/> <tile id="331" type="ForegroundTile"/>
<tile id="332" type="ForegroundTile"/>
<tile id="333" type="ForegroundTile"/> <tile id="333" type="ForegroundTile"/>
<tile id="334" type="ForegroundTile"/> <tile id="334" type="ForegroundTile"/>
<tile id="335" type="ForegroundTile"/> <tile id="335" type="ForegroundTile"/>
@ -192,15 +210,21 @@
<tile id="342" type="ForegroundTile"/> <tile id="342" type="ForegroundTile"/>
<tile id="343" type="ForegroundTile"/> <tile id="343" type="ForegroundTile"/>
<tile id="344" type="ForegroundTile"/> <tile id="344" type="ForegroundTile"/>
<tile id="345" type="ForegroundTile"/>
<tile id="347" type="ForegroundTile"/> <tile id="347" type="ForegroundTile"/>
<tile id="348" type="ForegroundTile"/> <tile id="348" type="ForegroundTile"/>
<tile id="349" type="ForegroundTile"/> <tile id="349" type="ForegroundTile"/>
<tile id="350" type="ForegroundTile"/> <tile id="350" type="ForegroundTile"/>
<tile id="351" type="ForegroundTile"/> <tile id="351" type="ForegroundTile"/>
<tile id="352" type="ForegroundTile"/>
<tile id="353" type="ForegroundTile"/>
<tile id="354" type="ForegroundTile"/>
<tile id="355" type="ForegroundTile"/> <tile id="355" type="ForegroundTile"/>
<tile id="356" type="ForegroundTile"/> <tile id="356" type="ForegroundTile"/>
<tile id="357" type="ForegroundTile"/> <tile id="357" type="ForegroundTile"/>
<tile id="358" type="ForegroundTile"/> <tile id="358" type="ForegroundTile"/>
<tile id="361" type="ForegroundTile"/>
<tile id="362" type="ForegroundTile"/>
<tile id="363" type="ForegroundTile"> <tile id="363" type="ForegroundTile">
<objectgroup draworder="index" id="2"> <objectgroup draworder="index" id="2">
<object id="1" x="5" y="0" width="19" height="21"/> <object id="1" x="5" y="0" width="19" height="21"/>
@ -211,6 +235,9 @@
<object id="5" x="0" y="0" width="21" height="22"/> <object id="5" x="0" y="0" width="21" height="22"/>
</objectgroup> </objectgroup>
</tile> </tile>
<tile id="365" type="ForegroundTile"/>
<tile id="366" type="ForegroundTile"/>
<tile id="368" type="ForegroundTile"/>
<tile id="369" type="ForegroundTile"> <tile id="369" type="ForegroundTile">
<objectgroup draworder="index" id="2"> <objectgroup draworder="index" id="2">
<object id="1" x="12" y="0" width="12" height="18"/> <object id="1" x="12" y="0" width="12" height="18"/>
@ -221,6 +248,9 @@
<object id="1" x="0" y="0" width="24" height="24"/> <object id="1" x="0" y="0" width="24" height="24"/>
</objectgroup> </objectgroup>
</tile> </tile>
<tile id="371" type="ForegroundTile"/>
<tile id="372" type="ForegroundTile"/>
<tile id="373" type="ForegroundTile"/>
<tile id="374" type="ForegroundTile"> <tile id="374" type="ForegroundTile">
<objectgroup draworder="index" id="2"> <objectgroup draworder="index" id="2">
<object id="2" x="15" y="0" width="9" height="20"/> <object id="2" x="15" y="0" width="9" height="20"/>
@ -231,11 +261,16 @@
<object id="4" x="0" y="0" width="19" height="24"/> <object id="4" x="0" y="0" width="19" height="24"/>
</objectgroup> </objectgroup>
</tile> </tile>
<tile id="376" type="ForegroundTile"/>
<tile id="377" type="ForegroundTile"/>
<tile id="378" type="ForegroundTile"/>
<tile id="379" type="ForegroundTile"> <tile id="379" type="ForegroundTile">
<objectgroup draworder="index" id="4"> <objectgroup draworder="index" id="4">
<object id="3" x="3" y="0" width="19" height="16"/> <object id="3" x="3" y="0" width="19" height="16"/>
</objectgroup> </objectgroup>
</tile> </tile>
<tile id="380" type="ForegroundTile"/>
<tile id="381" type="ForegroundTile"/>
<tile id="382" type="ForegroundTile"> <tile id="382" type="ForegroundTile">
<objectgroup draworder="index" id="2"> <objectgroup draworder="index" id="2">
<object id="1" x="12" y="0" width="12" height="19"/> <object id="1" x="12" y="0" width="12" height="19"/>
@ -246,11 +281,14 @@
<object id="2" x="0" y="0" width="15" height="18"/> <object id="2" x="0" y="0" width="15" height="18"/>
</objectgroup> </objectgroup>
</tile> </tile>
<tile id="384" type="ForegroundTile"/>
<tile id="385" type="ForegroundTile"/>
<tile id="386" type="ForegroundTile"> <tile id="386" type="ForegroundTile">
<objectgroup draworder="index" id="2"> <objectgroup draworder="index" id="2">
<object id="1" x="0" y="0" width="24" height="21"/> <object id="1" x="0" y="0" width="24" height="21"/>
</objectgroup> </objectgroup>
</tile> </tile>
<tile id="387" type="ForegroundTile"/>
<tile id="388" type="ForegroundTile"> <tile id="388" type="ForegroundTile">
<objectgroup draworder="index" id="3"> <objectgroup draworder="index" id="3">
<object id="2" x="21" y="0" width="3" height="10"/> <object id="2" x="21" y="0" width="3" height="10"/>
@ -261,11 +299,13 @@
<object id="1" x="0" y="0" width="24" height="19"/> <object id="1" x="0" y="0" width="24" height="19"/>
</objectgroup> </objectgroup>
</tile> </tile>
<tile id="390" type="ForegroundTile"/>
<tile id="392" type="ForegroundTile"> <tile id="392" type="ForegroundTile">
<objectgroup draworder="index" id="2"> <objectgroup draworder="index" id="2">
<object id="1" x="11" y="0" width="12" height="18"/> <object id="1" x="11" y="0" width="12" height="18"/>
</objectgroup> </objectgroup>
</tile> </tile>
<tile id="394" type="ForegroundTile"/>
<tile id="395" type="ForegroundTile"> <tile id="395" type="ForegroundTile">
<objectgroup draworder="index" id="2"> <objectgroup draworder="index" id="2">
<object id="1" x="7" y="0" width="17" height="19"/> <object id="1" x="7" y="0" width="17" height="19"/>
@ -276,6 +316,8 @@
<object id="1" x="0" y="0" width="16" height="19"/> <object id="1" x="0" y="0" width="16" height="19"/>
</objectgroup> </objectgroup>
</tile> </tile>
<tile id="397" type="ForegroundTile"/>
<tile id="398" type="ForegroundTile"/>
<tile id="399" type="ForegroundTile"> <tile id="399" type="ForegroundTile">
<objectgroup draworder="index" id="3"> <objectgroup draworder="index" id="3">
<object id="4" x="22" y="0" width="2" height="10"/> <object id="4" x="22" y="0" width="2" height="10"/>
@ -286,6 +328,7 @@
<object id="1" x="0" y="0" width="24" height="19"/> <object id="1" x="0" y="0" width="24" height="19"/>
</objectgroup> </objectgroup>
</tile> </tile>
<tile id="401" type="ForegroundTile"/>
<tile id="402" type="ForegroundTile"> <tile id="402" type="ForegroundTile">
<objectgroup draworder="index" id="2"> <objectgroup draworder="index" id="2">
<object id="1" x="10" y="0" width="14" height="21"/> <object id="1" x="10" y="0" width="14" height="21"/>
@ -296,8 +339,11 @@
<object id="1" x="0" y="0" width="12" height="21"/> <object id="1" x="0" y="0" width="12" height="21"/>
</objectgroup> </objectgroup>
</tile> </tile>
<tile id="424" type="ForegroundTile"/>
<tile id="425" type="ForegroundTile"/> <tile id="425" type="ForegroundTile"/>
<tile id="426" type="ForegroundTile"/> <tile id="426" type="ForegroundTile"/>
<tile id="427" type="ForegroundTile"/>
<tile id="428" type="ForegroundTile"/>
<tile id="429" type="ForegroundTile"/> <tile id="429" type="ForegroundTile"/>
<tile id="430" type="ForegroundTile"/> <tile id="430" type="ForegroundTile"/>
<tile id="431" type="ForegroundTile"/> <tile id="431" type="ForegroundTile"/>
@ -316,8 +362,10 @@
</tile> </tile>
<tile id="438" type="ForegroundTile"/> <tile id="438" type="ForegroundTile"/>
<tile id="439" type="ForegroundTile"/> <tile id="439" type="ForegroundTile"/>
<tile id="452" type="ForegroundTile"/>
<tile id="453" type="ForegroundTile"/> <tile id="453" type="ForegroundTile"/>
<tile id="454" type="ForegroundTile"/> <tile id="454" type="ForegroundTile"/>
<tile id="455" type="ForegroundTile"/>
<tile id="458"> <tile id="458">
<objectgroup draworder="index" id="2"> <objectgroup draworder="index" id="2">
<object id="1" x="3" y="6" width="19" height="13"/> <object id="1" x="3" y="6" width="19" height="13"/>
@ -913,9 +961,12 @@
<object id="1" x="0" y="0" width="18" height="15"/> <object id="1" x="0" y="0" width="18" height="15"/>
</objectgroup> </objectgroup>
</tile> </tile>
<tile id="902" type="ForegroundTile"/>
<tile id="903" type="ForegroundTile"/> <tile id="903" type="ForegroundTile"/>
<tile id="904" type="ForegroundTile"/> <tile id="904" type="ForegroundTile"/>
<tile id="905" type="ForegroundTile"/> <tile id="905" type="ForegroundTile"/>
<tile id="906" type="ForegroundTile"/>
<tile id="907" type="ForegroundTile"/>
<tile id="908" type="ForegroundTile"/> <tile id="908" type="ForegroundTile"/>
<tile id="909" type="ForegroundTile"/> <tile id="909" type="ForegroundTile"/>
<tile id="910" type="ForegroundTile"/> <tile id="910" type="ForegroundTile"/>
@ -1004,16 +1055,20 @@
<tile id="1073" type="ForegroundTile"/> <tile id="1073" type="ForegroundTile"/>
<tile id="1074" type="ForegroundTile"/> <tile id="1074" type="ForegroundTile"/>
<tile id="1075" type="ForegroundTile"/> <tile id="1075" type="ForegroundTile"/>
<tile id="1082" type="ForegroundTile"/>
<tile id="1083" type="ForegroundTile"/> <tile id="1083" type="ForegroundTile"/>
<tile id="1084" type="ForegroundTile"/> <tile id="1084" type="ForegroundTile"/>
<tile id="1085" type="ForegroundTile"/> <tile id="1085" type="ForegroundTile"/>
<tile id="1086" type="ForegroundTile"/> <tile id="1086" type="ForegroundTile"/>
<tile id="1087" type="ForegroundTile"/> <tile id="1087" type="ForegroundTile"/>
<tile id="1088" type="ForegroundTile"/>
<tile id="1089" type="ForegroundTile"/>
<tile id="1090" type="ForegroundTile"/> <tile id="1090" type="ForegroundTile"/>
<tile id="1091" type="ForegroundTile"/> <tile id="1091" type="ForegroundTile"/>
<tile id="1092" type="ForegroundTile"/> <tile id="1092" type="ForegroundTile"/>
<tile id="1093" type="ForegroundTile"/> <tile id="1093" type="ForegroundTile"/>
<tile id="1094" type="ForegroundTile"/> <tile id="1094" type="ForegroundTile"/>
<tile id="1095" type="ForegroundTile"/>
<tile id="1102" type="ForegroundTile"/> <tile id="1102" type="ForegroundTile"/>
<tile id="1103" type="ForegroundTile"/> <tile id="1103" type="ForegroundTile"/>
<tile id="1104" type="ForegroundTile"/> <tile id="1104" type="ForegroundTile"/>
@ -1134,9 +1189,11 @@
<tile id="1310" type="ForegroundTile"/> <tile id="1310" type="ForegroundTile"/>
<tile id="1311" type="ForegroundTile"/> <tile id="1311" type="ForegroundTile"/>
<tile id="1312" type="ForegroundTile"/> <tile id="1312" type="ForegroundTile"/>
<tile id="1324" type="ForegroundTile"/>
<tile id="1325" type="ForegroundTile"/> <tile id="1325" type="ForegroundTile"/>
<tile id="1326" type="ForegroundTile"/> <tile id="1326" type="ForegroundTile"/>
<tile id="1327" type="ForegroundTile"/> <tile id="1327" type="ForegroundTile"/>
<tile id="1328" type="ForegroundTile"/>
<tile id="1332" type="ForegroundTile"/> <tile id="1332" type="ForegroundTile"/>
<tile id="1333" type="ForegroundTile"/> <tile id="1333" type="ForegroundTile"/>
<tile id="1334" type="ForegroundTile"/> <tile id="1334" type="ForegroundTile"/>
@ -1395,6 +1452,7 @@
<object id="1" x="0" y="0" width="18" height="10"/> <object id="1" x="0" y="0" width="18" height="10"/>
</objectgroup> </objectgroup>
</tile> </tile>
<tile id="1549" type="ForegroundTile"/>
<tile id="1550" type="ForegroundTile"> <tile id="1550" type="ForegroundTile">
<objectgroup draworder="index" id="2"> <objectgroup draworder="index" id="2">
<object id="1" x="10" y="0" width="14" height="7"/> <object id="1" x="10" y="0" width="14" height="7"/>
@ -1410,6 +1468,8 @@
<object id="1" x="0" y="0" width="9" height="7"/> <object id="1" x="0" y="0" width="9" height="7"/>
</objectgroup> </objectgroup>
</tile> </tile>
<tile id="1553" type="ForegroundTile"/>
<tile id="1556" type="ForegroundTile"/>
<tile id="1557" type="ForegroundTile"> <tile id="1557" type="ForegroundTile">
<objectgroup draworder="index" id="2"> <objectgroup draworder="index" id="2">
<object id="1" x="10" y="0" width="14" height="7"/> <object id="1" x="10" y="0" width="14" height="7"/>
@ -1425,6 +1485,8 @@
<object id="1" x="0" y="0" width="9" height="7"/> <object id="1" x="0" y="0" width="9" height="7"/>
</objectgroup> </objectgroup>
</tile> </tile>
<tile id="1560" type="ForegroundTile"/>
<tile id="1567" type="ForegroundTile"/>
<tile id="1568" type="ForegroundTile"> <tile id="1568" type="ForegroundTile">
<objectgroup draworder="index" id="2"> <objectgroup draworder="index" id="2">
<object id="1" x="10" y="0" width="14" height="7"/> <object id="1" x="10" y="0" width="14" height="7"/>
@ -1440,4 +1502,5 @@
<object id="1" x="0" y="0" width="9" height="7"/> <object id="1" x="0" y="0" width="9" height="7"/>
</objectgroup> </objectgroup>
</tile> </tile>
<tile id="1571" type="ForegroundTile"/>
</tileset> </tileset>

@ -1141,6 +1141,7 @@ namespace olc
void GradientFillRectDecal(const olc::vf2d& pos, const olc::vf2d& size, const olc::Pixel colTL, const olc::Pixel colBL, const olc::Pixel colBR, const olc::Pixel colTR); void GradientFillRectDecal(const olc::vf2d& pos, const olc::vf2d& size, const olc::Pixel colTL, const olc::Pixel colBL, const olc::Pixel colBR, const olc::Pixel colTR);
// Draws an arbitrary convex textured polygon using GPU // Draws an arbitrary convex textured polygon using GPU
void DrawPolygonDecal(olc::Decal* decal, const std::vector<olc::vf2d>& pos, const std::vector<olc::vf2d>& uv, const olc::Pixel tint = olc::WHITE); void DrawPolygonDecal(olc::Decal* decal, const std::vector<olc::vf2d>& pos, const std::vector<olc::vf2d>& uv, const olc::Pixel tint = olc::WHITE);
void DrawPolygonDecal(olc::Decal* decal, const std::vector<olc::vf2d>& pos, const std::vector<olc::vf2d>& uv, int startInd, const vf2d&offset, const float scale, const olc::Pixel tint = olc::WHITE);
void DrawPolygonDecal(olc::Decal* decal, const std::vector<olc::vf2d>& pos, const std::vector<float>& depth, const std::vector<olc::vf2d>& uv, const olc::Pixel tint = olc::WHITE); void DrawPolygonDecal(olc::Decal* decal, const std::vector<olc::vf2d>& pos, const std::vector<float>& depth, const std::vector<olc::vf2d>& uv, const olc::Pixel tint = olc::WHITE);
void DrawPolygonDecal(olc::Decal* decal, const std::vector<olc::vf2d>& pos, const std::vector<olc::vf2d>& uv, const std::vector<olc::Pixel>& tint); void DrawPolygonDecal(olc::Decal* decal, const std::vector<olc::vf2d>& pos, const std::vector<olc::vf2d>& uv, const std::vector<olc::Pixel>& tint);
void DrawPolygonDecal(olc::Decal* decal, const std::vector<olc::vf2d>& pos, const std::vector<olc::vf2d>& uv, const std::vector<olc::Pixel>& colours, const olc::Pixel tint); void DrawPolygonDecal(olc::Decal* decal, const std::vector<olc::vf2d>& pos, const std::vector<olc::vf2d>& uv, const std::vector<olc::Pixel>& colours, const olc::Pixel tint);
@ -2969,6 +2970,33 @@ namespace olc
vLayers[nTargetLayer].vecDecalInstance.push_back(di); vLayers[nTargetLayer].vecDecalInstance.push_back(di);
} }
void PixelGameEngine::DrawPolygonDecal(olc::Decal* decal, const std::vector<olc::vf2d>& pos, const std::vector<olc::vf2d>& uv, const int startInd, const vf2d&offset, const float scale, const olc::Pixel tint)
{
DecalInstance di;
di.decal = decal;
di.points = uint32_t(pos.size()-startInd);
di.pos.resize(di.points);
di.uv.resize(di.points);
di.w.resize(di.points);
di.tint.resize(di.points);
if(startInd!=0){
di.pos[0] = { ((pos[0].x*scale+offset.x) * vInvScreenSize.x) * 2.0f - 1.0f, (((pos[0].y*scale+offset.y) * vInvScreenSize.y) * 2.0f - 1.0f) * -1.0f };
di.uv[0] = uv[0];
di.tint[0] = tint;
di.w[0] = 1.0f;
}
for (uint32_t i = 1; i < di.points; i++)
{
di.pos[i] = { ((pos[startInd+i].x*scale+offset.x) * vInvScreenSize.x) * 2.0f - 1.0f, (((pos[startInd+i].y*scale+offset.y) * vInvScreenSize.y) * 2.0f - 1.0f) * -1.0f };
di.uv[i] = uv[startInd+i];
di.tint[i] = tint;
di.w[i] = 1.0f;
}
di.mode = nDecalMode;
di.structure = nDecalStructure;
vLayers[nTargetLayer].vecDecalInstance.push_back(di);
}
void PixelGameEngine::DrawPolygonDecal(olc::Decal* decal, const std::vector<olc::vf2d>& pos, const std::vector<olc::vf2d>& uv, const std::vector<olc::Pixel> &tint) void PixelGameEngine::DrawPolygonDecal(olc::Decal* decal, const std::vector<olc::vf2d>& pos, const std::vector<olc::vf2d>& uv, const std::vector<olc::Pixel> &tint)
{ {
DecalInstance di; DecalInstance di;

Loading…
Cancel
Save