FindNumbers: -1 IMG sector

git-svn-id: svn://kolibrios.org@8287 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2020-12-01 02:29:21 +00:00
parent 1bc102cf71
commit 02503d625c
2 changed files with 77 additions and 112 deletions

View File

@ -1,8 +1,7 @@
//(C) Artemonische, 2010
#pragma option meos
//#include "..\lib\kolibri.h--" //¯®¤ª«îç ¥¬ ¡¨¡«¨®â¥ªã á KolibriOS API
#include "kolibri.h--"
#include "kolibri.h--" //¯®¤ª«îç ¥¬ ¡¨¡«¨®â¥ªã á KolibriOS API
#ifndef AUTOBUILD
#include "lang.h--"
@ -32,9 +31,8 @@
?define WIN_TEXT "You have found all numbers! :)"
#endif
int find=10;
struct
{
int find;
struct {
int x;
int y;
int button_id;
@ -42,31 +40,26 @@ struct
int text;
}box[81];
#define BUTTON_NEW_GAME 582
void main()
{
int button,tempi,tempj;
randomize();
initialization();
draw_window();
draw_buttons();
loop()
{
switch(WaitEvent())
new_game();
loop() switch(@WaitEvent())
{
case evButton:
button=GetButtonID();
button=@GetButtonID();
IF (button==1)
{
ExitProcess();
}
IF (button==582)
IF (button==BUTTON_NEW_GAME)
{
find=10;
initialization();
draw_window();
draw_buttons();
new_game();
}
if (button>500) && (button<582) && (box[button-500].text == find)
if (button>500) && (button<BUTTON_NEW_GAME) && (box[button-500].text == find)
{
box[button-500].mark=2;
find++;
@ -88,27 +81,17 @@ void main()
}
BREAK;
case evKey: //¥á«¨ ¯à®¨§®è«® ­ ¦ â¨¥ ª« ¢¨è¨ ­  ª« ¢¨ âãà¥
IF (GetKey()==051)
{
find=10;
initialization();
draw_window();
draw_buttons();
}
IF (@GetKey()==051) new_game(); //F2
BREAK;
case evReDraw:
draw_window();
draw_buttons();
break;
}
}
ExitProcess();
}
void draw_window()
{
WindowRedrawStatus(1); //­ ç «® ¯¥à¥à¨á®¢ª¨ ®ª­ 
DefineAndDrawWindow(300,176,280,340,0x34,0xDCFFDC,0,0,"FindNumbers v1.1"); //à¨á㥬 ®ª­®
DefineAndDrawWindow(300,176,280,343,0x34,0xDCFFDC,"FindNumbers");
DrawBar(0,13,271,1,0x0CFF0C); //«¨­¨ï ᢥàåã
DrawBar(0,285,271,1,0x0CFF0C);
DrawBar(0,299,271,1,0x0CFF0C); //«¨­¨ï á­¨§ã
@ -119,15 +102,28 @@ void draw_window()
WriteText(BOT_RIGHT_TEXT_COL,289,0x80,0x000000,BOT_RIGHT_TEXT);
WriteNumber(BOT_LEFT_NUMBER_COL,289,0x80,0,find);
WriteNumber(BOT_RIGHT_NUMBER_COL,289,0x80,0,90-find+1);
DrawFlatButton(155,300,115,14,582,0xAFFFAF,F2_TEXT);
DrawNewGameButton(155,300,115,14,0xAFFFAF);
WriteText(2,304,0x80,0x000000,"Made by Artemonische,2010");
}
IF (find==91)
{
WriteText(70,100,0x80,0x000000,WIN_TEXT);
DrawFlatButton(100,110,70,20,582,0xE4DFE1,F2_TEXT);
DrawNewGameButton(100,110,70,20,0xE4DFE1);
}
WindowRedrawStatus(2); //ª®­¥æ ¯¥à¥à¨á®¢ª¨ ®ª­ 
}
void DrawNewGameButton(dword x,y,width,height,color)
{
DefineButton(x,y,width,height,BUTTON_NEW_GAME,color);
WriteText(-11*6+width/2+x+1,height/2-3+y,0x80,0,F2_TEXT,0);
}
void new_game()
{
find=10;
initialization();
draw_window();
draw_buttons();
}
void draw_buttons()

View File

@ -6,14 +6,12 @@ char os_name[8] = {'M','E','N','U','E','T','0','1'};
dword os_version = 0x00000001;
dword start_addr = #main;
dword final_addr = #stop+32;
dword alloc_mem = 0x00100000;
dword x86esp_reg = 0x00100000;
dword I_Param = #param;
dword alloc_mem = 0x0090000;
dword x86esp_reg = 0x0090000;
dword I_Param = 0x0;
dword I_Icon = 0x0;
char param[256]="";
//Events
#define evMouse 6
#define evButton 3
#define evKey 2
#define evReDraw 1
@ -44,31 +42,27 @@ inline fastcall word GetButtonID(){
EAX = EAX >> 8;
}
inline fastcall dword strlen(dword EDI){
EAX=0;
ECX=-1;
$REPNE $SCASB
EAX-=2+ECX;
inline fastcall ExitProcess(){
EAX = -1; // close this program
$int 0x40
}
byte WindowRePaint=0;
inline fastcall void WindowRedrawStatus(dword EBX)
void DefineAndDrawWindow(dword x,y,sizeX,sizeY,byte mainAreaType,dword mainAreaColour,EDI)
{
EAX = 12; // function 12:tell os about windowdraw
EBX = 1;
$int 0x40
IF (EBX==1) WindowRePaint=1; ELSE WindowRePaint=0;
}
void DefineAndDrawWindow(dword x,y,sizeX,sizeY,byte mainAreaType,dword mainAreaColour,byte headerType,dword headerColour,EDI)
{
EBX = x << 16 + sizeX;
ECX = y << 16 + sizeY;
EDX = mainAreaType << 24 | mainAreaColour;
ESI = headerType << 24 | headerColour;
$xor eax,eax
$int 0x40
}
EAX = 12; // function 12:tell os about windowdraw
EBX = 2;
$int 0x40
}
void WriteText(dword x,y,byte fontType, dword color, EDX, ESI)
{
@ -87,8 +81,6 @@ ESI = fontType<<24+ESI;
$int 0x40;
}
void DrawBar(dword x,y,w,h,EDX)
{
EAX = 13;
@ -112,16 +104,6 @@ inline fastcall void DeleteButton(dword EDX)
$int 0x40;
}
void DrawFlatButton(dword x,y,width,height,id,color,text)
{
DrawRegion_3D(x,y,width,height,0x94AECE,0x94AECE);
DrawRegion_3D(x+1,y+1,width-2,height-2,0xFFFFFF,0xC7C7C7);
DrawBar(x+2,y+2,width-3,height-3,color); //§ «¨¢ª 
IF (id<>0) DefineButton(x,y,width,height,id+BT_HIDE,0xEFEBEF); //ª­®¯ª 
WriteText(-strlen(text)*6+width/2+x+1,height/2-3+y,0x80,0,text,0);
}
dword generator; // random number generator - äëÿ ãåíåðàöèè ñëó÷àéíûõ ÷èñåë
:int random(int max)
@ -153,16 +135,3 @@ dword generator; // random number generator -
}
generator = EAX;
}
inline fastcall ExitProcess(){
EAX = -1; // close this program
$int 0x40
}
void DrawRegion_3D(dword x,y,width,height,color1,color2)
{
DrawBar(x,y,width+1,1,color1);
DrawBar(x,y+1,1,height-1,color1);
DrawBar(x+width,y+1,1,height,color2);
DrawBar(x,y+height,width,1,color2);
}