Jump to content
  • Advertisement

Hyper Sonic

Member
  • Content Count

    61
  • Joined

  • Last visited

Community Reputation

136 Neutral

About Hyper Sonic

  • Rank
    Member
  1. Hyper Sonic

    [.net] Form To Form Communication

    Yes, it looks like you don't have Form1 and Form2 on the same project. I don't work with Visual C++, but considering you used Visual Studio's wizard to create Form1 and Form2 then you're not using a Form1 object instance like new Form1().treeView1->Nodes(..) but looks like you're using Form1's static field treeView1 which I don't think is what you're trying to do. If I'm right, then you need to declare a reference to a Form1 instance inside your Form2 instance so when you click your Form2's button you'll have access to the other form: class Form1{ public TreeView treeView1; //rest of code } class Form2{ Form1 myForm1; public Form2(Form1 form1){ myForm1=form1; } void button1_Click(object sender, EventArgs e){ myForm1.treeView1.Nodes.Add(.....); } } This should work for you. Also if you don't want to create a Form2 instance giving it a reference to your Form1 instance, I think you can use ActiveForm property to get the active instance of a determined form: class Form2{ Form1 myForm1; public Form2(){ myForm1=(Form1)Form1.ActiveForm; } void button1_Click(object sender, EventArgs e){ myForm1.treeView1.Nodes.Add(.....); } }
  2. In case you're working with .NET 1.1 you won't find System.Diagnostics.StopWatch because it's available only on .NET 2.0 and above. In that case I suggest you to use DateTime object and create one DateTime before loading your form (DateTime.Now) and another when loading is done. DateTime current=DateTime.Now; //load your form TimeSpan LoadTime=DateTime.Now.Subtract(current); Also remember that your form won't necessary load at the same speed on different boxes.
  3. Hyper Sonic

    [.net] forms in a TabControl

    I'm not sure if I'm right, but I'd suggest you to create your own UserControl to implement the behavior you are looking for. Something like: public MyTabContainerControl : UserControl{...} also your own Tab control with your specific needs should be great: public abstract MyTabControlWithExitButton : UserControl{...} Your container control should load and manage dynamically implementations of MyTabControlWithExitButton. You can have something like: public GreatVisualTab : MyTabControlWithExitButton{...} public TextOnlyTab : MyTabControlWithExitButton{...} So you can load transparently each implementation as a MyTabControlWithExitButton object and manage them from your container control. For example, your container control can have some behavior like: public void LoadTab(MyTabControlWithExitButton tab); and having a separate treeview control you can call that method and your container should handle it: void OnClick{ MyTabContainerControlX.LoadTab( new TextOnlyTab(params) ); } Well it's just the first idea got in my mind but there are lot's of solutions I guess.
  4. Quote:Original post by dmoonfire There are a bunch of stuff in the `mysqldump` executable for belting out things that fit more with other stuff. I haven't tried doing sqllite, but I know that --compatiable=ansi seems to produce a mostly good version of a sql dump (if you tell sqlite to ignore bad lines). mysqldump [dbname] --compatible=ansi Another approach is to just write a quick copy routine in code that opens two connections and copies it over. You're right. I gave mysqldump a try based on a script I found on sqlite's page here: Quote:A quick way to convert a MySQL DB to SQLite3 is the following shell script (it does not claim to be complete): #!/bin/sh mysqldump --compact --compatible=ansi --default-character-set=binary mydbname | grep -v ' KEY "' | grep -v ' UNIQUE KEY "' | perl -e 'local $/;$_=<>;s/,\n\)/\n\)/gs;print "begin;\n";print;print "commit;\n"' | perl -pe ' if (/^(INSERT.+?)\(/) { $a=$1; s/\\'\''/'\'\''/g; s/\\n/\n/g; s/\),\(/\);\n$a\(/g; } ' | sqlite3 output.db I installed perl and gnu grep for Windows but I wasn't able to translate that Linux script to a working version on windows, so I decided to use your seccond approach and used two connections to interchange data.
  5. Thanks for your help. After 2 weeks of hard work with trial and error, I've managed to update my application to work with SQLite instead of MySql. The difficult part was to migrate the original MySql database to SQLite. Lots of tools are available to create and manage SQLite databases, but few were able to import data with a different format than SQL file queries or text files. Those tools were able to migrate the database from SQL or text files as long as the data type was number or text, but my problem was that I was using blob fields and I wasn't able to migrate MySQL blobs to SQLite blobs. Some tools offered migrating from ODBC and OleDb sources, but none of them were able to copy my blob data (it was corrupted!!!). I didn't try paid solutions so there is a chance to find a straight solution there, but I like to avoid paid software as much as I can. The best combination I was able to find so I could import blobs was to import MySql database from Microsoft Access (via ODBC connector for MySql) and then use SQLite2007 Pro to import the MDB file. The problem was that Microsoft Access is not free and SQLite2007 Pro Free version is limited to 100 records per import so I was forced to implement my own migration tool. The final solution involved using SQLite Administrator (Free tool) to create the Database structure and then download table by table and registry by registry all my MySql database to my .NET DataSets and then upload each registry again to my SQLite database (a seccond connection). So now I have a new Desktop database!!! Fortunately I avoided using complex sql commands in case a migration like this would happen so I only had to change my connection string and some MySql queries that were using "concat" to SQLite's version "||" operand. Hope this helps somebody willing to migrate from MySql to SQLite and if somebody knows of a straight solution please tell us. Best regards.
  6. Quote:Original post by Harry Hunt Try SQLite... it's used in a lot of apps (e.q. Firefox), it's tiny and quite powerful, too. Amazing Harry Hunt!!! It looks really interesting, I'll check it out. Thanks.
  7. Hi everybody I'm developing a simple 2D game on C# which uses complex relationships retrieved from a database. Until now I've been using MySQL, but I'm not sure it's my best option for a deployment scenario. I want to automate installation process and I'm able to install MySQL on background with a single user's click, but there is the chance to certain versions (with certain configurations) of Windows to give security issues due to privileges or some installed antivirus. I don't want my customers to complain about a bad installation process. Also some firewalls wont let MySQL work properly so, after installing there is a chance for my game to not work properly because MySQL is not giving service. Because of those reasons, I want to use a still free and easy to install database to distribute it with my game. The only choice I can figure now is a Microsoft Access .MDB database which I know I can connect to with .NET. I think installing won't be a problem because I only have to copy one file and the firewall issue won't affect a connection to a MDB file. I've heard I can't trust MDB files because when they grow too much they become unstable, but I'm not sure. Do you know any other database solution I can give a try? Thanks for your help.
  8. Hi everyone, Previously I had a problem creating my device on old boxes. http://www.gamedev.net/community/forums/topic.asp?topic_id=462107 I have a Vaio Pentium 3 with an Intel 82815 Graphics controller for a limited ammount of time to do tests. I was able to create a device so I can create an empty window. My problem now is that I can't create a simple Direct3D.Font object. I always receive an Invalid Data exception no matter what parameters I use. This is the first I get this error and I've used lots of boxes with this kind of font creation method. I was so confused that I iterated thru lots of options to check for any successfull font creation with no luck. int height=10; int width=0; int mip=1; bool isItalic=false; foreach(CharacterSet charset in Enum.GetValues(typeof(CharacterSet))) foreach(Precision precision in Enum.GetValues(typeof(Precision))) foreach(FontQuality qual in Enum.GetValues(typeof(FontQuality))) { try{ d3dFont=new Microsoft.DirectX.Direct3D.Font(device, height, width, FontWeight.Normal, mip, isItalic, charset, precision, qual, PitchAndFamily.DefaultPitch | PitchAndFamily.FamilyDoNotCare, "Arial"); MessageBox.Show("It works with "+width+" "+height+" "+mip +" "+charset+" "+precision+" "+qual); }catch(OutOfVideoMemoryException){throw;}catch{} finally{GC.Collect();} } MessageBox.Show("COULN'T CREATE A SIMPLE FONT!!!!"); The code above iterates over more than 1500 combinations with no luck. I'm not sure if the problem are my parameters or my device itself because I get an invalid data exception but I'm not sure if the device must be created in some way to create a font successfully with this box. Unfortunately I can't use dx debuger with this box and I wont have it for much time. Also, this box creates a device on 16 bits resolution mode only (DirectX 9.0c). Not sure if this has something to do with. I also updated video drivers to the latest version (from July 2002) so I don't know what else can I do. Any help will be great. Best regards.
  9. Hyper Sonic

    What's wrong with my device creation code?

    Great!!! I used user32.dll ChangeDisplaySettings() function and I can create my device successfully. Now I have different and strange problem with Direct3D.Font but I think it's better to post it on a different thread. Thanks
  10. Hyper Sonic

    What's wrong with my device creation code?

    Quote:Original post by Namethatnobodyelsetook Your backbuffer doesn't have to be in the same format as the desktop. For fullscreen, use EnumAdapterModes to check for R5G6B5, X1R5G5B5 and X8R8G8B8 support (or any of the 6 formats listed as backbuffer formats in D3DFORMAT's help) and resolutions. Though the docs claim 15 and 16 bit modes are both enumerated no matter which you pass in, it's not true. The modes are seperate. For windowed, use CheckDeviceFormat with ADAPTERFORMAT of the desktop mode (R8G8B8 in your case, but use whatever GetAdapterDisplayMode spits out), and with RTYPE of SURFACE, USAGE of RENDERTARGET, and CHECKFORMAT of the mode you want your backbuffer in (any of the 6 formats listed as backbuffer formats in D3DFORMAT's help). To be safe, also throw in a CheckDeviceFormatConversion from your 16 or 32 bit backbuffer format to whatever the desktop format is. If the desktop is 24 bit, a 32 bit backbuffer may be preferred to a 16 bit one. 16 bits will give noticable color banding. Then again a card old enough to have an actual 24 bit display instead of 32 may not be fast enough or have enough memory to handle 32 bit well, and 16 bit would be better. Yes, I'm actually using Manager.CheckDeviceFormat() to know what kind of backbuffer I need. I'm able to know what display mode and backbuffer format I need to create my device successfully. My problem is that it's possible that some user has it's display mode at 24 bits (R8G8B8) when his videocard is able to create a device only on 16 bits (R5G6B5) so the user needs to switch to 16 bits display mode manually. I know I can tell the user to do this if I detect a need to change display mode, but I want to do this programmatically and restore the original display mode when my application ends. Best regards.
  11. Hyper Sonic

    What's wrong with my device creation code?

    Hi, it works!!! I got another try with a Laptop vaio with a 4 MB video card. Used Caps Viewer and I'm begginning to understand what I need to watch for. I realized that in older machines, the adapter format is not necessary the same I need to use to create my device. The old vaio was working with an adapter of 24 bits (Format.R8G8B8) but was only able to create devices at Format.R5G6B5, so when I tried to create my device it crashed. I had to change my display setting from 24 bits to 16 bits (R5G6B5 dahh) to be able to create my device. So I understand I can't assume the current adapter format is ok to create a device, I had to change desktop settings manually to be able to run my app but I don't want my users to have to do this. If I can retrieve original display settings and change them, I'll be able to do this for my user in background. Do you know how can I change display settings from within my application? Thanks
  12. Hyper Sonic

    Help!!! What would you choose?

    Quote:Original post by hplus0603 If you're not doing 3D (and not playing 3D games), the GMA 950 is a fine graphics chip, and draws less power than the 7300. My laptop can switch between 950 and 7400, and I get at least 30% longer runtime with the 950. That's an interesting advantage. Do you know if GMA 950 implements Dual Display and if so, how good is it's performance with two different desktops? Thanks
  13. Hyper Sonic

    Help!!! What would you choose?

    Quote:Original post by Funkymunky I'd go with the geforce one, everything i've read about the integrated intel card is that its crap. I'm assuming they both come with vista, so if you go with the geforce one you'll want a second gig of ram. What's it going to be used for? *EDIT* i'd still go with the second gig of ram For the near future, it's going to be used for basic Windows XP (and lower) games development (no 3D or pixel shader stuff), but I'm planning to develop applications that take advantage of video cards power to implement two different desktops at different displays (I'm unsure if the intel option does this thing). Thanks for your comments.
  14. Hyper Sonic

    Help!!! What would you choose?

    Quote:Original post by Perost Neither of the cards are for playing games, so it doesn't really matter which you choose. If the laptop will be used to play somewhat modern games you'll have to find a laptop with a Geforce 7600 or 8600. The 15" seems to be a bit dated too, since it uses quite old components. The 17" is a bit better, but 17" is quite a lot to walk around with. Better to buy a desktop computer in that case. Your're right! 17" seems not so portable for me, but I can give it a try and Yes, the 15" is outdated, it comes with Windows XP and is Vista capable but I don't want to mess with Windows Vista (which is included in 17" model). Also I'm developing actively for Windows XP, so if I choose the 17" model, I need to install alternatively (or format) Windows XP, but Toshiba's driver page for the 17" model offers only Vista drivers (and three XP drivers related to bios, bluetooth and fingerprint) so I'm not sure if I should choose the 17" laptop. Thanks for your comments.
  15. Hyper Sonic

    What's wrong with my device creation code?

    Quote:Original post by Namethatnobodyelsetook The card may not support D16, or possibly not with a 32bit display mode, or maybe not in windowed mode. There are two seperate calls to check if a mode/depth format combo is valid. Look at the sample code in the help for CheckDepthStencilMatch. Enable the D3D debug runtimes. Your debug output window will most likely tell you exactly what it didn't like. I have a little problem. Those old boxes are not mine, they are not even physically close to me now, so this problem has made my life more difficult because I can't use D3D debug runtimes and I can only guess what's going on. May be I'll have a chance to use that box again at Monday, but I wont be able to debug, so I have to prepare a set of precompiled applications with small differences (like the use of CheckDepthStencilMatch) and see what's going on. Quote:Original post by jollyjeffers Just because the other kids are cowboy coders doesn't mean you should be A lot of books and tutorials skip over enumeration - it adds a lot of lines of code and often serves as a distraction from whatever the intention of the tutorial was. I don't know all the MDX equivalent function calls, but primarily you want to be adding checks for all resolution/format choices. Although, looking at your code again it could just be that your windowed mode initialization is missing 3 key properties - back buffer format, height and width. These are only ever set for your fullscreen branch. I'm not sure I understood. Do I have to set BackBufferFormat, BackBufferHeight and BackBufferWidth in my windowed mode initialization? I think I can add something like this to check for proper depth format: DepthFormat[] DepthFormats=new DepthFormat[]{DepthFormat.D16, DepthFormat.24X8, DepthFormat.D32 ......} Format CurrFormat=Manager.Adapters.Default.CurrentDisplayMode.Format; foreach(DepthFormat depth in DepthFormats) if(Manager.CheckDepthStencilMatch(0,DeviceType.Hardware,CurrFormat, CurrFormat,depth)){ presentParams.EnableAutoDepthStencil=true; presentParams.AutoDepthStencilFormat=depth break; } I suppose the problem should be to assume that the current adapter format is going to be ok for CheckDepthStencilMatch() and in that case I should first validate a good backbufferformat. Can I do this with Manager.CheckDeviceFormat() ? I'm not sure what else can I do.
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!