Plan 9 from Bell Labs’s /usr/web/sources/patch/applied/games-xs-responsive-suspend-cursor/4s.c

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


#include <u.h>
#include <libc.h>
#include <draw.h>
#include <thread.h>
#include <cursor.h>
#include <mouse.h>
#include <keyboard.h>

#define	N	4

typedef struct Piece Piece;
struct Piece{
	short	rot;
	short	tx;
	Point	sz;
	Point	d[N];
};

Piece pieces[]={
	{ 0, 0, 4,1,  { 0,0,  1,0,  1,0,  1,0 }},
	{ 1, 0, 1,4,  { 0,0,  0,1,  0,1,  0,1 }},
	{ 2, 0, 4,1,  { 0,0,  1,0,  1,0,  1,0 }},
	{ 3, 0, 1,4,  { 0,0,  0,1,  0,1,  0,1 }},

	{ 0, 1, 3,2,  { 0,0,  1,0,  1,0,  0,1 }},
	{ 1, 1, 2,3,  { 1,0,  0,1,  0,1, -1,0 }},
	{ 2, 1, 3,2,  { 0,0,  0,1,  1,0,  1,0 }},
	{ 3, 1, 2,3,  { 0,0,  1,0, -1,1,  0,1 }},

	{ 0, 2, 3,2,  { 0,1,  1,0,  1,0,  0,-1}},
	{ 1, 2, 2,3,  { 0,0,  0,1,  0,1,  1,0 }},
	{ 2, 2, 3,2,  { 0,0,  1,0,  1,0, -2,1 }},
	{ 3, 2, 2,3,  { 0,0,  1,0,  0,1,  0,1 }},

	{ 0, 3, 2,2,  { 0,1,  1,0,  0,-1, -1,0}},
	{ 1, 3, 2,2,  { 0,1,  1,0,  0,-1, -1,0}},
	{ 2, 3, 2,2,  { 0,1,  1,0,  0,-1, -1,0}},
	{ 3, 3, 2,2,  { 0,1,  1,0,  0,-1, -1,0}},

	{ 0, 4, 3,2,  { 0,0,  1,0,  1,0, -1,1 }},
	{ 1, 4, 2,3,  { 1,0, -1,1,  1,0,  0,1 }},
	{ 2, 4, 3,2,  { 1,0, -1,1,  1,0,  1,0 }},
	{ 3, 4, 2,3,  { 0,0,  0,1,  0,1,  1,-1}},

	{ 0, 5, 3,2,  { 0,0,  1,0,  0,1,  1,0 }},
	{ 1, 5, 2,3,  { 1,0,  0,1,  -1,0, 0,1 }},
	{ 2, 5, 3,2,  { 0,0,  1,0,  0,1,  1,0 }},
	{ 3, 5, 2,3,  { 1,0,  0,1,  -1,0, 0,1 }},

	{ 0, 6, 3,2,  { 0,1,  1,0,  0,-1, 1,0 }},
	{ 1, 6, 2,3,  { 0,0,  0,1,  1,0,  0,1 }},
	{ 2, 6, 3,2,  { 0,1,  1,0,  0,-1, 1,0 }},
	{ 3, 6, 2,3,  { 0,0,  0,1,  1,0,  0,1 }},
};

#include "xs.h"

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.