Time for an 2014 update…
This commit is contained in:
parent
372c577f83
commit
09687c4926
2520 changed files with 34227 additions and 7318 deletions
29
Task/Colour-bars-Display/ActionScript/colour-bars-display.as
Normal file
29
Task/Colour-bars-Display/ActionScript/colour-bars-display.as
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
package {
|
||||
|
||||
import flash.display.Sprite;
|
||||
import flash.events.Event;
|
||||
|
||||
public class ColourBars extends Sprite {
|
||||
|
||||
public function ColourBars():void {
|
||||
if (stage) init();
|
||||
else addEventListener(Event.ADDED_TO_STAGE, init);
|
||||
}
|
||||
|
||||
private function init(e:Event = null):void {
|
||||
|
||||
var colours:Array = [ 0x000000, 0xFF0000, 0x00FF00, 0x0000FF, 0xFF00FF, 0x00FFFF, 0xFFFF00, 0xFFFFFF ];
|
||||
var w:Number = stage.stageWidth / 8, h:Number = stage.stageHeight;
|
||||
var x:Number = 0, i:uint, c:uint;
|
||||
|
||||
for ( i = 0; i < 8; i++ ) {
|
||||
c = colours[i];
|
||||
graphics.beginFill(c);
|
||||
graphics.drawRect(w * i, 0, w, h);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
1 DATA1,12,6,3,14,13,15
|
||||
2 HOME : GR : FOR I = 1 TO 7
|
||||
3 READ C(I) : NEXT
|
||||
4 FOR I = 0 TO 39
|
||||
5 COLOR= C(I / 5)
|
||||
6 VLIN 0,39 AT I : NEXT
|
||||
19
Task/Colour-bars-Display/BASIC/colour-bars-display-2.basic
Normal file
19
Task/Colour-bars-Display/BASIC/colour-bars-display-2.basic
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
SW_MAXIMIZE = 3
|
||||
SYS "ShowWindow", @hwnd%, SW_MAXIMIZE
|
||||
VDU 26
|
||||
|
||||
W% = @vdu%!208 / 4
|
||||
H% = @vdu%!212 * 2
|
||||
|
||||
COLOUR 1,9
|
||||
COLOUR 2,10
|
||||
COLOUR 3,12
|
||||
COLOUR 4,13
|
||||
COLOUR 5,14
|
||||
COLOUR 6,11
|
||||
COLOUR 7,15
|
||||
|
||||
FOR C% = 0 TO 7
|
||||
GCOL C%
|
||||
RECTANGLE FILL C%*W%, 0, W%, H%
|
||||
NEXT
|
||||
20
Task/Colour-bars-Display/BASIC/colour-bars-display-3.basic
Normal file
20
Task/Colour-bars-Display/BASIC/colour-bars-display-3.basic
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
nomainwin
|
||||
colors$="black red green blue pink cyan yellow white"
|
||||
WindowWidth=DisplayWidth:WindowHeight=DisplayHeight
|
||||
UpperLeftX=1:UpperLeftY=1
|
||||
barWidth=DisplayWidth/8
|
||||
graphicbox #main.g, 0,0,DisplayWidth,DisplayHeight
|
||||
open "" for window_popup as #main
|
||||
#main "trapclose [quit]"
|
||||
#main.g "down; setfocus; when characterInput [quit]"
|
||||
#main.g "when leftButtonUp [quit]"
|
||||
#main.g "size ";barWidth
|
||||
|
||||
for x = barWidth/2 to DisplayWidth step barWidth
|
||||
i=i+1
|
||||
if i>8 then i=1
|
||||
col$=word$(colors$,i)
|
||||
#main.g "color ";col$;"; line ";x;" 0 ";x;" ";DisplayHeight
|
||||
next
|
||||
wait
|
||||
[quit] close #main:end
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
10 MODE 0:BORDER 23
|
||||
20 FOR x=0 TO 15
|
||||
30 ORIGIN x*40,0
|
||||
40 GRAPHICS PEN x
|
||||
50 FOR z=0 TO 39 STEP 4:MOVE z,0:DRAW z,400:NEXT
|
||||
60 NEXT
|
||||
70 CALL &bb06 ' wait for key press
|
||||
31
Task/Colour-bars-Display/BASIC/colour-bars-display-5.basic
Normal file
31
Task/Colour-bars-Display/BASIC/colour-bars-display-5.basic
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
Dim color(7)
|
||||
color(0) = RGB($00, $00, $00) ;black
|
||||
color(1) = RGB($FF, $00, $00) ;red
|
||||
color(2) = RGB($00, $FF, $00) ;green
|
||||
color(3) = RGB($00, $00, $FF) ;blue
|
||||
color(4) = RGB($FF, $00, $FF) ;magenta
|
||||
color(5) = RGB($00, $FF, $FF) ;cyan
|
||||
color(6) = RGB($FF, $FF, $00) ;yellow
|
||||
color(7) = RGB($FF, $FF, $FF) ;white
|
||||
|
||||
If Not InitKeyboard(): End: EndIf ;can't init keyboard
|
||||
If Not InitSprite(): End: EndIf ;can't init sprite/screen library
|
||||
If Not ExamineDesktops(): End: EndIf ;can't retrieve information about desktop
|
||||
|
||||
height = DesktopHeight(0)
|
||||
width = DesktopWidth(0)
|
||||
depth = DesktopDepth(0)
|
||||
If OpenScreen(width, height, depth, "Press ENTER to exit")
|
||||
StartDrawing(ScreenOutput())
|
||||
For c = 0 To 7
|
||||
Box((width * c) / 8, 0, width / 8, height, color(c))
|
||||
Next
|
||||
StopDrawing()
|
||||
FlipBuffers()
|
||||
|
||||
Repeat
|
||||
Delay(10)
|
||||
ExamineKeyboard()
|
||||
Until KeyboardPushed(#PB_Key_Escape) Or KeyboardPushed(#PB_Key_Return)
|
||||
CloseScreen()
|
||||
EndIf
|
||||
24
Task/Colour-bars-Display/BASIC/colour-bars-display-6.basic
Normal file
24
Task/Colour-bars-Display/BASIC/colour-bars-display-6.basic
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
DataSection
|
||||
;Black, Red, Green, Blue, Magenta, Cyan, Yellow, White
|
||||
Data.i 0, 12, 10, 9, 13, 11, 14, 15
|
||||
EndDataSection
|
||||
|
||||
Dim colors(7)
|
||||
For c = 0 To 7
|
||||
Read.i colors(c)
|
||||
Next
|
||||
|
||||
If OpenConsole()
|
||||
;The console display is 80 columns wide by 25 rows
|
||||
For r = 0 To 24
|
||||
For c = 0 To 7
|
||||
ConsoleColor(colors(c), colors(c))
|
||||
Print(Space(80 / 8))
|
||||
Next
|
||||
Next
|
||||
EnableGraphicalConsole(1)
|
||||
ConsoleLocate(0, 0)
|
||||
|
||||
ConsoleTitle("Press ENTER to exit"): Input()
|
||||
CloseConsole()
|
||||
EndIf
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
colors$ = "black,red,green,blue,magenta,cyan,yellow,white"
|
||||
html "<TABLE BORDER=1 CELLPADDING=0 CELLSPACING=4><tr height=70>"
|
||||
for i = 1 to 8
|
||||
html "<td width=20 bgcolor='";word$(colors$,i,",");"'</td>"
|
||||
next i
|
||||
html "</tr></table>"
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
10 REM The ZX Spectrum display is 32 columns wide, so we have 8 columns of 4 spaces
|
||||
20 FOR r=0 TO 20: REM There are 21 rows
|
||||
30 FOR c=0 TO 7: REM We use the native colour sequence here
|
||||
40 PAPER c: REM set the background colour for the spaces to be printed
|
||||
50 PRINT " ";: REM four spaces, the semicolon prevents newline
|
||||
60 NEXT c
|
||||
70 REM at this point the cursor has wrapped, so we don't need a newline
|
||||
80 NEXT r
|
||||
34
Task/Colour-bars-Display/C/colour-bars-display-1.c
Normal file
34
Task/Colour-bars-Display/C/colour-bars-display-1.c
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
/*Abhishek Ghosh, 6th November 2013, Rotterdam*/
|
||||
|
||||
#include<conio.h>
|
||||
|
||||
#define COLOURS 8
|
||||
|
||||
int main()
|
||||
{
|
||||
int colour=0,i,j,MAXROW,MAXCOL;
|
||||
struct text_info tInfo;
|
||||
gettextinfo(&tInfo);
|
||||
MAXROW = tInfo.screenheight;
|
||||
MAXCOL = tInfo.screenwidth;
|
||||
textbackground(BLACK); //8 colour constants are defined
|
||||
clrscr();
|
||||
|
||||
for(colour=0;colour<COLOURS;colour++)
|
||||
{
|
||||
getch(); //waits for a key hit
|
||||
gotoxy(1+colour*MAXCOL/COLOURS,1);
|
||||
textbackground(colour);
|
||||
for(j=0;j<MAXROW;j++){
|
||||
for(i=0;i<MAXCOL/COLOURS;i++){
|
||||
cprintf(" ");
|
||||
}
|
||||
gotoxy(1+colour*MAXCOL/COLOURS,1+j);
|
||||
}
|
||||
}
|
||||
|
||||
getch();
|
||||
textbackground(BLACK);
|
||||
|
||||
return 0;
|
||||
}
|
||||
23
Task/Colour-bars-Display/C/colour-bars-display-2.c
Normal file
23
Task/Colour-bars-Display/C/colour-bars-display-2.c
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
/*Abhishek Ghosh, 6th November 2013, Rotterdam*/
|
||||
#include<graphics.h>
|
||||
#include<conio.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
int d=DETECT,m,maxX,maxY,maxColours,i;
|
||||
initgraph(&d,&m,"c:/turboc3/bgi");
|
||||
maxX = getmaxx();
|
||||
maxY = getmaxy();
|
||||
maxColours = getmaxcolor();
|
||||
|
||||
for(i=0;i<maxColours;i++)
|
||||
{
|
||||
setfillstyle(SOLID_FILL,i);
|
||||
bar(i*maxX/maxColours,0,(i+1)*maxX/maxColours,maxY);
|
||||
}
|
||||
|
||||
getch();
|
||||
closegraph();
|
||||
|
||||
return 0;
|
||||
}
|
||||
12
Task/Colour-bars-Display/XPL0/colour-bars-display.xpl0
Normal file
12
Task/Colour-bars-Display/XPL0/colour-bars-display.xpl0
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
include c:\cxpl\codes; \intrinsic code declarations
|
||||
int W, X0, X1, Y, C;
|
||||
[SetVid($13); \320x200x8 graphics
|
||||
W:= 320/8; \width of color bar (pixels)
|
||||
for C:= 0 to 8-1 do
|
||||
[X0:= W*C; X1:= X0+W-1;
|
||||
for Y:= 0 to 200-1 do
|
||||
[Move(X0, Y); Line(X1, Y, C)];
|
||||
];
|
||||
C:= ChIn(1); \wait for keystroke
|
||||
SetVid(3); \restore normal text mode
|
||||
]
|
||||
Loading…
Add table
Add a link
Reference in a new issue