[FIX] Map drawing based on camera offset.
[FIX] Speech bubble not following camera.
This commit is contained in:
parent
3533f5c607
commit
5befe97969
@ -65,7 +65,7 @@
|
||||
LinkIncremental="2"
|
||||
AdditionalLibraryDirectories="..\..\Dependencies\Lib\"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="2"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
@ -166,7 +166,7 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
CommandLine="copy ..\..\Dependencies\Bin\jpeg.dll ..\..\..\Bin\
copy ..\..\Dependencies\Bin\libfreetype-6.dll ..\..\..\Bin\
copy ..\..\Dependencies\Bin\libpng12-0.dll ..\..\..\Bin\
copy ..\..\Dependencies\Bin\libtiff-3.dll ..\..\..\Bin\
copy ..\..\Dependencies\Bin\SDL.dll ..\..\..\Bin\
copy ..\..\Dependencies\Bin\SDL_gfx.dll ..\..\..\Bin\
copy ..\..\Dependencies\Bin\SDL_image.dll ..\..\..\Bin\
copy ..\..\Dependencies\Bin\SDL_ttf.dll ..\..\..\Bin\
copy ..\..\Dependencies\Bin\zlib1.dll ..\..\..\Bin\"
|
||||
CommandLine="copy ..\..\Dependencies\Bin\jpeg.dll ..\..\..\Bin\
copy ..\..\Dependencies\Bin\libfreetype-6.dll ..\..\..\Bin\
copy ..\..\Dependencies\Bin\libpng12-0.dll ..\..\..\Bin\
copy ..\..\Dependencies\Bin\libtiff-3.dll ..\..\..\Bin\
copy ..\..\Dependencies\Bin\SDL.dll ..\..\..\Bin\
copy ..\..\Dependencies\Bin\SDL_gfx.dll ..\..\..\Bin\
copy ..\..\Dependencies\Bin\SDL_image.dll ..\..\..\Bin\
copy ..\..\Dependencies\Bin\SDL_ttf.dll ..\..\..\Bin\
copy ..\..\Dependencies\Bin\zlib1.dll ..\..\..\Bin\
"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
|
@ -174,6 +174,7 @@ void Game::UpdateGame(void) {
|
||||
}
|
||||
|
||||
void Game::Render(void) {
|
||||
// SDL_FillRect(screen, NULL, 0); // You might want to clear the buffer! --konom
|
||||
if(_ingameMenu.GetStatus() == false) {
|
||||
_map.Render();
|
||||
|
||||
|
@ -23,7 +23,7 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef _WIN32
|
||||
#if !defined(_WIN32) || defined(_DEBUG)
|
||||
int main() {
|
||||
#else
|
||||
int WINAPI WinMain(HINSTANCE,HINSTANCE,LPSTR,int) {
|
||||
|
@ -65,18 +65,18 @@ void Character::Render(void) {
|
||||
// Draw some fancy speach bubbles. It is a bit of a mess, I am playing.
|
||||
if(_speachBubble.size() != 0) {
|
||||
if(_speachBubbleTimer.GetTicks() < SPEACH_BUBBLE_DISPLAY_LENGTH) {
|
||||
roundedBoxRGBA(screen, (x + w / 2) - 100,
|
||||
y - 100,
|
||||
(x + w / 2) + 100,
|
||||
y - 35,
|
||||
roundedBoxRGBA(screen, (x + w / 2) - 100 - camera.x,
|
||||
y - 100 - camera.y,
|
||||
(x + w / 2) + 100 - camera.x,
|
||||
y - 35 - camera.y,
|
||||
5, 255, 255, 255, 255);
|
||||
|
||||
filledTrigonRGBA(screen, (x + w / 2) - 100,
|
||||
y - 100,
|
||||
(x + w / 2) - 10,
|
||||
y - 40,
|
||||
(x + w / 2) + 10,
|
||||
y - 40,
|
||||
filledTrigonRGBA(screen, (x + w / 2) - 100 - camera.x,
|
||||
y - 100 - camera.y,
|
||||
(x + w / 2) - 10 - camera.x,
|
||||
y - 40 - camera.y,
|
||||
(x + w / 2) + 10 - camera.x,
|
||||
y - 40 - camera.y,
|
||||
255, 255, 255, 255);
|
||||
|
||||
_speachBubbleText.Render((x + w / 2) - 90, y - 90);
|
||||
|
@ -133,12 +133,16 @@ void Map::Update(void) {
|
||||
}
|
||||
|
||||
void Map::Render(void) {
|
||||
int xOrig = (camera.x / TILE_WIDTH);
|
||||
int yOrig = (camera.y / TILE_HEIGHT);
|
||||
int xOrig = (camera.x / TILE_WIDTH) - 1;
|
||||
int yOrig = (camera.y / TILE_HEIGHT) - 1;
|
||||
|
||||
int xEnd = (SCREEN_WIDTH / TILE_WIDTH);
|
||||
int yEnd = (SCREEN_HEIGHT / TILE_HEIGHT);
|
||||
if (xOrig < 0) xOrig = 0;
|
||||
if (yOrig < 0) yOrig = 0;
|
||||
|
||||
int xEnd = xOrig + (SCREEN_WIDTH / TILE_WIDTH) + 3;
|
||||
int yEnd = yOrig + (SCREEN_HEIGHT / TILE_HEIGHT) + 3;
|
||||
|
||||
/* the fuck is this sara? --konom
|
||||
if(xEnd < x)
|
||||
xEnd++;
|
||||
else
|
||||
@ -148,6 +152,15 @@ void Map::Render(void) {
|
||||
yEnd++;
|
||||
else
|
||||
yEnd = y;
|
||||
*/
|
||||
|
||||
if (xEnd > x) xEnd = x;
|
||||
if (yEnd > y) yEnd = y;
|
||||
if (xEnd < 0) xEnd = 0;
|
||||
if (yEnd < 0) yEnd = 0;
|
||||
|
||||
if (xOrig > xEnd) xOrig = xEnd - 1;
|
||||
if (yOrig > yEnd) yOrig = yEnd - 1;
|
||||
|
||||
for(int i = xOrig; i < xEnd; i++) {
|
||||
for(int j = yOrig; j < yEnd; j++) {
|
||||
|
Loading…
Reference in New Issue
Block a user