Skip to content

Commit

Permalink
feat: add new input and render utils (#10)
Browse files Browse the repository at this point in the history
* feat: add new render utils and key and mouse buttons

* chore: update doxygen

* feat: add doxygen

* fix: remove sonar action

* fix: add token to deploy

* fix: remove doxy files

* fix: tidy up doxygen docs

* fix: do not use ref in render target
  • Loading branch information
alegemaate authored Sep 21, 2023
1 parent d7adc6a commit 0bf2536
Show file tree
Hide file tree
Showing 20 changed files with 883 additions and 100 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Deploy Docs

on:
pull_request:
branches: [main]

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: "pages"
cancel-in-progress: false

jobs:
docs:
name: Deploy Docs
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Install graphviz
run: sudo apt install graphviz

- uses: mattnotmitt/doxygen-action@v1
with:
doxyfile-path: "./Doxyfile"

- uses: actions/upload-pages-artifact@v1
with:
path: ./docs

- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
36 changes: 0 additions & 36 deletions .github/workflows/sonar.yml

This file was deleted.

3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,5 @@ CMakeCache.txt
compile_commands.json
.ninja*
/lib
Makefile
Makefile
docs/
47 changes: 46 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,51 @@
"stdexcept": "cpp",
"streambuf": "cpp",
"cinttypes": "cpp",
"typeinfo": "cpp"
"typeinfo": "cpp",
"__bit_reference": "cpp",
"__bits": "cpp",
"__config": "cpp",
"__debug": "cpp",
"__errc": "cpp",
"__functional_base": "cpp",
"__hash_table": "cpp",
"__locale": "cpp",
"__mutex_base": "cpp",
"__node_handle": "cpp",
"__nullptr": "cpp",
"__split_buffer": "cpp",
"__string": "cpp",
"__threading_support": "cpp",
"__tree": "cpp",
"__tuple": "cpp",
"bitset": "cpp",
"charconv": "cpp",
"codecvt": "cpp",
"complex": "cpp",
"condition_variable": "cpp",
"cstring": "cpp",
"forward_list": "cpp",
"fstream": "cpp",
"iomanip": "cpp",
"ios": "cpp",
"list": "cpp",
"locale": "cpp",
"map": "cpp",
"mutex": "cpp",
"optional": "cpp",
"queue": "cpp",
"semaphore": "cpp",
"set": "cpp",
"span": "cpp",
"sstream": "cpp",
"stack": "cpp",
"typeindex": "cpp",
"unordered_set": "cpp",
"valarray": "cpp",
"variant": "cpp",
"format": "cpp",
"shared_mutex": "cpp",
"stop_token": "cpp",
"thread": "cpp"
}
}
15 changes: 15 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "Build",
"type": "shell",
"detail": "Build",
"command": "cmake --build .",
"group": "build",
"problemMatcher": "$gcc"
}
]
}
24 changes: 24 additions & 0 deletions Doxyfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
DOXYFILE_ENCODING = UTF-8
PROJECT_NAME = "ASW Lib"
PROJECT_BRIEF = "A.D.S. Games SDL Wrapper Library. A library targeted at Allegro4 users who want to switch to SDL2 and use modern c++."
TAB_SIZE = 2
EXTRACT_PRIVATE = YES
EXTRACT_PRIV_VIRTUAL = YES
EXTRACT_PACKAGE = YES
EXTRACT_STATIC = YES
EXTRACT_LOCAL_CLASSES = YES
EXTRACT_ANON_NSPACES = YES
WARN_NO_PARAMDOC = NO
INPUT = src include README.md
FILE_PATTERNS = *.cpp *.h *.md *.hpp
RECURSIVE = YES
EXAMPLE_PATH = examples
EXAMPLE_PATTERNS = *.cpp *.h *.md *.hpp
EXAMPLE_RECURSIVE = YES
USE_MDFILE_AS_MAINPAGE = README.md
SOURCE_BROWSER = YES
GENERATE_LATEX = NO
HTML_OUTPUT = docs
HAVE_DOT = YES
DOT_IMAGE_FORMAT = svg
EXTRACT_ALL = YES
25 changes: 10 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,18 @@
# asw

A.D.S. Games SDL Wrapper
A.D.S. Games SDL Wrapper.

## Usage (CMAKE)

### Add submodule
This project started as a way to easily port allegro4 games to SDL2. Now it intends to make it easier to use SDL2 in C++. A primary focus is to allow easy compilation of games using emscripten as well, and has been throughly tested with it.

```
mkdir lib
git submodule add https://github.com/AdsGames/asw lib/asw
```

### Add to CMakeLists.txt
## Usage (CMAKE)

```
set(ASW_HEADERS lib/asw)
### Fetch Content

target_include_directories(
executable_name PRIVATE
${ASW_HEADERS}
```sh
FetchContent_Declare(
asw
GIT_REPOSITORY https://github.com/adsgames/asw.git
GIT_TAG <tag from latest version>
)
FetchContent_MakeAvailable(asw)
```
2 changes: 2 additions & 0 deletions include/asw/asw.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
#include "./modules/display.h"
#include "./modules/draw.h"
#include "./modules/input.h"
#include "./modules/input_keys.h"
#include "./modules/input_mouse_buttons.h"
#include "./modules/sound.h"
#include "./modules/types.h"
#include "./modules/util.h"
Expand Down
27 changes: 18 additions & 9 deletions include/asw/modules/assets.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
/**
* @file assets.h
* @author Allan Legemaate (alegemaate@gmail.com)
* @brief Asset routines for the ASW library
* @date 2023-09-20
*
* @copyright Copyright (c) 2023
*
*/
#ifndef ASW_ASSETS_H
#define ASW_ASSETS_H

Expand All @@ -12,18 +21,18 @@ namespace asw::assets {
* BMP, GIF, JPG, LBM, PCX, PNM, TIF, XCF, XPM, XV, and WEBP. This will abort
* if the file is not found.
*
* @param filename - The path to the file.
* @return asw::Texture The loaded texture.
* @param filename The path to the file.
* @return The loaded texture.
*/
asw::Texture loadTexture(const std::string& filename);

/**
* @brief Loads a TTF font from a file. This will abort if the file is not
* found.
*
* @param filename - The path to the file.
* @param size
* @return asw::Font
* @param filename The path to the file.
* @param size The size of the font.
* @return The loaded font.
*/
asw::Font loadFont(const std::string& filename, int size);

Expand All @@ -32,16 +41,16 @@ namespace asw::assets {
* OGG and VOC. This will abort if the file is not found.
*
* @param filename
* @return asw::Sample The loaded sample.
* @return The loaded sample.
*/
asw::Sample loadSample(const std::string& filename);

/**
* @brief Create a Texture given the specified dimensions.
*
* @param w - The width of the texture.
* @param h - The height of the texture.
* @return asw::Texture The created texture.
* @param w The width of the texture.
* @param h The height of the texture.
* @return The created texture.
*/
asw::Texture createTexture(int w, int h);
} // namespace asw::assets
Expand Down
15 changes: 12 additions & 3 deletions include/asw/modules/core.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
/**
* @file core.h
* @author Allan Legemaate (alegemaate@gmail.com)
* @brief Core routines including main loop and initialization
* @date 2023-09-20
*
* @copyright Copyright (c) 2023
*
*/
#ifndef ASW_CORE_H
#define ASW_CORE_H

Expand All @@ -14,9 +23,9 @@ namespace asw::core {
/**
* @brief Initializes the core module.
*
* @param width - The width of the window.
* @param height - The height of the window.
* @param scale - The scale of the window.
* @param width The width of the window.
* @param height The height of the window.
* @param scale The scale of the window.
*/
void init(int width, int height, int scale = 1);

Expand Down
Loading

0 comments on commit 0bf2536

Please sign in to comment.