cleanup some userspace stuff
This commit is contained in:
parent
c6d1c64bfb
commit
9930624043
1
.gitignore
vendored
1
.gitignore
vendored
@ -33,5 +33,6 @@ toolchain/build
|
||||
.config
|
||||
toaru-pdfviewer
|
||||
toaru-compositor
|
||||
toaru-toolkit
|
||||
hdd/home/root/*
|
||||
hdd/home/local/*
|
||||
|
@ -1,10 +1,12 @@
|
||||
/*
|
||||
* edit
|
||||
* bim
|
||||
*
|
||||
* Bim is a Bad IMitation of Vim.
|
||||
*
|
||||
* The 'standard' text editor for とあるOS.
|
||||
*
|
||||
* A super-simple one-pass file... uh "editor".
|
||||
* Takes stdin until a blank line and writes
|
||||
* it back to standard out.
|
||||
*/
|
||||
#define _XOPEN_SOURCE 1
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -9,6 +9,9 @@
|
||||
#include "lib/window.h"
|
||||
#include "lib/graphics.h"
|
||||
|
||||
int left, top, width, height;
|
||||
window_t * wina;
|
||||
gfx_context_t * ctx;
|
||||
|
||||
int32_t min(int32_t a, int32_t b) {
|
||||
return (a < b) ? a : b;
|
||||
@ -18,31 +21,30 @@ int32_t max(int32_t a, int32_t b) {
|
||||
return (a > b) ? a : b;
|
||||
}
|
||||
|
||||
int main (int argc, char ** argv) {
|
||||
if (argc < 5) {
|
||||
printf("usage: %s left top width height\n", argv[0]);
|
||||
return -1;
|
||||
}
|
||||
void resize_callback(window_t * window) {
|
||||
width = window->width;
|
||||
height = window->height;
|
||||
reinit_graphics_window(ctx, wina);
|
||||
draw_fill(ctx, rgb(0,0,0));
|
||||
}
|
||||
|
||||
int left = atoi(argv[1]);
|
||||
int top = atoi(argv[2]);
|
||||
int width = atoi(argv[3]);
|
||||
int height = atoi(argv[4]);
|
||||
|
||||
int main (int argc, char ** argv) {
|
||||
left = 100;
|
||||
top = 100;
|
||||
width = 500;
|
||||
height = 500;
|
||||
|
||||
setup_windowing();
|
||||
|
||||
printf("[drawlines] Windowing ready for client[%d,%d,%d,%d]\n", left, top, width, height);
|
||||
resize_window_callback = resize_callback;
|
||||
|
||||
/* Do something with a window */
|
||||
window_t * wina = window_create(left, top, width, height);
|
||||
wina = window_create(left, top, width, height);
|
||||
assert(wina);
|
||||
|
||||
gfx_context_t * ctx = init_graphics_window(wina);
|
||||
ctx = init_graphics_window(wina);
|
||||
draw_fill(ctx, rgb(0,0,0));
|
||||
|
||||
|
||||
printf("[drawlines] Window drawn for client[%d,%d,%d,%d]\n", left, top, width, height);
|
||||
|
||||
int exit = 0;
|
||||
while (!exit) {
|
||||
w_keyboard_t * kbd = poll_keyboard();
|
||||
@ -57,7 +59,6 @@ int main (int argc, char ** argv) {
|
||||
draw_line(ctx, rand() % width, rand() % width, rand() % height, rand() % height, rgb(rand() % 255,rand() % 255,rand() % 255));
|
||||
}
|
||||
|
||||
//window_destroy(wina); // (will close on exit)
|
||||
teardown_windowing();
|
||||
|
||||
return 0;
|
||||
|
@ -84,7 +84,7 @@ void start_compositor() {
|
||||
int pid = fork();
|
||||
if (!pid) {
|
||||
char * tokens[] = {
|
||||
"/bin/compositor",
|
||||
"/bin/compositor2",
|
||||
NULL
|
||||
};
|
||||
int i = execvp(tokens[0], tokens);
|
||||
|
@ -13,6 +13,7 @@
|
||||
|
||||
sprite_t * sprites[128];
|
||||
sprite_t alpha_tmp;
|
||||
window_t * wina;
|
||||
|
||||
uint16_t win_width;
|
||||
uint16_t win_height;
|
||||
@ -48,8 +49,16 @@ void darken(gfx_context_t * ctx) {
|
||||
}
|
||||
}
|
||||
|
||||
void resize_callback(window_t * window) {
|
||||
win_width = window->width;
|
||||
win_height = window->height;
|
||||
reinit_graphics_window(ctx, wina);
|
||||
draw_fill(ctx, rgb(0,0,0));
|
||||
}
|
||||
|
||||
int main (int argc, char ** argv) {
|
||||
setup_windowing();
|
||||
resize_window_callback = resize_callback;
|
||||
|
||||
int width = 600;
|
||||
int height = 400;
|
||||
@ -61,23 +70,14 @@ int main (int argc, char ** argv) {
|
||||
|
||||
|
||||
/* Do something with a window */
|
||||
window_t * wina = window_create(300, 300, width, height);
|
||||
wina = window_create(300, 300, width, height);
|
||||
assert(wina);
|
||||
ctx = init_graphics_window_double_buffer(wina);
|
||||
|
||||
draw_fill(ctx, rgb(0,0,0));
|
||||
flip(ctx);
|
||||
|
||||
#if 0
|
||||
printf("Loading background...\n");
|
||||
init_sprite(0, "/usr/share/login-background.bmp", NULL);
|
||||
printf("Background loaded.\n");
|
||||
draw_sprite_scaled(ctx, sprites[0], 0, 0, width, height);
|
||||
#endif
|
||||
|
||||
#if 1
|
||||
init_sprite(1, "/usr/share/bs.bmp", "/usr/share/bs-alpha.bmp");
|
||||
#endif
|
||||
|
||||
flip(ctx);
|
||||
|
||||
@ -101,7 +101,6 @@ int main (int argc, char ** argv) {
|
||||
goto done;
|
||||
break;
|
||||
}
|
||||
//draw_fill(ctx, rgb(0,0,0));
|
||||
darken(ctx);
|
||||
draw_sprite_scaled(ctx, sprites[1], center_x(sprites[1]->width * herp), center_y(sprites[1]->height * derp), sprites[1]->width * herp, sprites[1]->height * derp);
|
||||
render_decorations(wina, ctx->backbuffer, "Graphics Test");
|
||||
|
Loading…
Reference in New Issue
Block a user