Pixel cohesion! But only for squares

Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
master
Nico Nico Nii 2 years ago
parent 4f8a375bec
commit bf1a0fbf17
  1. BIN
      C++ProjectTemplate
  2. 12
      main.cpp
  3. 15
      pixelGameEngine.h
  4. 1
      states.h

Binary file not shown.

@ -63,7 +63,7 @@ int MAP_WIDTH=-1;
int MAP_HEIGHT=-1;
Map*CURRENT_MAP=nullptr;
std::map<MapName::Map,Map*> MAPS;
int GAME_STATE=GameState::FILE_LOAD_SELECT;
int GAME_STATE=GameState::TEST_BOX;
vi2d SELECTED_TILE={0,0};
vi2d HIGHLIGHTED_TILE={0,0};
int EDITING_LAYER=layer::DYNAMIC;
@ -2987,6 +2987,14 @@ void SeasonI::drawGame(){
DrawBattleMoveList(OVERWORLD_POWER_SELECTION_MEMBER);
}
}break;
case GameState::TEST_BOX:{
Clear(Pixel(128,128,255));
DrawRectDecal({1,0},{(float)ScreenWidth()-1,(float)ScreenHeight()-1},DARK_RED);
DrawLineDecal({1,0},{(float)ScreenWidth(),(float)ScreenHeight()-1},DARK_RED);
DrawLineDecal({1,(float)ScreenHeight()-1},{(float)ScreenWidth(),0},DARK_RED);
DrawDecal({32,32},SPRITES["additionalFont.png"],{1,1},BLACK);
DrawStringDecal({16,(float)ScreenHeight()-24},"Screen Pixel Size: ("+std::to_string(GetScreenPixelSize().x)+","+std::to_string(GetScreenPixelSize().y)+")",VERY_DARK_GREEN);
}break;
case GameState::SHOPKEEPER_MENU:{
DrawGameWorld();
SetDrawTarget(layer::INTERFACE);
@ -5685,7 +5693,7 @@ void SeasonI::SetupGameDrawing(){
int main()
{
SeasonI demo;
if (demo.Construct(WIDTH, HEIGHT, 4, 4))
if (demo.Construct(WIDTH, HEIGHT, 1, 1,false,false,true))
demo.Start();
return 0;

@ -3348,8 +3348,19 @@ namespace olc
if (bPixelCohesion)
{
vScreenPixelSize = (vWindowSize / vScreenSize);
vViewSize = (vWindowSize / vScreenSize) * vScreenSize;
int32_t xmult = vWindowSize.x / vScreenSize.x;
vViewSize.x = (vWindowSize.x / vScreenSize.x) * vScreenSize.x;
vViewSize.y = vScreenSize.y*xmult;
vScreenPixelSize.x = vWindowSize.x / vScreenSize.x;
vScreenPixelSize.y = vScreenPixelSize.x;
if (vWindowSize.x / vScreenSize.x > vWindowSize.y / vScreenSize.y) {
int32_t ymult = vWindowSize.y / vScreenSize.y;
vViewSize.y = (vWindowSize.y / vScreenSize.y) * vScreenSize.y;
vViewSize.x = vScreenSize.x*ymult;
vScreenPixelSize.y = vWindowSize.y / vScreenSize.y;
vScreenPixelSize.x = vScreenPixelSize.y;
}
}
else
{

@ -26,6 +26,7 @@ namespace GameState{
FILE_LOAD_SELECT,
DISPLAY_CUTSCENE_TEXT,
TEST_GAME,
TEST_BOX,
};
}

Loading…
Cancel
Save