Tired of searching for GUI source code and help.

Dec 31, 2010 at 4:51 AM

I can't find anything useful to me on GUI's though you 'say' you talk about it a lot all the conversations I've seen have not help.

I'm using Cosmos User Kit MS4 on M.S.V.C# Express I don't care if it looks crappy I just want to know how to make some graphics like some menus(that can use arrow keys or !mouse!) and maybe like a small desktop simple so I can learn and improve Please help im not angry I just want to learn thank you.

Coordinator
Dec 31, 2010 at 8:51 AM
As project starter, let me comment on this:

Let me start by saying that you're using an ancient Cosmos release.


Many, many people come, and start whining about missing features ("why can't I load processes", "why can't i use my mouse", etc, etc, etc), but much less people understand the amount of work we needed to do to get what IS there at this moment:

+ We have pretty stable compiler
+ We have a good development experience: you can use your Visual Studio environment to do kernel debugging
+ Small group of active people working on the project

That last point is, however, also a problem:

Small group of people can only spend a relative small amount of time on the project, which means we have to make decisions on what we put into the project: this is what we have done all the time. For example: should we spend time on debugging an implementation of the mouse, or should we work on a usable debugger, which will increase productivity down the road? (We chose the latter, but that's not the point here)

If you want this project to move forward, join the project and contribute some time to it. If you're affraid you're not familiar with OS programming, no problem, I started blank on OS programming, or even assembler (which is not used only for lowlevel stuff, rest is c#), and i turned out to do large parts of the compiler...





On Fri, Dec 31, 2010 at 5:51 AM, anti149 <notifications@codeplex.com> wrote:

From: anti149

I can't find anything useful to me on GUI's though you 'say' you talk about it a lot all the conversations I've seen have not help.

I'm using Cosmos User Kit MS4 on M.S.V.C# Express I don't care if it looks crappy I just want to know how to make some graphics like some menus(that can use arrow keys or !mouse!) and maybe like a small desktop simple so I can learn and improve Please help im not angry I just want to learn thank you.

Read the full discussion online.

To add a post to this discussion, reply to this email (Cosmos@discussions.codeplex.com)

To start a new discussion for this project, email Cosmos@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


Developer
Dec 31, 2010 at 5:04 PM

Hey i want to join the project but i don't want to be focused on one thing. I just want to sponsor useful code like the floppy driver i am  making or other useful  pieces of code.

Coordinator
Dec 31, 2010 at 5:27 PM
we welcome all initiatives for committing code, but what we want to prevent is situations where we know we would have to rewrite large parts of code. (like what's happening with the kernel at the moment)

go join the irc channel and/or mailinglist (mailinglist is better for getting all important info). a floppy driver is certainly interesting to us, but keep in mind, coming months we are working on a driver/device model, so probably your code has to change quite a bit....



On Fri, Dec 31, 2010 at 6:04 PM, forest201 <notifications@codeplex.com> wrote:

From: forest201

Hey i want to join the project but i don't want to be focused on one thing. I just want to sponsor useful code like the floppy driver i am making or other useful pieces of code.

Read the full discussion online.

To add a post to this discussion, reply to this email (Cosmos@discussions.codeplex.com)

To start a new discussion for this project, email Cosmos@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


Developer
Dec 31, 2010 at 5:45 PM
Edited Dec 31, 2010 at 5:49 PM

for guy who asked about the gui , i give you a simple way of  using mouse in gui.

NB: I took this directly from my  OS's GUI.

 

   public static void MouseEnabled()        

 {            

           bool PointerDrawn = false;

            VGAScreen.SetPaletteEntry(0,0x00, 0x00, 0x00); //Black          

            VGAScreen.SetPaletteEntry(1, 0xFF, 0xFF, 0xFF); //White            

            VGAScreen.SetPaletteEntry(2, 0x3C, 0x00, 0x00);//Red                                  

            VGAScreen.SetPaletteEntry(3, 0x00, 0x00, 0x3C);//Blue            

            VGAScreen.SetPaletteEntry(4, 0x00, 0x3C, 0x00);//Green            

             VGAScreen.SetPaletteEntry(5, 50, 50, 50);//Grey

             VGAScreen.SetMode320x200x8(); 


             VGAScreen.Clear(2);//Clear the screen Red (for your desktop of course) or whatever color u want it.            

           //if u want a Start menu call your function to draw your start menu here.

              Mouse.Initialize();//Initialize Mouse or Start Mouse


             uint x = (uint)Moused.X;            

              uint y = (uint)Moused.Y;            

              uint mx;            

              uint my;


             while (true)            

          {
                 mx = (uint)Moused.X;                

                my = (uint)Moused.Y;

                 if (mx != x || my != y || mx == x || my == y)              

                    {                    

                       if (Moused.Buttons == Moused.MouseState.Left)                    

                           {                        

                               if (mx != x & my == y)// This Checks if mouse is moving                        

                                      {                            

                                         PointerDrawn = true;                        

                                      }                        

                               else if (mx == x & my != y)// This Checks if mouse is moving                      

                                     {                            

                                          PointerDrawn = true;                         

                                      }                        

                               else if (mx != x & my != y)// This Checks if mouse is moving    

 

                                     {                            

                                         PointerDrawn = true;                        

                                      }                                                 

                                   //Call your Left click Menu or whatever u want to happen here                        

                                  // In my OS GUI i called a Method that checks where on the screen that is clicked and opens a menu or does something                        

                                  // depending on were was clicked.                                       

                                      }                           

                       else if (Moused.Buttons == Moused.MouseState.Right)                    

                                  {                        

                                      if (mx != x & my == y)// This Checks if mouse is moving                      

                                            {                            

                                                PointerDrawn = true;                        

                                             }                        

                                       else if (mx == x & my != y)// This Checks if mouse is moving                        

                                             {                            

                                                  PointerDrawn = true;                         

                                              }                        

                                      else if (mx != x & my != y)// This Checks if mouse is moving                        

                                              {                            

                                                 PointerDrawn = true;                        

                                              }                                               

                                  //Call your Right click Menu or whatever u want to happen here


                                  }                    

                       else if (Moused.Buttons == Moused.MouseState.Middle)                    

                                  {                        

                                      if (mx != x & my == y)// This Checks if mouse is moving                        

                                        {                            

                                           PointerDrawn = true;                        

                                        }                        

                                      else if (mx == x & my != y)// This Checks if mouse is moving                        

                                      {                            

                                           PointerDrawn = true;                         

                                      }                        

                                     else if (mx != x & my != y)// This Checks if mouse is moving                        

                                      {                            

                                       PointerDrawn = true;                        

                                       }                        

                                      //I left this one blank because My os doesn't have a function or menu associated with it.                         

                                     // if you want you can call Middle Click menu or whatever you want here.                   

                                   }
                       else if (mx != x & my == y) // This Checks if mouse is moving                    

                                  {                          

                                      PointerDrawn = true;                     

                                   }                    

                      else if (mx == x & my != y)// This Checks if mouse is moving                    

                                 {                        

                                    PointerDrawn = true;                    

                                 }                    

                     else if (mx != x & my != y)// This Checks if mouse is moving                    

                                {                        

                                   PointerDrawn = true; //Tells our code that the Mouse is not drawn.                    

                                }                  

        }                      

                   if (PointerDrawn == true)//Is the pointer Not Drawn?                    

                            {                             

                                       PointerDrawn = false;                          

                                       DrawPointer();                          

                           }                    

                  else                    

                          {                          

                                     DrawPointer();                            

                            }            

  }


       public static void DrawPointer()      

        {          

            VGAScreen.SetPixel320x200x8(mx, my, 1);              

            VGAScreen.SetPixel320x200x8(mx + 1, my, 1);                

            VGAScreen.SetPixel320x200x8(mx + 2, my, 1);                

            VGAScreen.SetPixel320x200x8(mx, my + 1, 1);                

           VGAScreen.SetPixel320x200x8(mx, my + 2, 1);                

           VGAScreen.SetPixel320x200x8(mx + 1, my + 1, 1);                

           VGAScreen.SetPixel320x200x8(mx + 2, my + 2, 1);                

          VGAScreen.SetPixel320x200x8(mx + 3, my + 3, 1);      

       }

    NB: you need some type of method that draws over the previous mouse position. If you don't have the code the mouse will just live a trail on the screen. 

Dec 31, 2010 at 10:11 PM

All I ask Is like some type of tutorial I know im using an old DVK but all i have is C# 2008 for all I care it can be a tutorial on how to make the screen purple with a button in the center that I can click on and it prints something on the screen
nothing fancy a simple tutorial here or on youtube or something but if it is too much work don't worry about it  I might be able to figure the stuff out on my own but it would be helpful if I had someone to help me.

 

Thank you!

PS: I'd love to join but I don't know what I could do for you anything you need if I can do it (I know a-bit of ASM, but not much.)

Developer
Jan 1, 2011 at 4:59 AM

dude i gave u what you need to create your gui. Its all there. If you want a method to check were you click on the  screen the just say it.

 

   public static bool CheckMenu(uint x, uint y, uint xSize, uint ySize)      

    {          

          for (uint bb = x; bb < x + xSize; bb++)          

               {              

                     for (uint cc = y; cc < y + ySize; cc++)              

                       {                  

                            if (Moused.X == bb && Moused.Y == cc)                  

                                 {                        

                                     return true;   //Return true if the area is not clicked                 

                                  }
                        }
                   }          

                     return false;   //Return false if the area is not clicked

        }

 

Again u need to create your own functions to draw  Menus and other stuff. I have already given you one to draw and move the mouse pointer. Even u still cannot figure it out. Then ready more on C# and GUI developing.

Jan 1, 2011 at 7:56 PM

The mouse doesn't work or the clicky stuff all it does is draw the screen & the mouse and then freezes are you sure its compatible with User Kit MS4?

Developer
Jan 1, 2011 at 9:54 PM

have you gotten the  uncommented Cosmos mouse Driver?

you need it in order for the mouse move to work. 

 

PS:  I renamed the Mouse Driver from Mouse to  Moused because Mouse class is already in the UserKit but the methods in the Mouse class are commented out.

 

So when you get the uncommented Mouse Driver just replace the "Moused" to Whatever you named  the Mouse driver.

Jan 1, 2011 at 10:56 PM

Yah I just switched your moused to mouse so that's y it didn't work, so where do you get the uncommented mouse driver??

Developer
Jan 1, 2011 at 11:43 PM

I'll put it on my website. It is located on the ProSoft Page.

You also need a password to access that page.

 

here is the password and username

Username is  iKoreSoft 

Password is WPC1177.

My Websites address is www.iKoreSoft.co.co

Jan 2, 2011 at 12:34 AM

sill no worky : (

Developer
Jan 2, 2011 at 2:03 AM

did u rename the MouseEx  class? The class Should not be rename "Mouse".

if you didn't rename the class then you just have to replace "Mouse" with "MouseEx"

 

example:

 

if you have this

Mouse.Initialize()

change it to this

MouseEx.Initialize()

 

PS: Don't use the Mouse class  in Cosmos it is comment out and will not work at all. Use the One i gave( MouseEx);

    Also don't rename the "MouseEx" class to "Mouse" it will cause Errors in the kernel. My advice to you is don't rename  MouseEx class

 

OR  IF you want i can make a Simple OS with Mouse and a Simple GUI for you to learn from. 

Jan 2, 2011 at 8:23 AM

that would be great if you could make a demo OS or something because I still cant get this mouse thing to work.

 

THANK YOU VERY MUCH TRULY APPRECIATED!!!! 

Developer
Jan 2, 2011 at 6:59 PM

You can get the Demo OS i created on the Same Page. I just uploaded it.

 

Remember 

Username is iKoreSoft

Password is WPC1177

 

PS: My website is www.iKoreSoft.co.cc. The file is on the ProSoft page.

Jan 2, 2011 at 7:22 PM

Wy are u using exadecimal to set pallet entry?

Jan 2, 2011 at 8:21 PM

Cool it works great, the last thing id like to know if its not too much trouble is how do you write words and stuff on the rectangles?

 

and as a different topic are ext2 file systems workable in cosmos?

Jan 2, 2011 at 8:31 PM

OH NO!!! I guess there is one more thing, the mouse didn't work on a real computer :O is there a fix??

Coordinator
Jan 2, 2011 at 8:43 PM
PS2 or USB?

On 1/2/2011 4:31 PM, anti149 wrote:
> From: anti149
>
> OH NO!!! I guess there is one more thing, the mouse didn't work on a
> real computer :O is there a fix??
>
> Read the full discussion online
> <http://cosmos.codeplex.com/Thread/View.aspx?ThreadId=240074&ANCHOR#Post542934>.
>
> To add a post to this discussion, reply to this email
> ([email removed]
> <mailto:[email removed]?subject=[Cosmos:240074]>)
>
> To start a new discussion for this project, email
> [email removed] <mailto:[email removed]>
>
> You are receiving this email because you subscribed to this discussion
> on CodePlex. You can unsubscribe or change your settings
> <https://cosmos.codeplex.com/subscriptions/thread/project/edit> on
> codePlex.com.
>
> Please note: Images and attachments will be removed from emails. Any
> posts to this discussion will also be available online at codeplex.com
>
Developer
Jan 2, 2011 at 9:25 PM
anti149 wrote:

O is there a fix??

Cosmos Doesn't support USB Mouse yet. The  Demo OS i wrote uses PS/2 not USB.  If you want it to work on Real Hardware then get a PS/2 Mouse otherwise check you bios if it has PS2 emulation for mouse.

Developer
Jan 2, 2011 at 9:43 PM
Edited Jan 2, 2011 at 9:45 PM

to write text you must draw it like enything else.

 

 static int x=0,y=0;

static uint tcolor=1;//text color is white

 

 static uint[]  LetterA ={0,0,0,1,0,0,0,0,
                          0,0,0,1,0,0,0,0,
                          0,0,1,0,1,0,0,0,
                          0,0,1,0,1,0,0,0,
                          0,1,0,0,0,1,0,0,
                          0,1,1,1,1,1,0,0,
                          0,1,0,0,0,1,0,0,
                          0,1,0,0,0,1,0,0};// Array for the Letter 'A'

 public static void DrawText(uint[] Arr, int width, int length)//This function draws the Array
        {
            int i;
            int t;
            int count = 0;

            for (i = 0; i < length; i++)
            {
                for (t = 0; t < width; t++, count++)
                {
                    if (Arr[count] == 1)
                    {
                        VGAScreen.SetPixel320x200x8(x + (uint)t,y + (uint)i,tcolor); 
                    }
                    
                }
            }


     }

example hot to use the DrawText Method:
            DrawText(LetterA , 8, 8);

tcolor is the color of pixels that make up the text or the text color
x is the x position you want to start drawing the text.
y is the y position you want to start drawing the text.
length is the length of the array 
width is the width of the array

 

Jan 3, 2011 at 3:03 AM

Yah I did use a ps2 mouse and it didn't work I guess I'l try it on a different PC, and that text thing was just confusing I mean how do write something on the square when you press the button(if it's not too much trouble)?

Developer
Jan 3, 2011 at 3:40 AM

If you want to write text in VGA mode you MUST DRAW IT. There is no other way of doing it.

first thing you have to do is to create a array that contains the letter you would like to write on the screen.

example if i want to write   the word  'AT' i would do the following.

 

Watch Carefully at the arrays below. Don't you see the letter 'A' and 'T'?

 static uint[]  LetterA ={0,0,0,1,0,0,0,0,
                          0,0,0,1,0,0,0,0,
                          0,0,1,0,1,0,0,0,
                          0,0,1,0,1,0,0,0,
                          0,1,0,0,0,1,0,0,
                          0,1,1,1,1,1,0,0,
                          0,1,0,0,0,1,0,0,
                          0,1,0,0,0,1,0,0};// Array for the Letter 'A'

 static uint[]  LetterT ={ 1,1,1,1,1,1,1,0,
                           0,0,0,1,0,0,0,0,
                           0,0,0,1,0,0,0,0,
                           0,0,0,1,0,0,0,0,
                           0,0,0,1,0,0,0,0,
                           0,0,0,1,0,0,0,0,
                           0,0,0,1,0,0,0,0,
                           0,0,0,1,0,0,0,0};// Array for the Letter 'T'

to write text on the screen you must do this

 x = 50;//this is the x location where i want to start writing my text.
 y = 50;//this is the y location where i want to start writing my text.

 DrawText(LetterA,8,8);//this is function to draws the 1s in the Array to the screen.
                       //the 1s in the array above represent a pixel on the screen.the DrawText function uses the array as a map to Draw the pixels on the screen.
                       //it draws only the valid pixels(the places in the array that has '1')

 x = x + 10;//Increase our X location because we don't want to draw over the previous letter.
 DrawText(LetterT,8,8);

 Where you see the 8 and 8 are length and width of the array(just like you have length and width of a rectangle)
the length of the array is how many columns of 1s and 0s it has. The width of the array is how many rows of 1s and 0s it has.

Jan 3, 2011 at 10:42 PM

yes I know you have to draw it but how do I make it so when I press the green button that appears do I just use a goto or something?

Developer
Jan 3, 2011 at 11:40 PM

You must put  it in the same draw method as the Rectangle is.

The Demo OS i made contains this. It is located in the ProcessCMD method

       if (Pressed == 0 & MenuOpenEx == true)          

       {              

         DrawRect(50, 50, 70, 45,5);//Just draw a Grey Rectangle    

          x= 51;

          y = 51;  

        ///put your DrawText(whatever letter u want here, length ,width);      

         Pressed++;          

       }

The letter u want in the drawtext method must be an array.