Add LICENSE and small changes.

This commit is contained in:
KikooDX 2021-03-02 11:17:40 +01:00
parent f9262b17b8
commit b35cd6e9aa
13 changed files with 111 additions and 4 deletions

29
LICENSE Normal file
View File

@ -0,0 +1,29 @@
THE FOLLOWING LICENSE APPLIES TO ALL SOURCE CODE PRESENT IN THIS REPOSITORY
Copyright © 2021 KikooDX
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the “Software”), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
THE FOLLOWING LICENSE APPLIES TO ALL LEVEL ASSETS PRESENT IN THIS REPOSITORY
Copyright © 2021 KikooDX
This work is licensed under the Creative Commons Attribution-ShareAlike 4.0 International License.
To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/4.0/ or
send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.

6
README.md Normal file
View File

@ -0,0 +1,6 @@
# Painfull Success CG
## License
The code is under the MIT license.
Levels and colors are under CC-BY-SA.4.0.
See LICENSE for more details.

View File

@ -1,3 +1,9 @@
/* SPDX-License-Identifier: MIT
* Copyright (c) 2021 KikooDX
* This file is part of
* [Painfull Success CG](https://git.sr.ht/~kikoodx/painfull-success-cg),
* which is MIT licensed. The MIT license requires this copyright notice to be
* included in all copies and substantial portions of the software. */
#pragma once
#define TARGET_UPS 60
@ -8,3 +14,5 @@
#define LEVEL_SIZE (LEVEL_WIDTH * LEVEL_HEIGHT)
#define DRAW_OFFSET_X 70
#define DRAW_OFFSET_Y 0
#define PLAYER_WIDTH 12
#define PLAYER_HEIGHT 12

View File

@ -1,3 +1,9 @@
/* SPDX-License-Identifier: MIT
* Copyright (c) 2021 KikooDX
* This file is part of
* [Painfull Success CG](https://git.sr.ht/~kikoodx/painfull-success-cg),
* which is MIT licensed. The MIT license requires this copyright notice to be
* included in all copies and substantial portions of the software. */
#pragma once
#include <stdint.h>
#include <stdbool.h>

View File

@ -1,3 +1,9 @@
/* SPDX-License-Identifier: MIT
* Copyright (c) 2021 KikooDX
* This file is part of
* [Painfull Success CG](https://git.sr.ht/~kikoodx/painfull-success-cg),
* which is MIT licensed. The MIT license requires this copyright notice to be
* included in all copies and substantial portions of the software. */
#pragma once
#include <stdint.h>
#include "conf.h"

View File

@ -1,3 +1,9 @@
/* SPDX-License-Identifier: MIT
* Copyright (c) 2021 KikooDX
* This file is part of
* [Painfull Success CG](https://git.sr.ht/~kikoodx/painfull-success-cg),
* which is MIT licensed. The MIT license requires this copyright notice to be
* included in all copies and substantial portions of the software. */
#pragma once
#include <stdint.h>
#include "vec2.h"

View File

@ -1,3 +1,9 @@
/* SPDX-License-Identifier: MIT
* Copyright (c) 2021 KikooDX
* This file is part of
* [Painfull Success CG](https://git.sr.ht/~kikoodx/painfull-success-cg),
* which is MIT licensed. The MIT license requires this copyright notice to be
* included in all copies and substantial portions of the software. */
#pragma once
typedef uint8_t tile_t;

View File

@ -1,3 +1,9 @@
/* SPDX-License-Identifier: MIT
* Copyright (c) 2021 KikooDX
* This file is part of
* [Painfull Success CG](https://git.sr.ht/~kikoodx/painfull-success-cg),
* which is MIT licensed. The MIT license requires this copyright notice to be
* included in all copies and substantial portions of the software. */
#pragma once
#include <stdbool.h>

View File

@ -1,11 +1,18 @@
/* SPDX-License-Identifier: MIT
* Copyright (c) 2021 KikooDX
* This file is part of
* [Painfull Success CG](https://git.sr.ht/~kikoodx/painfull-success-cg),
* which is MIT licensed. The MIT license requires this copyright notice to be
* included in all copies and substantial portions of the software. */
#include <gint/keyboard.h>
#include <stdint.h>
#include "input.h"
void input_update(Input *input) {
/* Read full input stream. */
clearevents();
/* For each key, update state. */
for (int i = 0; i < KEYS_COUNT; ++i) {
for (uint8_t i = 0; i < KEYS_COUNT; ++i) {
uint8_t *state = &input->states[i];
const uint8_t key = input->keys[i];
/* See if the key is pressed. */
@ -34,7 +41,7 @@ void input_init(Input *input) {
input->keys[K_JUMP] = KEY_SHIFT;
input->keys[K_RESTART] = KEY_6;
input->keys[K_EXIT] = KEY_EXIT;
for (int i = 0; i < KEYS_COUNT; ++i)
for (uint8_t i = 0; i < KEYS_COUNT; ++i)
input->states[i] = S_UP;
}

View File

@ -1,4 +1,11 @@
/* SPDX-License-Identifier: MIT
* Copyright (c) 2021 KikooDX
* This file is part of
* [Painfull Success CG](https://git.sr.ht/~kikoodx/painfull-success-cg),
* which is MIT licensed. The MIT license requires this copyright notice to be
* included in all copies and substantial portions of the software. */
#include <gint/display.h>
#include <stdint.h>
#include "level.h"
#include "tiles.h"
@ -7,9 +14,9 @@ void level_draw(Level level) {
uint16_t x = DRAW_OFFSET_X;
uint16_t y = DRAW_OFFSET_Y;
/* Cursor position. */
uint16_t cx = 0;
uint8_t cx = 0;
while (cx < LEVEL_WIDTH) {
uint16_t cy = 0;
uint8_t cy = 0;
while (cy < LEVEL_HEIGHT) {
const tile_t tile = level.content[cy * LEVEL_WIDTH + cx];
const int color = tile_color(tile);

View File

@ -1,3 +1,9 @@
/* SPDX-License-Identifier: MIT
* Copyright (c) 2021 KikooDX
* This file is part of
* [Painfull Success CG](https://git.sr.ht/~kikoodx/painfull-success-cg),
* which is MIT licensed. The MIT license requires this copyright notice to be
* included in all copies and substantial portions of the software. */
#include <gint/display.h>
#include <gint/timer.h>
#include <gint/clock.h>

View File

@ -1,3 +1,11 @@
/* SPDX-License-Identifier: MIT
* Copyright (c) 2021 KikooDX
* This file is part of
* [Painfull Success CG](https://git.sr.ht/~kikoodx/painfull-success-cg),
* which is MIT licensed. The MIT license requires this copyright notice to be
* included in all copies and substantial portions of the software. */
#include <gint/display.h>
#include <stdbool.h>
#include "player.h"
#include "vec2.h"

View File

@ -1,3 +1,9 @@
/* SPDX-License-Identifier: MIT
* Copyright (c) 2021 KikooDX
* This file is part of
* [Painfull Success CG](https://git.sr.ht/~kikoodx/painfull-success-cg),
* which is MIT licensed. The MIT license requires this copyright notice to be
* included in all copies and substantial portions of the software. */
#include <gint/display.h>
#include "tiles.h"