Last month, I started researching LibGDX, a game engine mainly targeted for Android. Also, this was the first time I worked with a game engine.

My goal is to develop a platform game like Vector but much simpler. This is also inspired by Temple Run. The main character keeps running and avoid being chased by the NPC. Precisely, I have to say that the main character just stays at one place and the background keeps moving backward.

The first problem that I encounterd was the infinite scrolling background. I have researched through Google with many solutions. However, all of them are too complex to solve that simple task. The code can be up to 100 lines long with tons of complicated mathematical formula to calculate how to scroll the background. Finally, I gave up and decided to come up with my own solution. Amazingly, it took me only less than 15 minutes and about 10 lines of code to achieve it.

The theory is very simple. Assume that you have a background file names bg.jpg, what you have to do now is to draw that background, move and loop it side by side. Let's look at the image below and I'll explain

Read more

Often, when I have a large number of media files playing in VLC, the most annoying problem for me is that for each file, I have to manually adjust the volume for them (so that they are not to loud). Moreover, for those music video files, I have to deal with the issue about screen resolution and ratio. My screen’s ratio is 16:10 but most of my videos are in 4:3 or 16:9 ratio.

The word normalize here means that to force all the media files to behave in a same way so that I can enjoy them without worrying to adjust for each file.

Normalize Audio

Normalize Audio

Read more

LibGdx has the built in support for Gesture detection. However, the Swipe Gesture is not well-supported and a bit simple. I have found a solution from this article. The code on that link contains errors. Here is the fixed version of it.

Gesture

Read more

This post is the sixth part of the series Dired as Default File Manager.

All this section I focus on tmtxt-dired-async, which is a tiny library that I devloped to help the use of Dired become easier. Actually, the code is a bit long so that I cannot post it here, that will make my post become messy. Instead, I move all those functions to a separate file and post it here for easy installation.

tmtxt-dired-async is a library for Emacs Dired mode to copy, compress, decompress files asynchronously. It also provides the ability to mark files in multiple directories and then copy all of them into a destination library. This library is designed for Unix-based system like MacOS, Ubuntu,…

The reason why I developed this library is to overcome Emacs Dired’s drawbacks. Everytime I need to copy, move, compress, uncompress,… big files, Emacs is blocked until those processes finish execution. That’s really annoying. This extension helps solve that problem by providing Emacs with the ability to asynchronously execute those tasks as well as display the output to the user.

Furthermore, it also display the progress of the current task as well as notify you when the task finish and automatically close the output window for you.

Read more

This post is the fifth part of the series Dired as Default File Manager.

Since version 24, Emacs offers a powerful tool to create and maintain custom theme called customize-create-theme. It provides you an visual interface for interacting with all those faces as well as previewing color in Emacs. You can even copy from other theme and then customize it a bit to make it yours.

If you haven’t known about Emacs 24 Color Theming yet, have a look at this post Color Theming in Emacs 24. This post just lists some useful faces that you can customize for Dired.

Read more

This post is the fourth part of the series Dired as Default File Manager.

How Dired works

Dired displays the content of the directory based on the result returned from ls command (of course, I’m talking about Unix-based system, not Windows). We can customize the way it displays by adding some more arguments for the ls command.

Prepare ls program

If you are using a GNU Linux based OS, everything is just simple. The GNU version of ls has many options for you to play with and you can skip to the next part.

Read more

This post is the third part of the series Dired as Default File Manager.

Mark file backward

To mark file backward (mark file and move the cursot back to the previous line, opposite with when you press m), add this to your .emacs. If you just want the cursor to stay at the current file, remove (call-interactively ‘dired-previous-line) in the code. Change s-b to the key binding that you like.

(defun dired-mark-backward ()
  (interactive)
  (call-interactively 'dired-mark)
  (call-interactively 'dired-previous-line)
  (call-interactively 'dired-previous-line))
(define-key dired-mode-map (kbd "s-b") 'dired-mark-backward)
Read more

This post is the second part of the series Dired as Default File Manager.

dired-details & dired-details+

This section requires 2 more packages: dired-details and dired-details+. You can easily install both of them through package.el (see this post Emacs Package Manager).

To activate it, add this to your .emacs

(require 'dired-details+)

This picture illustrates how dired-details looks like. You can use ( or ) to toggle hide (like the left window) or show (like the right window) details.

Read more

This post is the first part of the series Dired as Default File Manager.

Before reading this, you should have a look at this page Dired - GNU Emacs Manual to know some basic commands to use Dired properly.

Always Recursion

  • Always recursively delete directory
(setq dired-recursive-deletes 'always)
  • Always recursively copy directory
(setq dired-recursive-copies 'always)

Auto guess target

Set this variable to non-nil, Dired will try to guess a default target directory. This means: if there is a dired buffer displayed in the next window, use its current subdir, instead of the current subdir of this dired buffer. The target is used in the prompt for file copy, rename etc.

Read more

Dired is a visual directory editor, a computer program for editing file system directories. Dired is shipped with Emacs. It can be really strange and difficult for new people. However, once you get used to it, you’ll find it a convinience and useful tool in helping you manage your files effectively.

Introduction

I’m the person who is interested in terminal and command line interface. I love controlling everything in my computer using my keyboard since it’s the fastest way to interact with my computer. It helps me concentrate on what I’m working with on the screen and speed up my work because I don’t have to move my eyes out of the screen and move my hands out of the keyboard. Especially when I work at night, I usually turn off the light and I can see nothing but my screen and I don’t want to waste my time looking for the mouse.

Read more