Comment tweaks, build tweaks, bugfixes
I've also disabled the "screen trick". It was ugly as hell.
This commit is contained in:
@@ -48,7 +48,7 @@ public:
|
||||
virtual void KeyDown(SDL_KeyboardEvent const& event);
|
||||
virtual void KeyUp(SDL_KeyboardEvent const& event);
|
||||
|
||||
//TODO: joystick and controller events
|
||||
//TODO: (9) joystick and controller events
|
||||
|
||||
protected:
|
||||
//control
|
||||
|
||||
@@ -84,7 +84,6 @@ void ClientApplication::Init(int argc, char* argv[]) {
|
||||
//get the info
|
||||
switch(windowInfo.subsystem) {
|
||||
case SDL_SYSWM_WINDOWS:
|
||||
//TODO: ensure that this works
|
||||
platform = "Microsoft Windows";
|
||||
fontPath = "C:/Windows/Fonts/arialbd.ttf";
|
||||
break;
|
||||
@@ -296,7 +295,7 @@ void ClientApplication::ProcessEvents() {
|
||||
activeScene->KeyUp(event.key);
|
||||
break;
|
||||
|
||||
//TODO: joystick and controller events
|
||||
//TODO: (9) joystick and controller events
|
||||
|
||||
//window events are handled internally
|
||||
case SDL_WINDOWEVENT:
|
||||
|
||||
@@ -49,7 +49,7 @@ private:
|
||||
|
||||
BaseScene* activeScene = nullptr;
|
||||
|
||||
//TODO: build a "window" class?
|
||||
//TODO: (9) build a "window" class?
|
||||
SDL_Window* window = nullptr;
|
||||
SDL_Renderer* renderer = nullptr;
|
||||
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
/* Copyright: (c) Kayne Ruse 2013-2015
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
*
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
*
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
*
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
*
|
||||
* 3. This notice may not be removed or altered from any source
|
||||
* distribution.
|
||||
*/
|
||||
#include "text_util.hpp"
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
SDL_Texture* renderPlainText(SDL_Renderer* renderer, TTF_Font* font, std::string str, SDL_Color color) {
|
||||
//make the surface (from SDL_ttf)
|
||||
SDL_Surface* surface = TTF_RenderText_Solid(font, str.c_str(), color);
|
||||
if (!surface) {
|
||||
throw(std::runtime_error("Failed to create a TTF surface"));
|
||||
}
|
||||
|
||||
//convert to texture
|
||||
SDL_Texture* texture = SDL_CreateTextureFromSurface(renderer, surface);
|
||||
if (!texture) {
|
||||
SDL_FreeSurface(surface);
|
||||
throw(std::runtime_error("Failed to create a TTF texture"));
|
||||
}
|
||||
|
||||
//cleanup
|
||||
SDL_FreeSurface(surface);
|
||||
|
||||
//NOTE: free the texture yourself
|
||||
return texture;
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
/* Copyright: (c) Kayne Ruse 2013-2015
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
*
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
*
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
*
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
*
|
||||
* 3. This notice may not be removed or altered from any source
|
||||
* distribution.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "SDL2/SDL.h"
|
||||
#include "SDL2/SDL_ttf.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
constexpr SDL_Color COLOR_WHITE = {255, 255, 255, 255};
|
||||
|
||||
//TODO: some kind of persistent display widget
|
||||
//TODO: I need a full suite of widgets
|
||||
SDL_Texture* renderPlainText(SDL_Renderer*, TTF_Font*, std::string, SDL_Color color);
|
||||
@@ -21,7 +21,7 @@
|
||||
*/
|
||||
#include "base_character.hpp"
|
||||
|
||||
//TODO: remove this
|
||||
//TODO: (3) remove this
|
||||
#include "config_utility.hpp"
|
||||
|
||||
//-------------------------
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#include "vector2.hpp"
|
||||
|
||||
//The base class for all objects in the world
|
||||
//TODO: write a better hierarchy
|
||||
//TODO: (9) write a better hierarchy
|
||||
class Entity {
|
||||
public:
|
||||
virtual void Update();
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
bool LocalCharacter::ProcessCollisionGrid(std::list<BoundingBox> boxList) {
|
||||
for(auto& box : boxList) {
|
||||
if (box.CheckOverlap(origin + bounds)) {
|
||||
//TODO: write a better collision system
|
||||
//TODO: (9) write a better collision system
|
||||
origin -= motion;
|
||||
motion = {0, 0};
|
||||
return true;
|
||||
|
||||
@@ -223,8 +223,7 @@ std::list<BoundingBox> World::GenerateCollisionGrid(Entity* ptr, int tileWidth,
|
||||
//inner loop
|
||||
wallBounds.y = snapToBase((double)wallBounds.h, ptr->GetOrigin().y);
|
||||
while(wallBounds.y < (ptr->GetOrigin() + ptr->GetBounds()).y + ptr->GetBounds().h) {
|
||||
//BUG: #45 this is the culprit; it's pulling regions into existance
|
||||
//check to see if this tile is solid
|
||||
//check to see if this tile is solid (non-existant tiles are always false)
|
||||
if (regionPager.GetSolid(wallBounds.x / wallBounds.w, wallBounds.y / wallBounds.h)) {
|
||||
//push onto the box set
|
||||
boxList.push_front(wallBounds);
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
//static functions
|
||||
//-------------------------
|
||||
|
||||
//TODO: proper checksum
|
||||
//TODO: (3) proper checksum
|
||||
static int regionChecksum(Region* const region) {
|
||||
int sum = 0;
|
||||
for(int i = 0; i < REGION_WIDTH; i++) {
|
||||
@@ -104,7 +104,6 @@ void World::UpdateMap() {
|
||||
}
|
||||
else if (regionChecksum(region) == 0) {
|
||||
//checksum failed
|
||||
//BUG: #45 Regions occasionally lose their tile data; this patches the issue, but does not resolve it
|
||||
regionPager.UnloadIf([region](Region const& ref) -> bool {
|
||||
//remove the erroneous region
|
||||
return region == &ref;
|
||||
|
||||
@@ -304,7 +304,7 @@ void LobbyMenu::SendJoinRequest() {
|
||||
|
||||
void LobbyMenu::SendLoginRequest() {
|
||||
//NOTE: high cohesion
|
||||
//TODO: have a separate login screen
|
||||
//TODO: (9) have a separate login screen
|
||||
ClientPacket packet;
|
||||
packet.type = SerialPacketType::LOGIN_REQUEST;
|
||||
packet.clientIndex = clientIndex;
|
||||
|
||||
@@ -63,7 +63,7 @@ MainMenu::MainMenu() {
|
||||
//text box
|
||||
textBox.PushLine(GetRenderer(), font, "Thanks for playing!", {255, 255, 255, 255});
|
||||
textBox.PushLine(GetRenderer(), font, "You can get the latest version at: ", {255, 255, 255, 255});
|
||||
textBox.PushLine(GetRenderer(), font, "krgamestudios.com", {255, 255, 255, 255}); //TODO: click to open the website/update
|
||||
textBox.PushLine(GetRenderer(), font, "krgamestudios.com", {255, 255, 255, 255}); //TODO: (9) click to open the website/update
|
||||
|
||||
//debug
|
||||
//
|
||||
|
||||
@@ -29,21 +29,21 @@
|
||||
|
||||
SplashScreen::SplashScreen(SDL_Window* w) {
|
||||
//fit the screen to the logo
|
||||
//TODO: refactor the code for this window trick
|
||||
//NOTE: not using this window trick
|
||||
window = w;
|
||||
SDL_GetWindowSize(window, &windowWidth, &windowHeight);
|
||||
|
||||
logo.Load(GetRenderer(), ConfigUtility::GetSingleton()["dir.logos"] + "krstudios.png");
|
||||
|
||||
SDL_SetWindowSize(window, logo.GetClipW(), logo.GetClipH());
|
||||
SDL_RenderSetLogicalSize(GetRenderer(), logo.GetClipW(), logo.GetClipH());
|
||||
// SDL_SetWindowSize(window, logo.GetClipW(), logo.GetClipH());
|
||||
// SDL_RenderSetLogicalSize(GetRenderer(), logo.GetClipW(), logo.GetClipH());
|
||||
|
||||
startTick = std::chrono::steady_clock::now();
|
||||
}
|
||||
|
||||
SplashScreen::~SplashScreen() {
|
||||
SDL_SetWindowSize(window, windowWidth, windowHeight);
|
||||
SDL_RenderSetLogicalSize(GetRenderer(), windowWidth, windowHeight);
|
||||
// SDL_SetWindowSize(window, windowWidth, windowHeight);
|
||||
// SDL_RenderSetLogicalSize(GetRenderer(), windowWidth, windowHeight);
|
||||
}
|
||||
|
||||
//-------------------------
|
||||
@@ -51,7 +51,7 @@ SplashScreen::~SplashScreen() {
|
||||
//-------------------------
|
||||
|
||||
void SplashScreen::FrameStart() {
|
||||
//TODO: config flag to change the delay
|
||||
//TODO: (0) config flag to change the delay
|
||||
if (std::chrono::steady_clock::now() - startTick > std::chrono::duration<int>(3)) {
|
||||
SetSceneSignal(SceneSignal::MAINMENU);
|
||||
}
|
||||
@@ -60,6 +60,5 @@ void SplashScreen::FrameStart() {
|
||||
void SplashScreen::RenderFrame(SDL_Renderer* renderer) {
|
||||
int w = 0, h = 0;
|
||||
SDL_RenderGetLogicalSize(renderer, &w, &h);
|
||||
//TODO: fix logo position
|
||||
logo.DrawTo(renderer, (w - logo.GetClipW()) / 2, (h - logo.GetClipH()) / 2);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user