Skip to content

Loading Resources

acoox edited this page May 23, 2021 · 2 revisions

Introduction

Resources are managed by the Resource Service which loads and stores resources. To spread out the loading times, resources should be loaded in batches as needed.

Currently, the Resource Service supports Textures, Texture Atlases, Music and Sounds, but can be easily extended to support more resource types.

Usage

Resources should be loaded and unloaded into ResourceService using the corresponding load method. The following example is for textures.

private static final String[] forestTextures = {
  "images/grass_1.png",
  "images/grass_2.png",
  "images/grass_3.png"
};

// load
public void create() {
  ServiceLocator.getResourceService().loadTextures(forestTextures);
}

// unload
public void dispose() {
  ServiceLocator.getResourceService().unloadAssets(forestTextures);
}

Behind the Scenes

ResourceService is essentially a wrapper class for libgdx's AssetManager. The main reasons for having a wrapper class are to make it easier to load resources in batches, support the addition of loading screens, and to improve logging.

Table of Contents

Home

Game

Game Home

Design Influences

Gameplay Features

Style

Story

Friendly Units
Map
City
Buildings
Unit Selections

Spell

Game User Testing: Theme of Unit Selection & Spell System

UI User Testing

Tutorial

Resource Stats Display

Loading Screen Bar

Health Bars
In Game menu
  • Feature
  • User Testing:In Game Menu

Landscape Tile Design

Landscape Tile Design Feedback

Weather Design

Weather Design Feedback

Camera Movement

Enemy design

Enemy Units

Enemy AI

How Animation Works

Map Flooding

Game Engine

Getting Started

Entities and Components

Service Locator

Loading Resources

Logging

Unit Testing

Debug Terminal

Input Handling

UI

Animations

Audio

AI

Physics

Game Screens and Areas

Terrain

Concurrency & Threading

Settings

Troubleshooting

MacOS Setup Guide

Clone this wiki locally