Done all README and COC and Contributing, made an example showcase game and updated the Entity and Sprite classes
This commit is contained in:
55
CODE_OF_CONDUCT.md
Normal file
55
CODE_OF_CONDUCT.md
Normal file
@@ -0,0 +1,55 @@
|
||||
# "No Ideologies" Code of Conduct
|
||||
|
||||
The following are the guidelines we expect our community members and maintainers to follow.
|
||||
|
||||
* * *
|
||||
|
||||
## Terminology and Scope
|
||||
|
||||
**What defines a "maintainer"?**
|
||||
|
||||
* A maintainer is anyone that interacts with the community on behalf of this project. Amount of code written is not a qualifier. A maintainer may include those who solely help in support roles such as in resolving issues, improving documentation, running or participating in forums/chatrooms, or any other non-coding specific roles. Maintainers also include those that are responsible for the building and upkeep of the project.
|
||||
|
||||
**What defines a "community member"?**
|
||||
|
||||
* Anyone interacting with this project directly, including maintainers.
|
||||
|
||||
**What is the scope of these guidelines?**
|
||||
|
||||
* These guidelines apply only to this project and forms of communication directly related to it, such as issue trackers, forums, chatrooms, and in person events specific to this project. If a member is violating these guidelines outside of this project or on other platforms, that is beyond our scope and any grievances should be handled on those platforms.
|
||||
|
||||
**Discussing the guidelines:**
|
||||
|
||||
* Discussions around these guidelines, improving, updating, or altering them, is permitted so long as the discussions do not violate any existing guidelines.
|
||||
|
||||
* * *
|
||||
|
||||
## Guidelines
|
||||
|
||||
### Guidelines for community members
|
||||
|
||||
This project is technical in nature and not based around any particular non-technical ideology. As such, communication that is based primarily around ideologies unrelated to the technologies used by this repository are not permitted.
|
||||
|
||||
Any discussion or communication that is primarily focused around an ideology, be it about race, gender, politics, religion, or anything else non-technical, is not allowed. Everyone has their own ideological preferences, beliefs, and opinions. We do not seek to marginalize, exclude, or judge anyone for their ideologies. To prevent conflict between those with differing or opposing ideologies, all communication on these subjects are prohibited. Some discussions around these topics may be important, however this project is not the proper channel for these discussions.
|
||||
|
||||
### Guidelines for maintainers
|
||||
|
||||
* Maintainers must abide by the same rules as all other community members mentioned above. However, in addition, maintainers are held to a higher standard, explained below.
|
||||
* Maintainers should answer all questions politely.
|
||||
* If someone is upset or angry about something, it's probably because it's difficult to use, so thank them for bringing it to your attention and address ways to solve the problem. Maintainers should focus on the content of the message, and not on how it was delivered.
|
||||
* A maintainer should seek to update members when an issue they brought up is resolved.
|
||||
|
||||
* * *
|
||||
|
||||
## Appropriate response to violations
|
||||
|
||||
How to respond to a community member or maintainer violating a guideline.
|
||||
|
||||
1. If an issue is created that violates a guideline a maintainer should close and lock the issue, explaining "This issue is in violation of our code of conduct. Please review it before posting again." with a link to this document.
|
||||
1. If a member repeatedly violates the guidelines established in this document, they should be politely warned that continuing to violate the rules may result in being banned from the community. This means revoking access and support to interactions relating directly to the project (issue trackers, chatrooms, forums, in person events, etc.). However, they may continue to use the technology in accordance with its license.
|
||||
1. If a maintainer is in violation of a guideline, they should be informed of such with a link to this document. If additional actions are required of the maintainer but not taken, then other maintainers should be informed of these inactions.
|
||||
1. If a maintainer repeatedly violates the guidelines established in this document, they should be politely warned that continuing to violate the rules may result in being banned from the community. This means revoking access and support to interactions relating directly to the project (issue trackers, chatrooms, forums, in person events, etc.). However, they may continue to use the technology in accordance with its license. In addition, future contributions to this project may be ignored as well.
|
||||
|
||||
* * *
|
||||
|
||||
Based on version 1.0.2 from https://github.com/CodifiedConduct/coc-no-ideologies
|
||||
21
CONTRIBUTING.md
Normal file
21
CONTRIBUTING.md
Normal file
@@ -0,0 +1,21 @@
|
||||
# Contributing
|
||||
First off, we thank you for taking the time to contribute to the crumpet engine project.
|
||||
|
||||
When contributing or submitting pull requests follow these guidelines or your contribution will not be taken seriously.
|
||||
|
||||
## Make sure your code is
|
||||
- Functional
|
||||
- Maintainable and Scalable
|
||||
- Readable
|
||||
|
||||
## Linting
|
||||
- Tabs - 4 spaces
|
||||
- Same line bracing
|
||||
- Honestly just look around the code base and imitate the style
|
||||
- Keep code well commented
|
||||
|
||||
## Guidelines
|
||||
- See CODE_OF_CONDUCT.md
|
||||
|
||||
## Pull requests we reject
|
||||
Anything from b_boy_ww
|
||||
15
LICENSE.md
Normal file
15
LICENSE.md
Normal file
@@ -0,0 +1,15 @@
|
||||
The C++ Crumpet Engine
|
||||
Copyright (C) 2018 Benjamin Kyd
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
11
README.md
11
README.md
@@ -1 +1,10 @@
|
||||
# crumpet engine
|
||||
# Crumpet engine
|
||||
|
||||
A simple yet fully featured 2d game engine made in C++
|
||||
|
||||
Contributions are accepted and welcomed, see CONTRIBUTING.md for more info
|
||||
|
||||
## Contributers
|
||||
- Ben (plane000)#8618 - Founder / maintainer
|
||||
- Balexander#6597 - Excecutive producer overlord of all
|
||||
- Lyra Ceralandaria Vesara Rogers™#1114 - The big gay
|
||||
|
||||
@@ -42,10 +42,11 @@ public:
|
||||
|
||||
Vec2 Pos;
|
||||
|
||||
std::string PATH = "C:/Users/Ben/Desktop/crumpet-engine";
|
||||
// std::string PATH = "E:/Games/crumpet-engine";
|
||||
|
||||
virtual ~Entity();
|
||||
protected:
|
||||
//std::string PATH = "C:/Users/Ben/Desktop/crumpet-engine";
|
||||
std::string PATH = "E:/Games/crumpet-engine";
|
||||
private:
|
||||
std::string m_name;
|
||||
|
||||
|
||||
@@ -19,6 +19,5 @@ public:
|
||||
int MsPerUpdate; // Current updaterate
|
||||
|
||||
virtual ~Game();
|
||||
private:
|
||||
SDL_Event m_event;
|
||||
};
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
#undef main
|
||||
|
||||
#define SCREEN_WIDTH 800
|
||||
#define SCREEN_HEIGHT 600
|
||||
#define SCREEN_WIDTH 1920 // 800
|
||||
#define SCREEN_HEIGHT 1080 // 600
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
Game game("Crumpet engine", SCREEN_WIDTH, SCREEN_HEIGHT, 1, 1000 / 60);
|
||||
@@ -29,23 +29,52 @@ int main(int argc, char** argv) {
|
||||
sans.LoadSpriteTextures("/resources/sans-undertale-spritesheet.png");
|
||||
// sans.UseSpriteSheet
|
||||
|
||||
|
||||
int ground = 300;
|
||||
bool isOnGround = false;
|
||||
float vY = 0;
|
||||
float g = 9.81;
|
||||
|
||||
while (!game.IsDisplayClosed()) {
|
||||
game.PollEvents();
|
||||
|
||||
if (timer.GetTimeElapsed() >= game.TargetMsPerUpdate) {
|
||||
|
||||
// game.PollEvents();
|
||||
if (timer.GetTimeElapsed() >= game.TargetMsPerUpdate) { // Constant update rate, despite framerate
|
||||
// game logic
|
||||
std::cout << "Is Mario on ground: ";
|
||||
std::cout << isOnGround << std::endl;
|
||||
std::cout << "Mario's velocity: ";
|
||||
std::cout << vY << std::endl;
|
||||
|
||||
if (!isOnGround) {
|
||||
vY += g;
|
||||
mario.Pos.y += vY;
|
||||
if (mario.Pos.y >= ground) {
|
||||
isOnGround = true;
|
||||
mario.Pos.y = ground;
|
||||
}
|
||||
}
|
||||
|
||||
const Uint8 *state = SDL_GetKeyboardState(NULL);
|
||||
|
||||
if (state[SDL_SCANCODE_A]) mario.Pos.x -= 10;
|
||||
if (state[SDL_SCANCODE_D]) mario.Pos.x += 10;
|
||||
|
||||
while (SDL_PollEvent(&game.m_event) != 0) {
|
||||
if (game.m_event.type == SDL_QUIT)
|
||||
game.CloseDisplay();
|
||||
|
||||
if (game.m_event.key.keysym.sym == SDLK_SPACE) {
|
||||
if (isOnGround) {
|
||||
isOnGround = false;
|
||||
vY = -100;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
timer.Tick();
|
||||
}
|
||||
|
||||
game.RenderClear();
|
||||
|
||||
game.RenderEntity(&mario);
|
||||
// game.RenderEntity(&box);
|
||||
// game.RenderEntity(&mesh);
|
||||
// game.RenderEntity(&boxOutline);
|
||||
|
||||
game.RenderUpdate();
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ bool Sprite::LoadSpriteTextures(std::string path) {
|
||||
return true;
|
||||
}
|
||||
|
||||
void Sprite::UseSpriteSheet(SpriteState state, int startx, int starty, int width, int height, int seperation, int frames) {
|
||||
void Sprite::UseSpriteSheet(SpriteState state, int startX, int startY, int width, int height, int seperation, int frames) {
|
||||
m_spriteMaps[state];
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,8 @@ enum struct SpriteState {
|
||||
STATE_FRONT,
|
||||
STATE_BACK,
|
||||
STATE_JUMP,
|
||||
STATE_CROUCH
|
||||
STATE_CROUCH,
|
||||
STATE_ATTACKING,
|
||||
};
|
||||
|
||||
class Sprite : public Entity {
|
||||
@@ -36,7 +37,7 @@ public:
|
||||
SpriteState Spritestate = SpriteState::STATE_DEFAULT;
|
||||
|
||||
bool LoadSpriteTextures(std::string path);
|
||||
void UseSpriteSheet(SpriteState state, int startx, int starty, int width, int height, int seperation, int frames);
|
||||
void UseSpriteSheet(SpriteState state, int startX, int startY, int width, int height, int seperation, int frames);
|
||||
void AnimateSprite(SpriteState state);
|
||||
void Move();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user