[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"
|
LinkIncremental="2"
|
||||||
AdditionalLibraryDirectories="..\..\Dependencies\Lib\"
|
AdditionalLibraryDirectories="..\..\Dependencies\Lib\"
|
||||||
GenerateDebugInformation="true"
|
GenerateDebugInformation="true"
|
||||||
SubSystem="2"
|
SubSystem="1"
|
||||||
TargetMachine="1"
|
TargetMachine="1"
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
@ -166,7 +166,7 @@
|
|||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCPostBuildEventTool"
|
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>
|
</Configuration>
|
||||||
</Configurations>
|
</Configurations>
|
||||||
|
@ -174,6 +174,7 @@ void Game::UpdateGame(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Game::Render(void) {
|
void Game::Render(void) {
|
||||||
|
// SDL_FillRect(screen, NULL, 0); // You might want to clear the buffer! --konom
|
||||||
if(_ingameMenu.GetStatus() == false) {
|
if(_ingameMenu.GetStatus() == false) {
|
||||||
_map.Render();
|
_map.Render();
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef _WIN32
|
#if !defined(_WIN32) || defined(_DEBUG)
|
||||||
int main() {
|
int main() {
|
||||||
#else
|
#else
|
||||||
int WINAPI WinMain(HINSTANCE,HINSTANCE,LPSTR,int) {
|
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.
|
// Draw some fancy speach bubbles. It is a bit of a mess, I am playing.
|
||||||
if(_speachBubble.size() != 0) {
|
if(_speachBubble.size() != 0) {
|
||||||
if(_speachBubbleTimer.GetTicks() < SPEACH_BUBBLE_DISPLAY_LENGTH) {
|
if(_speachBubbleTimer.GetTicks() < SPEACH_BUBBLE_DISPLAY_LENGTH) {
|
||||||
roundedBoxRGBA(screen, (x + w / 2) - 100,
|
roundedBoxRGBA(screen, (x + w / 2) - 100 - camera.x,
|
||||||
y - 100,
|
y - 100 - camera.y,
|
||||||
(x + w / 2) + 100,
|
(x + w / 2) + 100 - camera.x,
|
||||||
y - 35,
|
y - 35 - camera.y,
|
||||||
5, 255, 255, 255, 255);
|
5, 255, 255, 255, 255);
|
||||||
|
|
||||||
filledTrigonRGBA(screen, (x + w / 2) - 100,
|
filledTrigonRGBA(screen, (x + w / 2) - 100 - camera.x,
|
||||||
y - 100,
|
y - 100 - camera.y,
|
||||||
(x + w / 2) - 10,
|
(x + w / 2) - 10 - camera.x,
|
||||||
y - 40,
|
y - 40 - camera.y,
|
||||||
(x + w / 2) + 10,
|
(x + w / 2) + 10 - camera.x,
|
||||||
y - 40,
|
y - 40 - camera.y,
|
||||||
255, 255, 255, 255);
|
255, 255, 255, 255);
|
||||||
|
|
||||||
_speachBubbleText.Render((x + w / 2) - 90, y - 90);
|
_speachBubbleText.Render((x + w / 2) - 90, y - 90);
|
||||||
|
@ -133,12 +133,16 @@ void Map::Update(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Map::Render(void) {
|
void Map::Render(void) {
|
||||||
int xOrig = (camera.x / TILE_WIDTH);
|
int xOrig = (camera.x / TILE_WIDTH) - 1;
|
||||||
int yOrig = (camera.y / TILE_HEIGHT);
|
int yOrig = (camera.y / TILE_HEIGHT) - 1;
|
||||||
|
|
||||||
int xEnd = (SCREEN_WIDTH / TILE_WIDTH);
|
if (xOrig < 0) xOrig = 0;
|
||||||
int yEnd = (SCREEN_HEIGHT / TILE_HEIGHT);
|
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)
|
if(xEnd < x)
|
||||||
xEnd++;
|
xEnd++;
|
||||||
else
|
else
|
||||||
@ -148,6 +152,15 @@ void Map::Render(void) {
|
|||||||
yEnd++;
|
yEnd++;
|
||||||
else
|
else
|
||||||
yEnd = y;
|
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 i = xOrig; i < xEnd; i++) {
|
||||||
for(int j = yOrig; j < yEnd; j++) {
|
for(int j = yOrig; j < yEnd; j++) {
|
||||||
|
Loading…
Reference in New Issue
Block a user