Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
takeiteasy committed Nov 29, 2023
1 parent 6992bcc commit 0597671
Show file tree
Hide file tree
Showing 12 changed files with 56 additions and 1,750 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ build/
.DS_Store
*.plist
*.obj
docs.sh
56 changes: 55 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,60 @@
# pp

This is an original version of `pp` but slimmed down to basically just the window handling functions and a few functions for image handling.
_pp_ **[ˈpiːpiː]** or "_Pixel Playground_" is a small minimal cross-platform software-rendering window + context. Click [here](https://takeiteasy.github.io/pp/) for documentation.

Platforms:
* Windows
* MacOS
* Linux
* WebAssembly (via [emscripten](https://github.com/emscripten-core/emscripten))

## Example
```c
#include "pp"

// Window event callbacks
void onKeyboard(void *userdata, int key, int modifier, int isDown);
void onMouseButton(void *userdata, int button, int modifier, int isDown);
void onMouseMove(void *userdata, int x, int y, float dx, float dy);
void onMouseScroll(void *userdata, float dx, float dy, int modifier);
void onFocus(void *userdata, int isFocused);
void onResized(void *userdata, int w, int h);
void onClosed(void *userdata);

// Buffer to store image data
static int test[640 * 480];

int main(int argc, const char *argv[]) {
// Initialize pp and create 640x480 window titled "pp"
ppBegin(640, 480, "pp", ppResizable);
// Set window event callbacks ...
// ppKeyboardCallback(onKeyboard);

// Create a simple xor pattern in the image buffer
for (int x = 0; x < 640; x++)
for (int y = 0; y < 480; y++)
test[y * 640 + x] = x ^ y;

// Keep window open and poll events (must poll every frame)
while (ppPoll()) {
// do something here ...

// Flush the buffer to the window
ppFlush(test, 640, 480);
}

// Always clean your pp
ppEnd();
return 0;
}

```
## Building
The Makefile has three options; ```default``` will build example/basic.c, ```library``` will build a dynamic library and ```web``` will also build example/basic.c, except compiled to wasm.
It's also very easy to use in your own project. Simply copy (or fork) ```pp.c``` and ```pp.h``` from the ```src``` directory. If you are on windows you will need to link ```-lgdi32```. If you're on Linux you must link ```-lX11 -lm``` and on MacOS ```-framework Cocoa```.
## License
```
Expand Down
6 changes: 0 additions & 6 deletions build.bat

This file was deleted.

3 changes: 0 additions & 3 deletions docs.sh

This file was deleted.

75 changes: 0 additions & 75 deletions examples/live.c

This file was deleted.

Loading

0 comments on commit 0597671

Please sign in to comment.