Text rendering properly deals with newline characters. Updated components that were not properly rendering.
This commit is contained in:
parent
5d1e0b5a7a
commit
c795e7f891
@ -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.
|
||||
|
||||
SetupDiscord();
|
||||
#ifndef __EMSCRIPTEN__
|
||||
SetupDiscord();
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -2301,22 +2302,22 @@ void Crawler::EndGame(){
|
||||
gameEnd=true;
|
||||
}
|
||||
|
||||
::discord::Result Crawler::SetupDiscord(){
|
||||
#ifndef __EMSCRIPTEN__
|
||||
#ifndef __EMSCRIPTEN__
|
||||
::discord::Result Crawler::SetupDiscord(){
|
||||
auto result=::discord::Core::Create(1186719371750555780,DiscordCreateFlags_NoRequireDiscord,&Discord);
|
||||
if(result==::discord::Result::Ok){
|
||||
Discord->SetLogHook(
|
||||
discord::LogLevel::Debug, [](discord::LogLevel level, const char* message) {
|
||||
std::cerr << "Log(" << static_cast<uint32_t>(level) << "): " << message << "\n";
|
||||
});
|
||||
discord::LogLevel::Debug, [](discord::LogLevel level, const char* message) {
|
||||
std::cerr << "Log(" << static_cast<uint32_t>(level) << "): " << message << "\n";
|
||||
});
|
||||
std::cout<<"Connected to Discord!"<<std::endl;
|
||||
UpdateDiscordStatus("Main Menu",player.get()->GetClassName());
|
||||
}else{
|
||||
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"
|
||||
#include "discord.h"
|
||||
#ifndef __EMSCRIPTEN__
|
||||
#include "discord.h"
|
||||
#endif
|
||||
|
||||
class Crawler : public olc::PixelGameEngine
|
||||
{
|
||||
@ -114,7 +116,9 @@ private:
|
||||
time_t gameStarted;
|
||||
|
||||
void ValidateGameStatus();
|
||||
::discord::Result SetupDiscord();
|
||||
#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 == ' ')
|
||||
{
|
||||
|
BIN
Crawler/pge.data
BIN
Crawler/pge.data
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
BIN
Crawler/pge.wasm
BIN
Crawler/pge.wasm
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user