Text rendering properly deals with newline characters. Updated components that were not properly rendering.

pull/28/head
sigonasr2 11 months ago
parent 5d1e0b5a7a
commit c795e7f891
  1. 4
      Crawler/CharacterMenuWindow.cpp
  2. 9
      Crawler/Crawler.cpp
  3. 4
      Crawler/Crawler.h
  4. 2
      Crawler/Version.h
  5. 18
      Crawler/olcPixelGameEngine.h
  6. BIN
      Crawler/pge.data
  7. 2
      Crawler/pge.js
  8. BIN
      Crawler/pge.wasm

@ -109,7 +109,7 @@ void Menu::InitializeCharacterMenuWindow(){
for(int i=0;i<8;i++){
float x=31+(i%2)*33;
float y=24+(i/2)*28;
float labelX=2+(i%2)*90;
float labelX=0+(i%2)*88;
float labelY=24+(i/2)*28+36;
if(i<6){
y-=8;
@ -234,7 +234,7 @@ void Menu::InitializeCharacterMenuWindow(){
equipmentSlot->SetShowQuantity(false);
equipmentSlot->SetCompactDescriptions(false);
equipSlot<<=1;
characterMenuWindow->ADD("Equip Label "+slotNames[i],PopupMenuLabel)({{labelX,labelY},{29,16}},slotNames[i],{0.5,1},ComponentAttr::SHADOW)END;
characterMenuWindow->ADD("Equip Label "+slotNames[i],PopupMenuLabel)({{labelX,labelY},{24,16}},slotNames[i],{0.5,1},ComponentAttr::SHADOW)END;
Menu::AddEquipStatListener(equipmentSlot);
}

@ -68,7 +68,7 @@ All rights reserved.
#include "MenuItemItemButton.h"
#include "Merchant.h"
#ifndef __EMSCRIPTEN__
#include "discord-files/discord.h"
#include "discord.h"
#endif
INCLUDE_EMITTER_LIST
@ -209,8 +209,9 @@ bool Crawler::OnUserCreate(){
utils::datafile::INITIAL_SETUP_COMPLETE=true;
ValidateGameStatus(); //Checks to make sure everything has been initialized properly.
#ifndef __EMSCRIPTEN__
SetupDiscord();
#endif
return true;
}
@ -2301,8 +2302,8 @@ void Crawler::EndGame(){
gameEnd=true;
}
::discord::Result Crawler::SetupDiscord(){
#ifndef __EMSCRIPTEN__
::discord::Result Crawler::SetupDiscord(){
auto result=::discord::Core::Create(1186719371750555780,DiscordCreateFlags_NoRequireDiscord,&Discord);
if(result==::discord::Result::Ok){
Discord->SetLogHook(
@ -2315,8 +2316,8 @@ void Crawler::EndGame(){
std::cout<<"Could not connect to Discord. Error Code "<<int(result)<<std::endl;
}
return result;
#endif
}
#endif
void Crawler::UpdateDiscordStatus(std::string levelName,std::string className){
#ifndef __EMSCRIPTEN__

@ -50,7 +50,9 @@ All rights reserved.
#include "olcUTIL_DataFile.h"
#include "Key.h"
#include "GameState.h"
#ifndef __EMSCRIPTEN__
#include "discord.h"
#endif
class Crawler : public olc::PixelGameEngine
{
@ -114,7 +116,9 @@ private:
time_t gameStarted;
void ValidateGameStatus();
#ifndef __EMSCRIPTEN__
::discord::Result SetupDiscord();
#endif
public:
Crawler();
bool OnUserCreate() override;

@ -39,7 +39,7 @@ All rights reserved.
#define VERSION_MAJOR 0
#define VERSION_MINOR 2
#define VERSION_PATCH 1
#define VERSION_BUILD 4434
#define VERSION_BUILD 4446
#define stringify(a) stringify_(a)
#define stringify_(a) #a

@ -3641,6 +3641,9 @@ namespace olc
if (c == '\n')
{
planningMarker.x = 0; planningMarker.y += 8.0f;
drawingMarker.x+=lettersWidth;
maxWidth=std::max(maxWidth,drawingMarker.x);
drawingMarker.x = 0; drawingMarker.y += 8.0f;
}
else if (c == ' ')
{
@ -3757,6 +3760,12 @@ namespace olc
if (c == '\n')
{
planningMarker.x = 0; planningMarker.y += 8.0f * scale;
for(PixelGameEngine::StringDecalData&letter:letters){
DrawPartialSprite(vi2d(pos + drawingMarker), fontRenderable.Sprite(), vi2d(letter.sourcePos), vi2d(letter.sourceSize), scale, Sprite::Flip::NONE,letter.col);
drawingMarker.x += 8.0f * scale;
}
letters.clear();
drawingMarker.x = 0; drawingMarker.y += 8.0f * scale;
}
else if (c == ' ')
{
@ -3888,6 +3897,9 @@ namespace olc
if (c == '\n')
{
planningMarker.x = 0; planningMarker.y += 8.0f;
drawingMarker.x+=lettersWidth;
maxWidth=std::max(maxWidth,drawingMarker.x);
drawingMarker.x=0;drawingMarker.y+=8.0f;
}
else if (c == ' ')
{
@ -3978,6 +3990,12 @@ namespace olc
if (c == '\n')
{
planningMarker.x = 0; planningMarker.y += 8.0f * scale;
for(PixelGameEngine::StringDecalData&letter:letters){
DrawPartialSprite(vi2d(pos + drawingMarker), GetFontSprite(), vi2d(letter.sourcePos), vi2d(letter.sourceSize), scale,Sprite::Flip::NONE, letter.col);
drawingMarker.x += float(vFontSpacing[letter.c - 32].y) * scale;
}
letters.clear();
drawingMarker.x = 0; drawingMarker.y += 8.0f * scale;
}
else if (c == ' ')
{

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 MiB

After

Width:  |  Height:  |  Size: 10 MiB

File diff suppressed because one or more lines are too long

Binary file not shown.
Loading…
Cancel
Save