
Nerseus
*Experts*
-
Posts
2607 -
Joined
-
Last visited
Everything posted by Nerseus
-
If you're writing a game that you want others to play, I assume you'll have a setup (if it's more than just a simple game that you post here, for instance). In that case, installing DirectX (or whatever extra libraries you need) shouldn't be that big of a deal. As for you using DirectX JUST for DirectInput, I wouldn't bother. DirectInput is nice and has some great features, but most of the advanced stuff is for obtaining exclusive control over the mouse and/or keyboard (or joysticks, etc.) when doing a full screen app. If you just plan on having basic mouse/keyboard input, I'd stick with GetAsyncKeyState or the basic windows events. -Ner
-
It's up to you, really. Normally, you'd create two triangles that are Transformed and Lit already (as if doing a sprite) and draw whatever you want on a texture which would be applied to those triangles. You can set the alpha blend (and alphablendenable) to achieve a translucent effect. -nerseus
-
Looks good (haven't tried it yet, but will tonight) from the screenshots, plus anyone with the name Dan can't be all that bad (my name, too). :p As for the pause on a keypress, there's a nifty trick you can use that really helps (I stole the idea from MS). Create an array of bool[256] and initialize all values to false. In the key down event, set the appropriate value to true (so the letter a, which is 65, would set keys[65] = true). On key up, set it back to false. In your game loop (I assume you have one), you can check what keys are currently down and take an action based on that. Then you don't need GetAsyncKeyState. One note: I only noticed a Shields value and a Hits value displayed while playing. But when Game Over came up, I had a score. No "real" shoot-em-up would NOT give you a score while playing :) -nerseus
-
Do you get an error? Does it let you type in the grid but doesn't save? What's the problem exactly? -Ner
-
I think Derek was pointing out that dynamically hiding properties is a bad design decision. I had a similar requirement (sort of), but I didn't hide the other property, I just disabled it. Basically, if Property A is True then Property B must also be True. But if Property A is False, then Property B could be True or False. I don't remember what I did though - it was almost a year ago :) -Ner
-
If you're using SQL Server, I'd say you probably want a temp table. You would/should fill a temp table with your 10 random questions, filling in the primary key (your Question table should have some unique identifier, or Primary Key). Then do a SELECT from the Questions table joining to the temp table to get your questions. Follow that with a second query (in the same stored procedure or dynamic SQL) which SELECTs from the Answers table using the QuestionID from the temp table. If you're using Access (this would also work for SQL Server), fill a DataSet with the data returned from your First Query. Then loop through each row returned and run a separate query to get the Answers for that QuestionID (whatever the Primary Key column is called). You can merge the returned rows into the original DataSet, in an Answers table. After all data is in one DataSet (two tables), you can add a relationship to hook up the answers to the questions. Or, you may just need a DataView with the proper filter - depends on how you're going to get at the answers for each question and what you're doing with them. Regardless of your solutions, you're going to HAVE to have a Primary Key of some kind on the Questions table and have a matching Foreign Key on the Answers table. I would definitely NOT use a single join to return questions and answers as you'd be returning the same questions 4 times (once per answer) - almost always a no-no when using a relational database. -ner
-
Fill Combo box with values from Dataset
Nerseus
replied to Shaitan00's topic in Database / XML / Reporting
You have to also set the DisplayMember property. If you set the DataSource to a DataSet, the DisplayMember should be "TableName.ColumnName". If you bind DataSource to a DataTable, then the DisplayMember can be the column name. comboBox1.DataSource = myDataSet; comboBox1.DisplayMember = "LookupTable.Val"; comboBox2.DataSource = myDataSet.Tables["LookupTable"]; comboBox1.DisplayMember = "Val"; -Ner -
I assume you're doing databinding to one row in your table? You'll have to use the DataView's Find method to get an index to the row you want (you can also use the DataTable's DefaultView property, which is a DataView). Then set the BindingContext's Position property to that index. There is no built-in "current row" pointer in a DataSet. It's handled through a CurrencyManager object. The BindingContext property on the form is your key to getting there (you can also create your own CurrencyManager). -Nerseus
-
Using DataSets to hold data is a perfect fit. Whether you use binding or not is another question, but I'd use it where appropriate (how's that for a generic answer?). For instance, even if you don't want to bind your ComboBox to the table, you can still using binding to populate the dropdown. Now if you're using replication on a client machine, pulling down large chunks of data to a DataSet isn't much of a concern. But if the user must pull a large chunk across the network (large being relative - you'll have to run tests yourself), it could possibly affect performance of the app, network, etc. Keep in mind that if you create a DataSet from an XSD file, Microsoft has provided a tool that will automatically generate a class that looks like the table (including creating properties for each field in the table, etc.). -Ner
-
I'm finishing up an About box and I'd like to fill a listbox or textbox with info about the currently loaded DLLs - their version numbers, dates, etc. I'm also loading DLLs dynamically so the main MDI form (which will host the About box) will need to scan ALL of the loaded DLLs including the ones loaded dynamically and the .NET framework DLLs. I'm about 99% sure it can be done, as I can see the info being spit out into the Debug window in the IDE (at lease the file location of the DLL). Any ideas? Thanks, Ner
-
Maybe for now, wyrd. But through my handy-dandy time machine I went forward 5 years (or was it 15?) and saw a nifty game titled "wyrd's wonderful world of wacky worms", and IT was the best FPT ever. I would have gone farther ahead to see if there was a version 2, but I got hungry and came back to present time to get a taco. So, keep plugging away and maybe you can upset Valve for the next best FPS! (this is random thoughts, right?) -Nerseus
-
The function StrConv doesn't work in SQL Server. As stated above, you'll have to change the collation in SQL Server as by default, all columns are case-insensitive. I can't think of a way to do a case-sensitive search if you want the column to remain case-insenstive. -Nerseus
-
Are you using Access? -Nerseus
-
That will work if you really want that value to be the default for every row, which you might. If you just want the values to be pre-populated one time, use NewRow and Add. You won't be able to use the BindingContext to add a row though - you'll have to use the original DataTable. Try something like: Dim row as DataRow = dsDataSet.Tables("tblSomeTable").NewRow() row("ColumnName") = Value dsDataSet.Tables("tblSomeTable").Rows.Add(row) On the last line, the Add method might be AddRow, I can't remember offhand. -Nerseus
-
If you're using bound controls, never set the control's Text property as it won't update the dataset. Instead, set the dataset's value, which will automatically reflect in the bound control. -nerseus
-
You'll need to re-run the query. That means filling a new DataSet or merging the rows with your existing ones. You'd have to write special queries to get the data you first retrieved via each table's Primary Key (will definitely work), or re-run your original query if you're sure it will return the same rows. Is this for presentation, as in "You've made changes from blah to blah and someone else has updated it to blah behind the scenes"? Sounds robust, but might be tricky. Good luck :) -nerseus
-
Visual Studio is just a tool to write code. The language C++ is the only one that currently supports unmanaged code. You can also program C++ to use managed code. Better is relative - and subject to opinion. If you program C++ you have a choice - use the managed extensions which provide a LOT of code and functionality (garbage collection, for instance) or unmanaged. I'm no C++ expert but that's the basics :) Once upon a time, people thought the same thing about Visual Basic. You had to have a 3 meg, then 6 meg, then 8 (or 12 meg) DLL to interpret the VB p-code. But people got over that fear just as they will about the .NET framework (which is a required install for all apps that use it). It's about 20 meg but a one time install (save upgrades/updates). For clients it's not such a big deal. If you're writing software to sell, it's probably a bigger deal. -Nerseus
-
*wonders what size the form was when I zipped it up :)* It will change the amount of tiles drawn based on the Form's size. I originally had the form starting out maximized but I didn't like that, not one little bit (FAR too slow) :) -nerseus
-
I ran my own tests and confirmed what wyrd is seeing. I draw roughly 330 32x32 rectangles with DrawImage and I only get about 30 FPS. I create the Graphics object outside of the main loop. Inside the loop I do a few small calculations (maybe 4 multiplications) and use a double loop to call DrawImage. I only call DoEvents once a second (after the FPS is calculated) to minimize extra time. If you make the form bigger, it slows down even more. My machine is a P4 1.69 Ghz with 1.5 gig memory and a Radeon 9500 Pro (rocks!). I haven't tried using BitBlt in C# yet, but I know that in VB6 days I'd get something crazy like 300 or 400 FPS. I've attached the TEST project. Don't flame me on the code, only took 1.25 hours to write :) -nerseus drawtest1.zip
-
Database Advice and selection Please
Nerseus
replied to Answer's topic in Database / XML / Reporting
You can use Visual Studio to create an MSDE database? How do you do that? :) -Nerseus -
Well, you posted in the DirectX forum :) If you know the video type (AVI, MPG, etc.), you can search google to find information about the format, but you'd have to write the decoder yourself. There are some free decoders available at SourceForge. I've seen some GUI tools that are Open Source that use the Open Source libraries. By looking at the code for either of those, you should be able to find what you're looking for. This isn't going to be an afternoon or even a weekend's worth of looking around and then writing an app to take out each frame though. Manipulating images is a tough business, even with source code provided to you. -Nerseus
-
The anchor tag is the basic of basic HTML. If you're building some web-based forum software, you might want to read up on it a bit :) The anchor is the way to go. You will have to define an anchor at any point you might want to link to. When you have the link TO that page, you can use the pound sign to indicate the name (as jorge pointed out). You can use JUST the anchor to link to an achor in the current page, or put it on the end of a URL to go to a specific place in a page, such as in this example: http://www.xtremedotnettalk.com/showthread.php?s=&threadid=75101#post376469 The above shows a link to this topic with the full URL to the page, the thread (#75101) and the anchor (post376469). You can right click on a web page, select View Source, and look at how other pages work. The HTML tags and syntax are free to grab. Some Javascript code might be copyrighted and the content of almost all pages is copyrighted through the Digital Millenium Act (for now). So plunder away (the HTML that is)! -Nerseus
-
It sounds like you're binding Tab2 to a different DataSet than Tab1? Why? If you bind to both, updates in one will show in the other (but you'd have to bind to the right row, or the updates on Tab2, in individual controls, may still show record 1). A DataAdapter/DataSet is not sync'd with the database. If you make changes they will not refresh automatically. You must do the refreshing. Each DataSet is also stored in memory separately and they are not sync'd either. So even though they were filled with the same query, once that data was loaded into each DataSet, they became their own distinct repositories. I'd suggest using one DataSet in your case (seems right from the limited info you gave). If not, changes to one DataSet will have to be manually sync'd with the other, either by merging one DataSet with another, or refilling one (or all) datasets from the database (a lot more network traffic). -Nerseus
-
Database Advice and selection Please
Nerseus
replied to Answer's topic in Database / XML / Reporting
Inserting 10,000 records can be coded many different ways. For instance, were you recreating the command object on every pass in the loop? Were you recreating the parameters on every pass? How likely is it that this would occur in "real life" (inserting 10,000 records in one big loop)? It sounds like your code is still doing 600+ inserts per second. Is your single (or possibly a few users) going to really be doing this? Or, as you said, they're just doing a simple read/update or delete? Even the poorest of code should read or save a piece of data in well under 1 second. I'd still suggest trying MSDE for a week or so. Getting opinions is good, but having first hand experience is the best. -Nerseus -
You can't do it automatically. The best you can do is change Table to some other word, but all subsequent tables in the DataSet will still have a number at the end, but use your new table name. So if you did: da.Fill(ds, "NewTableName") you'd get NewTableName1, NewTableName2, etc. There's no way for ADO.NET to pull out the table name from your query to put in the DataSet automatically. A resultset from SQL Server or Access (using a SELECT) only contains columns and a "table definition" that matches those columns. You may be doing "SELECT * FROM MyTable" but you might also be doing "SELECT * FROM MyTable INNER JOIN MySecondTable". Which table name is right? What if you selected from a View (a SQL Server object that only looks like a table), which might join two or three tables? Manual is the only way to go in this case. You can automate if you'd like, but it's still manual in some way. For instance, you could have every query return the table name through a simple SELECT statement just before the real select, as in: SELECT 'MyFirstTable' SELECT * FROM MyFirstTable SELECT 'MySecondTable' SELECT * FROM MyFirstTable INNER JOIN MySecondTable... After the fill, loop through the even numbered tables and set their name to the previous table's row's value. Then delete those odd numbered tables. At my work, we define all query results through XSDs. We use a matching metadata file for the XSD (DataSet) that contains table names (the order in the XML metadata must match the order returned from a Stored Proc). The meta data can contain other information, too. But it's all up to you to code it. -Ner