How can I quickly rename an open file in WebStorm? - webstorm

The documentation for WebStorm says if you want to rename a file, do it in the Project Tool window. The problem is that finding a file in the Project Tool window is a hassle. If you start typing there to find the file, it won't be able to locate it unless it is in an expanded folder.
How can I easily rename a file in WebStorm?

There is no way to rename file right from the editor. Try Navigate/Select In.../Project view to open a file in Project Tool window and then use Refactor/rename in its right-click menu
You can also enable the 'Autoscroll from source' Project tool window option to have the currently opened file auto-selected in the project tree
Also, Refactor/rename is available in file right-click menu in the Navigation Bar if it's enabled (View/Navigation bar)

In addition to that, You can use the shourtcut.
Click on the file in the project window & Press the buttton Shift+F6.

Right click on the file -> Refactor -> Rename or just use Shift+F6 as a shortcut and a dialog window will open up so you can change the name.

Related

Create a new header file in Visual Studio 2019 with C++?

I am using Visual Studio 2019 and am trying to create a header file, I cannot seem to figure out how to though. I have seen many tutorials which simply create a new item and select the header file template. I have searched everywhere in Visual Studio and don't see anyway to make a header file. Is there a way to do this or is it through some extension and if so which one?
I tried using the solution explorer extension to create a header file as I had seen many videos do but when I create a new folder to create the header in I simply get an error message for that extension.
To create a header file for a new class, right-click to open the shortcut menu for the MathLibrary project in Solution Explorer, and then choose Add > New Item. In the Add New Item dialog box, select Visual C++ > Code. In the center pane, select Header File (. h).
Open visual studio from the left select new project a dialogue box appears on the dialogue box select empty project (don't select console application) then press OK a blank visual screen will appear now on the right side you will see a box named solution explorer(if you don't find it press Ctrl+Alt+l) with your project name under your project right click on header file select add then select new item a dialogue box appears with file types select header file(.h) name your header file and then press add your new header file is created
1.Create new project
2.In Solution Explorer put in folder Header Files your Header File
3. In Resource Folder put your Resource File(library)
4.Use your library in your source file

In WebStorm, how can someone view the current file in the Project View?

With WebStorm, here is how I find the file containing a specific word. I painfully
global-search a word,
click open the file, then
memorize its path and try to
click my way down the folder structure.
There must be an easier way!
Once file is opened/current, locate it in folder structure by clicking on the icon, shown (called 'scroll from source')
enjoy!
There is a Scroll from source button in the Project view toolbar
it selects the currently opened file in the project tree. Also, you can assign a preferred shortcut to Select in Project View action in Settings | Keymap | Other.
Another option is using Navigate | Select in... | Project View.
Note that you can enable auto-scrolling from source for all files: open Project View options dropdown and choose the Autoscroll from source - when it's enabled, current file is auto-selected in the Project view on opening.

Is it possible to put the SDL .lib, .dll, and header files somewhere so I can just type #include <SDL2.h> in a visual studio 2017 RC project?

My question is, is there a place(s) I can put the SDL .lib, dll, and header files, or process I can do, so when I create a C++ project I can just type #incldue <SDL2.h> instead of having to mess about with the project settings every time. Also making a project template is not a desirable solution to this question. Also, the IDE I am using is visual studio 2017 RC, running on windows 10. I also have access to the SDL source file so I could do something with the .c files if necessary.
Note that the desired solution would allow the programmer to include sdl in the same way they would include something like #include <stdio.h>, no extra work.
Although "making a project template is not a desirable solution to this question", I suggest, regarding Visual Studio 2017 Community, make it. You can find instructions at (wikihow.com/Set-Up-SDL-with-Visual-Studio-2017). Following is an overview.
A. Downloading SDL and Creating Empty project.
A.1. Create folder SDL, and put folder SDL2-2.0.8 in it. In directory (disk) C:, create (by right click > New > Folder) new folder called SDL. If desired, you can choose another directory or folder, and another name for the new folder. Click at https://www.libsdl.org/download-2.0.php. Scroll to the bottom of the page and find Development Libraries. Under Windows: click the first entry: SDL2-devel-2.0.8-VC.zip (Visual C++ 32/64-bit). Drag (or, by right click, copy and paste) folder SDL2-2.0.8 from the window where it is downloaded, into folder C: > SDL.
A.2. Create Empty project. Open Visual Studio Community 2017, and create Empty project. In the Name: text box, type SDLproject. After the Location text box, click Browse... and navigate C: > SDL. Click Select folder. The Location now is C:\SDL. Make sure the Create directory for solution box is not checked. Click [OK]. Create source file with template C++ File (.cpp). Name it Source.cpp. The Location should be C:\SDL\SDLproject.
B. Installing SDL2-2.0.8 on Project
B.1. Add the Include folder. Right click on the name of your project, that is SDLproject (if you chose it), and select Properties. Open the C/C++ dropdown menu. Click General > Additional Include Directories > down arrow at the right of the field > Edit... in the drop down menu. At the top of the Additional Include Directories window, click the brown folder icon (the first icon). Click the three dots (...) next to the text box that is created. In the Select Directory window, navigate C: > SDL > SDL2-2.0.8, and click include folder. The Folder should be include. Click Select Folder on the Select Directory window and [OK] in the Additional Include Directories window.
B.2. Add the x86 folder. Open the Linker dropdown menu, and click General. Click Additional Library Directories entry, and click the down arrow at the right of the field. Click Edit... in the dropdown menu. At the top of the Additional Library Directories window, click the brown folder icon. Then click the three dots next to the text box that is created. In the Select Directory window, navigate C: > SDL > SDL2-2.0.8, and then double click lib folder, followed by clicking x86 folder. The Folder is x86. Click Select folder on Select Directory window and [OK] on Additional Library Directories window.
B.3. Add the two library files. In the Linker dropdown menu, click Input. Click the Additional Dependencies entry > the down arrow at the right of the field > Edit... in the dropdown menu. In Additional Dependencies window copy and paste SDL2.lib; SDL2main.lib in the top-most text box. Click[ [OK] in the Additional Dependencies window. In the Linker dropdown menu, click System > SubSystem. Click the down arrow and select Console(/SUBSYSTEM:CONSOLE) from the dropdown menu. Click [Apply], then [OK] on the Property Pages window.
B.4. Configure the linker subsystem to console. In the Linker dropdown menu, click System > SubSystem. Click the down arrow and select Console(/SUBSYSTEM:CONSOLE) from the dropdown menu. Click [Apply], then [OK] on the Property Pages window.
B.5. Copy the SDL2.dll file from x86 to your main project file. Navigate C: > SDL > SDL2-2.0.8 > lib > x86 in file explorer. In x86 folder click SDL2.dll file > right-click > Copy. Navigate to your C: > SDL > SDLproject. Right-click an empty area in SDLproject folder, and select Paste. The SDL2.dll file should now be in your project directory along with your Source.cpp file and a few other files created by Visual Studio.
Now you can compile and run your SDL program.
C. Creating project with SDL project template.
C.1. Create project template. By Windows's Paint program create icon with file name SDL. Go to Visual Studio and open SDLproject. On V.S. menu click Project > Export Template.... On Export template Wizard check Project Template..., if it's not checked. Click Next >. On Select Template Options, Template name:'s text field, type SDL. Click the upper [Browse...] (that one next to Icon Image: text field). Navigate to folder Images. Click image SDL. Click [Open]. Now path of Icon Image: is ending with \SDL.png. Click [Finish].
C.2. Create project with SDL project template.
C.2.1. On V.S. click File > New > Project.... On New Project window, click template: SDL. In Name:'s text field, type: SDLproject-1. Location is C:\SDL. Be sure Create directory for solution is unchecked. Click [OK].
C.2.2. On Solution Explorer, double click Source Files. Click Source.cpp > right click > click Exclude From Project.
C.2.3. Again right click Source Files > Add > New Item.... On Add New Item - SDLproject-1 window, click C++ File (.cpp). In Name:'s text field, type: Source-1.cpp. The Location is C:\SDL\SDLproject-1. Click Add. Now on Solution Explore, below Source Files, you have Source-1.cpp file only.
C.2.4. Navigate C: > SDL > SDLproject > click file SDL2.dll > right click > click Copy. Now navigate C: > SDL > SDLproject-1 > click on empty area > right click > click Paste. File SDL2.dll is in folder SDLproject-1 among Source-1.cpp and other 4 files.
C.2.5. Now you can compile your SDL project. On window This project is out of date:, below question Would you like to build it? click [Yes].
D. Remark: Creating project with SDL-project-template is as creating ordinary C++ project, but two more steps:
D.1. In Solution Explorer, Source Files, source file (Source.cpp in the example above) of template project (SDLproject, in the example) should be excluded from new project (SDLproject-1 in example).
D.2. File SDL2.dll should be copied from template project and pasted in new project.

Creating shader files

I'm trying to learn some DirectX11 and I found good tutorial I'm following; however, for some reason the program crashes (The window appears but then a "not responding" message box appears), even though the build was successful. There were some thing about creating shader-files the author did specify on how to do, and i wanted to make sure I'm not making any errors there and that why my program crashes. So my questions are :
How do you create a shader files? In the tutorial we are using the extension .fx, but when you add a file in vs you can only choose from .h and .cpp . Do you only have to select .cpp and then add .fx in the end of the file name?
In what directory is the file suppose to be? (My files are currently in Source Files)
Yes that will work. Another way to do it is just to create a .txt then change the extention to .fx
(To show the file extention just open any folder, click on the organize button in the menu then choose "folder and search options". Uncheck the box "Hide extentions for know file types" under the tab view). After you change the extention you can open the document in notepad and write your code there
Go in to your project folder (in windows file system) and create a map called Data. Add you .fx file there. Then go to your solution explorer and rigth click on the project and choose properties. Go to Build Events -> Pre- Build Events. Add the line "xcopy /y /d "$(ProjectDir)Data" "$(OutDir)" in the box "Command Line". Now when building your project the files will be copied to the rigth place and you will be able to use your .fx file.
The .fx is associate it with an effect file. Meaning you have a combination of many shaders in the same file. Can you post some code of your render loop... also, are you calling the Present method?i.e.,
m_pSwapChain->Present(0, 0);

How do you set icons of .exe files?

Preferably using C++. Or a tool I can use from the command line. So far I've figured out how to extract icons from .exe files, but I can't set icons... Any suggestions?
If you want an icon to show in Explorer in a directory list, you'll need to add an icon to your app's .rc file. It must be the first icon in the resource file.
Do you want an icon to appear in the task bar and have it associated with your app's window? In this case you must set the hIcon member in your registered WNDCLASS structure.
Here's a code sample that might help:
Change Icon of EXE file through code extracting it from other EXE file